https://github.com/mailslurp/mailslurp-client-php
<?php
/**
* WebhookControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* WebhookControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class WebhookControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createAccountWebhook' => [
'application/json',
],
'createWebhook' => [
'application/json',
],
'createWebhookForPhoneNumber' => [
'application/json',
],
'deleteAllWebhooks' => [
'application/json',
],
'deleteWebhook' => [
'application/json',
],
'deleteWebhookById' => [
'application/json',
],
'getAllAccountWebhooks' => [
'application/json',
],
'getAllWebhookResults' => [
'application/json',
],
'getAllWebhooks' => [
'application/json',
],
'getInboxWebhooksPaginated' => [
'application/json',
],
'getJsonSchemaForWebhookEvent' => [
'application/json',
],
'getJsonSchemaForWebhookPayload' => [
'application/json',
],
'getPhoneNumberWebhooksPaginated' => [
'application/json',
],
'getTestWebhookPayload' => [
'application/json',
],
'getTestWebhookPayloadBounce' => [
'application/json',
],
'getTestWebhookPayloadBounceRecipient' => [
'application/json',
],
'getTestWebhookPayloadDeliveryStatus' => [
'application/json',
],
'getTestWebhookPayloadEmailOpened' => [
'application/json',
],
'getTestWebhookPayloadEmailRead' => [
'application/json',
],
'getTestWebhookPayloadForWebhook' => [
'application/json',
],
'getTestWebhookPayloadNewAttachment' => [
'application/json',
],
'getTestWebhookPayloadNewContact' => [
'application/json',
],
'getTestWebhookPayloadNewEmail' => [
'application/json',
],
'getTestWebhookPayloadNewSms' => [
'application/json',
],
'getWebhook' => [
'application/json',
],
'getWebhookResult' => [
'application/json',
],
'getWebhookResults' => [
'application/json',
],
'getWebhookResultsCount' => [
'application/json',
],
'getWebhookResultsUnseenErrorCount' => [
'application/json',
],
'getWebhooks' => [
'application/json',
],
'redriveAllWebhookResults' => [
'application/json',
],
'redriveWebhookResult' => [
'application/json',
],
'sendTestData' => [
'application/json',
],
'updateWebhookHeaders' => [
'application/json',
],
'verifyWebhookSignature' => [
'application/json',
],
'waitForWebhookResults' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createAccountWebhook
*
* Attach a WebHook URL to an inbox
*
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookDto
*/
public function createAccountWebhook($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0])
{
list($response) = $this->createAccountWebhookWithHttpInfo($create_webhook_options, $contentType);
return $response;
}
/**
* Operation createAccountWebhookWithHttpInfo
*
* Attach a WebHook URL to an inbox
*
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createAccountWebhookWithHttpInfo($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0])
{
$request = $this->createAccountWebhookRequest($create_webhook_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createAccountWebhookAsync
*
* Attach a WebHook URL to an inbox
*
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createAccountWebhookAsync($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0])
{
return $this->createAccountWebhookAsyncWithHttpInfo($create_webhook_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createAccountWebhookAsyncWithHttpInfo
*
* Attach a WebHook URL to an inbox
*
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createAccountWebhookAsyncWithHttpInfo($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0])
{
$returnType = '\MailSlurp\Models\WebhookDto';
$request = $this->createAccountWebhookRequest($create_webhook_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createAccountWebhook'
*
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAccountWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createAccountWebhookRequest($create_webhook_options, string $contentType = self::contentTypes['createAccountWebhook'][0])
{
// verify the required parameter 'create_webhook_options' is set
if ($create_webhook_options === null || (is_array($create_webhook_options) && count($create_webhook_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_webhook_options when calling createAccountWebhook'
);
}
$resourcePath = '/webhooks';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_webhook_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_webhook_options));
} else {
$httpBody = $create_webhook_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createWebhook
*
* Attach a WebHook URL to an inbox
*
* @param string $inbox_id inbox_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookDto
*/
public function createWebhook($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0])
{
list($response) = $this->createWebhookWithHttpInfo($inbox_id, $create_webhook_options, $contentType);
return $response;
}
/**
* Operation createWebhookWithHttpInfo
*
* Attach a WebHook URL to an inbox
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createWebhookWithHttpInfo($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0])
{
$request = $this->createWebhookRequest($inbox_id, $create_webhook_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createWebhookAsync
*
* Attach a WebHook URL to an inbox
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createWebhookAsync($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0])
{
return $this->createWebhookAsyncWithHttpInfo($inbox_id, $create_webhook_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createWebhookAsyncWithHttpInfo
*
* Attach a WebHook URL to an inbox
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createWebhookAsyncWithHttpInfo($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0])
{
$returnType = '\MailSlurp\Models\WebhookDto';
$request = $this->createWebhookRequest($inbox_id, $create_webhook_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createWebhook'
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createWebhookRequest($inbox_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhook'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling createWebhook'
);
}
// verify the required parameter 'create_webhook_options' is set
if ($create_webhook_options === null || (is_array($create_webhook_options) && count($create_webhook_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_webhook_options when calling createWebhook'
);
}
$resourcePath = '/inboxes/{inboxId}/webhooks';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_webhook_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_webhook_options));
} else {
$httpBody = $create_webhook_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createWebhookForPhoneNumber
*
* Attach a WebHook URL to a phone number
*
* @param string $phone_number_id phone_number_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookDto
*/
public function createWebhookForPhoneNumber($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0])
{
list($response) = $this->createWebhookForPhoneNumberWithHttpInfo($phone_number_id, $create_webhook_options, $contentType);
return $response;
}
/**
* Operation createWebhookForPhoneNumberWithHttpInfo
*
* Attach a WebHook URL to a phone number
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createWebhookForPhoneNumberWithHttpInfo($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0])
{
$request = $this->createWebhookForPhoneNumberRequest($phone_number_id, $create_webhook_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createWebhookForPhoneNumberAsync
*
* Attach a WebHook URL to a phone number
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createWebhookForPhoneNumberAsync($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0])
{
return $this->createWebhookForPhoneNumberAsyncWithHttpInfo($phone_number_id, $create_webhook_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createWebhookForPhoneNumberAsyncWithHttpInfo
*
* Attach a WebHook URL to a phone number
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createWebhookForPhoneNumberAsyncWithHttpInfo($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0])
{
$returnType = '\MailSlurp\Models\WebhookDto';
$request = $this->createWebhookForPhoneNumberRequest($phone_number_id, $create_webhook_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createWebhookForPhoneNumber'
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\CreateWebhookOptions $create_webhook_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookForPhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createWebhookForPhoneNumberRequest($phone_number_id, $create_webhook_options, string $contentType = self::contentTypes['createWebhookForPhoneNumber'][0])
{
// verify the required parameter 'phone_number_id' is set
if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $phone_number_id when calling createWebhookForPhoneNumber'
);
}
// verify the required parameter 'create_webhook_options' is set
if ($create_webhook_options === null || (is_array($create_webhook_options) && count($create_webhook_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_webhook_options when calling createWebhookForPhoneNumber'
);
}
$resourcePath = '/phone/numbers/{phoneNumberId}/webhooks';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($phone_number_id !== null) {
$resourcePath = str_replace(
'{' . 'phoneNumberId' . '}',
ObjectSerializer::toPathValue($phone_number_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_webhook_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_webhook_options));
} else {
$httpBody = $create_webhook_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllWebhooks
*
* Delete all webhooks
*
* @param \DateTime $before before (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllWebhooks($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0])
{
$this->deleteAllWebhooksWithHttpInfo($before, $contentType);
}
/**
* Operation deleteAllWebhooksWithHttpInfo
*
* Delete all webhooks
*
* @param \DateTime $before before (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllWebhooksWithHttpInfo($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0])
{
$request = $this->deleteAllWebhooksRequest($before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllWebhooksAsync
*
* Delete all webhooks
*
* @param \DateTime $before before (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllWebhooksAsync($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0])
{
return $this->deleteAllWebhooksAsyncWithHttpInfo($before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllWebhooksAsyncWithHttpInfo
*
* Delete all webhooks
*
* @param \DateTime $before before (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllWebhooksAsyncWithHttpInfo($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0])
{
$returnType = '';
$request = $this->deleteAllWebhooksRequest($before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllWebhooks'
*
* @param \DateTime $before before (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllWebhooksRequest($before = null, string $contentType = self::contentTypes['deleteAllWebhooks'][0])
{
$resourcePath = '/webhooks';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteWebhook
*
* Delete and disable a Webhook for an Inbox
*
* @param string $inbox_id inbox_id (required)
* @param string $webhook_id webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteWebhook($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0])
{
$this->deleteWebhookWithHttpInfo($inbox_id, $webhook_id, $contentType);
}
/**
* Operation deleteWebhookWithHttpInfo
*
* Delete and disable a Webhook for an Inbox
*
* @param string $inbox_id (required)
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteWebhookWithHttpInfo($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0])
{
$request = $this->deleteWebhookRequest($inbox_id, $webhook_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteWebhookAsync
*
* Delete and disable a Webhook for an Inbox
*
* @param string $inbox_id (required)
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteWebhookAsync($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0])
{
return $this->deleteWebhookAsyncWithHttpInfo($inbox_id, $webhook_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteWebhookAsyncWithHttpInfo
*
* Delete and disable a Webhook for an Inbox
*
* @param string $inbox_id (required)
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteWebhookAsyncWithHttpInfo($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0])
{
$returnType = '';
$request = $this->deleteWebhookRequest($inbox_id, $webhook_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteWebhook'
*
* @param string $inbox_id (required)
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteWebhookRequest($inbox_id, $webhook_id, string $contentType = self::contentTypes['deleteWebhook'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling deleteWebhook'
);
}
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling deleteWebhook'
);
}
$resourcePath = '/inboxes/{inboxId}/webhooks/{webhookId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteWebhookById
*
* Delete a webhook
*
* @param string $webhook_id webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteWebhookById($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0])
{
$this->deleteWebhookByIdWithHttpInfo($webhook_id, $contentType);
}
/**
* Operation deleteWebhookByIdWithHttpInfo
*
* Delete a webhook
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteWebhookByIdWithHttpInfo($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0])
{
$request = $this->deleteWebhookByIdRequest($webhook_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteWebhookByIdAsync
*
* Delete a webhook
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteWebhookByIdAsync($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0])
{
return $this->deleteWebhookByIdAsyncWithHttpInfo($webhook_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteWebhookByIdAsyncWithHttpInfo
*
* Delete a webhook
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteWebhookByIdAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0])
{
$returnType = '';
$request = $this->deleteWebhookByIdRequest($webhook_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteWebhookById'
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteWebhookByIdRequest($webhook_id, string $contentType = self::contentTypes['deleteWebhookById'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling deleteWebhookById'
);
}
$resourcePath = '/webhooks/{webhookId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllAccountWebhooks
*
* List account webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $event_type Optional event type (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageWebhookProjection
*/
public function getAllAccountWebhooks($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0])
{
list($response) = $this->getAllAccountWebhooksWithHttpInfo($page, $size, $sort, $event_type, $since, $before, $contentType);
return $response;
}
/**
* Operation getAllAccountWebhooksWithHttpInfo
*
* List account webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $event_type Optional event type (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllAccountWebhooksWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0])
{
$request = $this->getAllAccountWebhooksRequest($page, $size, $sort, $event_type, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageWebhookProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageWebhookProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllAccountWebhooksAsync
*
* List account webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $event_type Optional event type (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllAccountWebhooksAsync($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0])
{
return $this->getAllAccountWebhooksAsyncWithHttpInfo($page, $size, $sort, $event_type, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllAccountWebhooksAsyncWithHttpInfo
*
* List account webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $event_type Optional event type (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllAccountWebhooksAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0])
{
$returnType = '\MailSlurp\Models\PageWebhookProjection';
$request = $this->getAllAccountWebhooksRequest($page, $size, $sort, $event_type, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllAccountWebhooks'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $event_type Optional event type (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllAccountWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllAccountWebhooksRequest($page = 0, $size = 20, $sort = 'DESC', $event_type = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllAccountWebhooks'][0])
{
if ($page !== null && $page > 9223372036854775807) {
throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllAccountWebhooks, must be smaller than or equal to 9223372036854775807.');
}
if ($page !== null && $page < 0) {
throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllAccountWebhooks, must be bigger than or equal to 0.');
}
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllAccountWebhooks, must be smaller than or equal to 100.');
}
if ($size !== null && $size < 1) {
throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllAccountWebhooks, must be bigger than or equal to 1.');
}
$resourcePath = '/webhooks/account/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$event_type,
'eventType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllWebhookResults
*
* Get results for all webhooks
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageWebhookResult
*/
public function getAllWebhookResults($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getAllWebhookResults'][0])
{
list($response) = $this->getAllWebhookResultsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType);
return $response;
}
/**
* Operation getAllWebhookResultsWithHttpInfo
*
* Get results for all webhooks
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageWebhookResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllWebhookResultsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getAllWebhookResults'][0])
{
$request = $this->getAllWebhookResultsRequest($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageWebhookResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageWebhookResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageWebhookResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageWebhookResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllWebhookResultsAsync
*
* Get results for all webhooks
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllWebhookResultsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getAllWebhookResults'][0])
{
return $this->getAllWebhookResultsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllWebhookResultsAsyncWithHttpInfo
*
* Get results for all webhooks
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllWebhookResultsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getAllWebhookResults'][0])
{
$returnType = '\MailSlurp\Models\PageWebhookResult';
$request = $this->getAllWebhookResultsRequest($page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllWebhookResults'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllWebhookResultsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getAllWebhookResults'][0])
{
$resourcePath = '/webhooks/results';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unseen_only,
'unseenOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$result_type,
'resultType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$event_name,
'eventName', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$min_status_code,
'minStatusCode', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$max_status_code,
'maxStatusCode', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sms_id,
'smsId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$attachment_id,
'attachmentId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_id,
'emailId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$phone_id,
'phoneId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllWebhooks
*
* List Webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param string $inbox_id Filter by inboxId (optional)
* @param string $phone_id Filter by phoneId (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageWebhookProjection
*/
public function getAllWebhooks($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0])
{
list($response) = $this->getAllWebhooksWithHttpInfo($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType);
return $response;
}
/**
* Operation getAllWebhooksWithHttpInfo
*
* List Webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param string $inbox_id Filter by inboxId (optional)
* @param string $phone_id Filter by phoneId (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllWebhooksWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0])
{
$request = $this->getAllWebhooksRequest($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageWebhookProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageWebhookProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllWebhooksAsync
*
* List Webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param string $inbox_id Filter by inboxId (optional)
* @param string $phone_id Filter by phoneId (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllWebhooksAsync($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0])
{
return $this->getAllWebhooksAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllWebhooksAsyncWithHttpInfo
*
* List Webhooks Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param string $inbox_id Filter by inboxId (optional)
* @param string $phone_id Filter by phoneId (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllWebhooksAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0])
{
$returnType = '\MailSlurp\Models\PageWebhookProjection';
$request = $this->getAllWebhooksRequest($page, $size, $sort, $search_filter, $since, $inbox_id, $phone_id, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllWebhooks'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param string $inbox_id Filter by inboxId (optional)
* @param string $phone_id Filter by phoneId (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllWebhooksRequest($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $inbox_id = null, $phone_id = null, $before = null, string $contentType = self::contentTypes['getAllWebhooks'][0])
{
if ($page !== null && $page > 9223372036854775807) {
throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllWebhooks, must be smaller than or equal to 9223372036854775807.');
}
if ($page !== null && $page < 0) {
throw new \InvalidArgumentException('invalid value for "$page" when calling WebhookControllerApi.getAllWebhooks, must be bigger than or equal to 0.');
}
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllWebhooks, must be smaller than or equal to 100.');
}
if ($size !== null && $size < 1) {
throw new \InvalidArgumentException('invalid value for "$size" when calling WebhookControllerApi.getAllWebhooks, must be bigger than or equal to 1.');
}
$resourcePath = '/webhooks/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$phone_id,
'phoneId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxWebhooksPaginated
*
* Get paginated webhooks for an Inbox
*
* @param string $inbox_id inbox_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageWebhookProjection
*/
public function getInboxWebhooksPaginated($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0])
{
list($response) = $this->getInboxWebhooksPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getInboxWebhooksPaginatedWithHttpInfo
*
* Get paginated webhooks for an Inbox
*
* @param string $inbox_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxWebhooksPaginatedWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0])
{
$request = $this->getInboxWebhooksPaginatedRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageWebhookProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageWebhookProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxWebhooksPaginatedAsync
*
* Get paginated webhooks for an Inbox
*
* @param string $inbox_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxWebhooksPaginatedAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0])
{
return $this->getInboxWebhooksPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxWebhooksPaginatedAsyncWithHttpInfo
*
* Get paginated webhooks for an Inbox
*
* @param string $inbox_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxWebhooksPaginatedAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageWebhookProjection';
$request = $this->getInboxWebhooksPaginatedRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxWebhooksPaginated'
*
* @param string $inbox_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxWebhooksPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxWebhooksPaginatedRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxWebhooksPaginated'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getInboxWebhooksPaginated'
);
}
$resourcePath = '/inboxes/{inboxId}/webhooks/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getJsonSchemaForWebhookEvent
*
* @param string $event event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\JSONSchemaDto
*/
public function getJsonSchemaForWebhookEvent($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0])
{
list($response) = $this->getJsonSchemaForWebhookEventWithHttpInfo($event, $contentType);
return $response;
}
/**
* Operation getJsonSchemaForWebhookEventWithHttpInfo
*
* @param string $event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\JSONSchemaDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getJsonSchemaForWebhookEventWithHttpInfo($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0])
{
$request = $this->getJsonSchemaForWebhookEventRequest($event, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\JSONSchemaDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\JSONSchemaDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\JSONSchemaDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\JSONSchemaDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\JSONSchemaDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getJsonSchemaForWebhookEventAsync
*
* @param string $event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getJsonSchemaForWebhookEventAsync($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0])
{
return $this->getJsonSchemaForWebhookEventAsyncWithHttpInfo($event, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getJsonSchemaForWebhookEventAsyncWithHttpInfo
*
* @param string $event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getJsonSchemaForWebhookEventAsyncWithHttpInfo($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0])
{
$returnType = '\MailSlurp\Models\JSONSchemaDto';
$request = $this->getJsonSchemaForWebhookEventRequest($event, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getJsonSchemaForWebhookEvent'
*
* @param string $event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getJsonSchemaForWebhookEventRequest($event, string $contentType = self::contentTypes['getJsonSchemaForWebhookEvent'][0])
{
// verify the required parameter 'event' is set
if ($event === null || (is_array($event) && count($event) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $event when calling getJsonSchemaForWebhookEvent'
);
}
$resourcePath = '/webhooks/schema';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$event,
'event', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getJsonSchemaForWebhookPayload
*
* @param string $webhook_id webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\JSONSchemaDto
*/
public function getJsonSchemaForWebhookPayload($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0])
{
list($response) = $this->getJsonSchemaForWebhookPayloadWithHttpInfo($webhook_id, $contentType);
return $response;
}
/**
* Operation getJsonSchemaForWebhookPayloadWithHttpInfo
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\JSONSchemaDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getJsonSchemaForWebhookPayloadWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0])
{
$request = $this->getJsonSchemaForWebhookPayloadRequest($webhook_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\JSONSchemaDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\JSONSchemaDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\JSONSchemaDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\JSONSchemaDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\JSONSchemaDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getJsonSchemaForWebhookPayloadAsync
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getJsonSchemaForWebhookPayloadAsync($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0])
{
return $this->getJsonSchemaForWebhookPayloadAsyncWithHttpInfo($webhook_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getJsonSchemaForWebhookPayloadAsyncWithHttpInfo
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getJsonSchemaForWebhookPayloadAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0])
{
$returnType = '\MailSlurp\Models\JSONSchemaDto';
$request = $this->getJsonSchemaForWebhookPayloadRequest($webhook_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getJsonSchemaForWebhookPayload'
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonSchemaForWebhookPayload'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getJsonSchemaForWebhookPayloadRequest($webhook_id, string $contentType = self::contentTypes['getJsonSchemaForWebhookPayload'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling getJsonSchemaForWebhookPayload'
);
}
$resourcePath = '/webhooks/{webhookId}/schema';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getPhoneNumberWebhooksPaginated
*
* Get paginated webhooks for a phone number
*
* @param string $phone_id phone_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageWebhookProjection
*/
public function getPhoneNumberWebhooksPaginated($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0])
{
list($response) = $this->getPhoneNumberWebhooksPaginatedWithHttpInfo($phone_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getPhoneNumberWebhooksPaginatedWithHttpInfo
*
* Get paginated webhooks for a phone number
*
* @param string $phone_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageWebhookProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getPhoneNumberWebhooksPaginatedWithHttpInfo($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0])
{
$request = $this->getPhoneNumberWebhooksPaginatedRequest($phone_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageWebhookProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageWebhookProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageWebhookProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageWebhookProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getPhoneNumberWebhooksPaginatedAsync
*
* Get paginated webhooks for a phone number
*
* @param string $phone_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhoneNumberWebhooksPaginatedAsync($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0])
{
return $this->getPhoneNumberWebhooksPaginatedAsyncWithHttpInfo($phone_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getPhoneNumberWebhooksPaginatedAsyncWithHttpInfo
*
* Get paginated webhooks for a phone number
*
* @param string $phone_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhoneNumberWebhooksPaginatedAsyncWithHttpInfo($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageWebhookProjection';
$request = $this->getPhoneNumberWebhooksPaginatedRequest($phone_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getPhoneNumberWebhooksPaginated'
*
* @param string $phone_id (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumberWebhooksPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getPhoneNumberWebhooksPaginatedRequest($phone_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumberWebhooksPaginated'][0])
{
// verify the required parameter 'phone_id' is set
if ($phone_id === null || (is_array($phone_id) && count($phone_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $phone_id when calling getPhoneNumberWebhooksPaginated'
);
}
$resourcePath = '/phone/numbers/{phoneId}/webhooks/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($phone_id !== null) {
$resourcePath = str_replace(
'{' . 'phoneId' . '}',
ObjectSerializer::toPathValue($phone_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayload
*
* @param string $event_name event_name (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AbstractWebhookPayload
*/
public function getTestWebhookPayload($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0])
{
list($response) = $this->getTestWebhookPayloadWithHttpInfo($event_name, $contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadWithHttpInfo
*
* @param string $event_name (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AbstractWebhookPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadWithHttpInfo($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0])
{
$request = $this->getTestWebhookPayloadRequest($event_name, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\AbstractWebhookPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AbstractWebhookPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AbstractWebhookPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AbstractWebhookPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AbstractWebhookPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadAsync
*
* @param string $event_name (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadAsync($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0])
{
return $this->getTestWebhookPayloadAsyncWithHttpInfo($event_name, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadAsyncWithHttpInfo
*
* @param string $event_name (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadAsyncWithHttpInfo($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0])
{
$returnType = '\MailSlurp\Models\AbstractWebhookPayload';
$request = $this->getTestWebhookPayloadRequest($event_name, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayload'
*
* @param string $event_name (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayload'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadRequest($event_name = null, string $contentType = self::contentTypes['getTestWebhookPayload'][0])
{
$resourcePath = '/webhooks/test';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$event_name,
'eventName', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadBounce
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookBouncePayload
*/
public function getTestWebhookPayloadBounce(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0])
{
list($response) = $this->getTestWebhookPayloadBounceWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadBounceWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookBouncePayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadBounceWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0])
{
$request = $this->getTestWebhookPayloadBounceRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookBouncePayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookBouncePayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookBouncePayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookBouncePayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookBouncePayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadBounceAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadBounceAsync(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0])
{
return $this->getTestWebhookPayloadBounceAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadBounceAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadBounceAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0])
{
$returnType = '\MailSlurp\Models\WebhookBouncePayload';
$request = $this->getTestWebhookPayloadBounceRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadBounce'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounce'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadBounceRequest(string $contentType = self::contentTypes['getTestWebhookPayloadBounce'][0])
{
$resourcePath = '/webhooks/test/email-bounce-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadBounceRecipient
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookBounceRecipientPayload
*/
public function getTestWebhookPayloadBounceRecipient(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0])
{
list($response) = $this->getTestWebhookPayloadBounceRecipientWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadBounceRecipientWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookBounceRecipientPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadBounceRecipientWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0])
{
$request = $this->getTestWebhookPayloadBounceRecipientRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookBounceRecipientPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookBounceRecipientPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookBounceRecipientPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookBounceRecipientPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookBounceRecipientPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadBounceRecipientAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadBounceRecipientAsync(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0])
{
return $this->getTestWebhookPayloadBounceRecipientAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadBounceRecipientAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadBounceRecipientAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0])
{
$returnType = '\MailSlurp\Models\WebhookBounceRecipientPayload';
$request = $this->getTestWebhookPayloadBounceRecipientRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadBounceRecipient'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadBounceRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadBounceRecipientRequest(string $contentType = self::contentTypes['getTestWebhookPayloadBounceRecipient'][0])
{
$resourcePath = '/webhooks/test/email-bounce-recipient-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadDeliveryStatus
*
* Get webhook test payload for delivery status event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookDeliveryStatusPayload
*/
public function getTestWebhookPayloadDeliveryStatus(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0])
{
list($response) = $this->getTestWebhookPayloadDeliveryStatusWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadDeliveryStatusWithHttpInfo
*
* Get webhook test payload for delivery status event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookDeliveryStatusPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadDeliveryStatusWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0])
{
$request = $this->getTestWebhookPayloadDeliveryStatusRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookDeliveryStatusPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookDeliveryStatusPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDeliveryStatusPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookDeliveryStatusPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookDeliveryStatusPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadDeliveryStatusAsync
*
* Get webhook test payload for delivery status event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadDeliveryStatusAsync(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0])
{
return $this->getTestWebhookPayloadDeliveryStatusAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadDeliveryStatusAsyncWithHttpInfo
*
* Get webhook test payload for delivery status event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadDeliveryStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0])
{
$returnType = '\MailSlurp\Models\WebhookDeliveryStatusPayload';
$request = $this->getTestWebhookPayloadDeliveryStatusRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadDeliveryStatus'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadDeliveryStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadDeliveryStatusRequest(string $contentType = self::contentTypes['getTestWebhookPayloadDeliveryStatus'][0])
{
$resourcePath = '/webhooks/test/delivery-status-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadEmailOpened
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookEmailOpenedPayload
*/
public function getTestWebhookPayloadEmailOpened(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0])
{
list($response) = $this->getTestWebhookPayloadEmailOpenedWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadEmailOpenedWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookEmailOpenedPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadEmailOpenedWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0])
{
$request = $this->getTestWebhookPayloadEmailOpenedRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookEmailOpenedPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookEmailOpenedPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookEmailOpenedPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookEmailOpenedPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookEmailOpenedPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadEmailOpenedAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadEmailOpenedAsync(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0])
{
return $this->getTestWebhookPayloadEmailOpenedAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadEmailOpenedAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadEmailOpenedAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0])
{
$returnType = '\MailSlurp\Models\WebhookEmailOpenedPayload';
$request = $this->getTestWebhookPayloadEmailOpenedRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadEmailOpened'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailOpened'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadEmailOpenedRequest(string $contentType = self::contentTypes['getTestWebhookPayloadEmailOpened'][0])
{
$resourcePath = '/webhooks/test/email-opened-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadEmailRead
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookEmailReadPayload
*/
public function getTestWebhookPayloadEmailRead(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0])
{
list($response) = $this->getTestWebhookPayloadEmailReadWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadEmailReadWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookEmailReadPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadEmailReadWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0])
{
$request = $this->getTestWebhookPayloadEmailReadRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookEmailReadPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookEmailReadPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookEmailReadPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookEmailReadPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookEmailReadPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadEmailReadAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadEmailReadAsync(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0])
{
return $this->getTestWebhookPayloadEmailReadAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadEmailReadAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadEmailReadAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0])
{
$returnType = '\MailSlurp\Models\WebhookEmailReadPayload';
$request = $this->getTestWebhookPayloadEmailReadRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadEmailRead'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadEmailRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadEmailReadRequest(string $contentType = self::contentTypes['getTestWebhookPayloadEmailRead'][0])
{
$resourcePath = '/webhooks/test/email-read-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadForWebhook
*
* @param string $webhook_id webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AbstractWebhookPayload
*/
public function getTestWebhookPayloadForWebhook($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0])
{
list($response) = $this->getTestWebhookPayloadForWebhookWithHttpInfo($webhook_id, $contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadForWebhookWithHttpInfo
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AbstractWebhookPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadForWebhookWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0])
{
$request = $this->getTestWebhookPayloadForWebhookRequest($webhook_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\AbstractWebhookPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AbstractWebhookPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AbstractWebhookPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AbstractWebhookPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AbstractWebhookPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadForWebhookAsync
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadForWebhookAsync($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0])
{
return $this->getTestWebhookPayloadForWebhookAsyncWithHttpInfo($webhook_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadForWebhookAsyncWithHttpInfo
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadForWebhookAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0])
{
$returnType = '\MailSlurp\Models\AbstractWebhookPayload';
$request = $this->getTestWebhookPayloadForWebhookRequest($webhook_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadForWebhook'
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadForWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadForWebhookRequest($webhook_id, string $contentType = self::contentTypes['getTestWebhookPayloadForWebhook'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling getTestWebhookPayloadForWebhook'
);
}
$resourcePath = '/webhooks/{webhookId}/example';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadNewAttachment
*
* Get webhook test payload for new attachment event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookNewAttachmentPayload
*/
public function getTestWebhookPayloadNewAttachment(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0])
{
list($response) = $this->getTestWebhookPayloadNewAttachmentWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadNewAttachmentWithHttpInfo
*
* Get webhook test payload for new attachment event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookNewAttachmentPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadNewAttachmentWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0])
{
$request = $this->getTestWebhookPayloadNewAttachmentRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookNewAttachmentPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookNewAttachmentPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewAttachmentPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookNewAttachmentPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookNewAttachmentPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadNewAttachmentAsync
*
* Get webhook test payload for new attachment event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewAttachmentAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0])
{
return $this->getTestWebhookPayloadNewAttachmentAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadNewAttachmentAsyncWithHttpInfo
*
* Get webhook test payload for new attachment event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewAttachmentAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0])
{
$returnType = '\MailSlurp\Models\WebhookNewAttachmentPayload';
$request = $this->getTestWebhookPayloadNewAttachmentRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadNewAttachment'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadNewAttachmentRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewAttachment'][0])
{
$resourcePath = '/webhooks/test/new-attachment-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadNewContact
*
* Get webhook test payload for new contact event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookNewContactPayload
*/
public function getTestWebhookPayloadNewContact(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0])
{
list($response) = $this->getTestWebhookPayloadNewContactWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadNewContactWithHttpInfo
*
* Get webhook test payload for new contact event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookNewContactPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadNewContactWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0])
{
$request = $this->getTestWebhookPayloadNewContactRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookNewContactPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookNewContactPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewContactPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookNewContactPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookNewContactPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadNewContactAsync
*
* Get webhook test payload for new contact event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewContactAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0])
{
return $this->getTestWebhookPayloadNewContactAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadNewContactAsyncWithHttpInfo
*
* Get webhook test payload for new contact event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewContactAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0])
{
$returnType = '\MailSlurp\Models\WebhookNewContactPayload';
$request = $this->getTestWebhookPayloadNewContactRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadNewContact'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadNewContactRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewContact'][0])
{
$resourcePath = '/webhooks/test/new-contact-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadNewEmail
*
* Get webhook test payload for new email event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookNewEmailPayload
*/
public function getTestWebhookPayloadNewEmail(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0])
{
list($response) = $this->getTestWebhookPayloadNewEmailWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadNewEmailWithHttpInfo
*
* Get webhook test payload for new email event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookNewEmailPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadNewEmailWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0])
{
$request = $this->getTestWebhookPayloadNewEmailRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookNewEmailPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookNewEmailPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewEmailPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookNewEmailPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookNewEmailPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadNewEmailAsync
*
* Get webhook test payload for new email event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewEmailAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0])
{
return $this->getTestWebhookPayloadNewEmailAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadNewEmailAsyncWithHttpInfo
*
* Get webhook test payload for new email event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewEmailAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0])
{
$returnType = '\MailSlurp\Models\WebhookNewEmailPayload';
$request = $this->getTestWebhookPayloadNewEmailRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadNewEmail'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadNewEmailRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewEmail'][0])
{
$resourcePath = '/webhooks/test/new-email-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTestWebhookPayloadNewSms
*
* Get webhook test payload for new sms event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookNewSmsPayload
*/
public function getTestWebhookPayloadNewSms(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0])
{
list($response) = $this->getTestWebhookPayloadNewSmsWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTestWebhookPayloadNewSmsWithHttpInfo
*
* Get webhook test payload for new sms event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookNewSmsPayload, HTTP status code, HTTP response headers (array of strings)
*/
public function getTestWebhookPayloadNewSmsWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0])
{
$request = $this->getTestWebhookPayloadNewSmsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookNewSmsPayload' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookNewSmsPayload' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookNewSmsPayload', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookNewSmsPayload';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookNewSmsPayload',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTestWebhookPayloadNewSmsAsync
*
* Get webhook test payload for new sms event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewSmsAsync(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0])
{
return $this->getTestWebhookPayloadNewSmsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTestWebhookPayloadNewSmsAsyncWithHttpInfo
*
* Get webhook test payload for new sms event
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTestWebhookPayloadNewSmsAsyncWithHttpInfo(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0])
{
$returnType = '\MailSlurp\Models\WebhookNewSmsPayload';
$request = $this->getTestWebhookPayloadNewSmsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTestWebhookPayloadNewSms'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTestWebhookPayloadNewSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTestWebhookPayloadNewSmsRequest(string $contentType = self::contentTypes['getTestWebhookPayloadNewSms'][0])
{
$resourcePath = '/webhooks/test/new-sms-payload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getWebhook
*
* Get a webhook
*
* @param string $webhook_id webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookDto
*/
public function getWebhook($webhook_id, string $contentType = self::contentTypes['getWebhook'][0])
{
list($response) = $this->getWebhookWithHttpInfo($webhook_id, $contentType);
return $response;
}
/**
* Operation getWebhookWithHttpInfo
*
* Get a webhook
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getWebhookWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getWebhook'][0])
{
$request = $this->getWebhookRequest($webhook_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getWebhookAsync
*
* Get a webhook
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookAsync($webhook_id, string $contentType = self::contentTypes['getWebhook'][0])
{
return $this->getWebhookAsyncWithHttpInfo($webhook_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getWebhookAsyncWithHttpInfo
*
* Get a webhook
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getWebhook'][0])
{
$returnType = '\MailSlurp\Models\WebhookDto';
$request = $this->getWebhookRequest($webhook_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getWebhook'
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhook'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getWebhookRequest($webhook_id, string $contentType = self::contentTypes['getWebhook'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling getWebhook'
);
}
$resourcePath = '/webhooks/{webhookId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getWebhookResult
*
* Get a webhook result for a webhook
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookResultDto
*/
public function getWebhookResult($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0])
{
list($response) = $this->getWebhookResultWithHttpInfo($webhook_result_id, $contentType);
return $response;
}
/**
* Operation getWebhookResultWithHttpInfo
*
* Get a webhook result for a webhook
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookResultDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getWebhookResultWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0])
{
$request = $this->getWebhookResultRequest($webhook_result_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookResultDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookResultDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookResultDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookResultDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookResultDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getWebhookResultAsync
*
* Get a webhook result for a webhook
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultAsync($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0])
{
return $this->getWebhookResultAsyncWithHttpInfo($webhook_result_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getWebhookResultAsyncWithHttpInfo
*
* Get a webhook result for a webhook
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultAsyncWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0])
{
$returnType = '\MailSlurp\Models\WebhookResultDto';
$request = $this->getWebhookResultRequest($webhook_result_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getWebhookResult'
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResult'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getWebhookResultRequest($webhook_result_id, string $contentType = self::contentTypes['getWebhookResult'][0])
{
// verify the required parameter 'webhook_result_id' is set
if ($webhook_result_id === null || (is_array($webhook_result_id) && count($webhook_result_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_result_id when calling getWebhookResult'
);
}
$resourcePath = '/webhooks/results/{webhookResultId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_result_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookResultId' . '}',
ObjectSerializer::toPathValue($webhook_result_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getWebhookResults
*
* Get a webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageWebhookResult
*/
public function getWebhookResults($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getWebhookResults'][0])
{
list($response) = $this->getWebhookResultsWithHttpInfo($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType);
return $response;
}
/**
* Operation getWebhookResultsWithHttpInfo
*
* Get a webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageWebhookResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getWebhookResultsWithHttpInfo($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getWebhookResults'][0])
{
$request = $this->getWebhookResultsRequest($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageWebhookResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageWebhookResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageWebhookResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageWebhookResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageWebhookResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getWebhookResultsAsync
*
* Get a webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultsAsync($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getWebhookResults'][0])
{
return $this->getWebhookResultsAsyncWithHttpInfo($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getWebhookResultsAsyncWithHttpInfo
*
* Get a webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultsAsyncWithHttpInfo($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getWebhookResults'][0])
{
$returnType = '\MailSlurp\Models\PageWebhookResult';
$request = $this->getWebhookResultsRequest($webhook_id, $page, $size, $sort, $search_filter, $since, $before, $unseen_only, $result_type, $event_name, $min_status_code, $max_status_code, $inbox_id, $sms_id, $attachment_id, $email_id, $phone_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getWebhookResults'
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $unseen_only Filter for unseen exceptions only (optional)
* @param string $result_type Filter by result type (optional)
* @param string $event_name Filter by event name (optional)
* @param int $min_status_code Minimum response status (optional)
* @param int $max_status_code Maximum response status (optional)
* @param string $inbox_id Inbox ID (optional)
* @param string $sms_id Sms ID (optional)
* @param string $attachment_id Attachment ID (optional)
* @param string $email_id Email ID (optional)
* @param string $phone_id Phone ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getWebhookResultsRequest($webhook_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $unseen_only = null, $result_type = null, $event_name = null, $min_status_code = null, $max_status_code = null, $inbox_id = null, $sms_id = null, $attachment_id = null, $email_id = null, $phone_id = null, string $contentType = self::contentTypes['getWebhookResults'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling getWebhookResults'
);
}
$resourcePath = '/webhooks/{webhookId}/results';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unseen_only,
'unseenOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$result_type,
'resultType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$event_name,
'eventName', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$min_status_code,
'minStatusCode', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$max_status_code,
'maxStatusCode', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sms_id,
'smsId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$attachment_id,
'attachmentId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_id,
'emailId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$phone_id,
'phoneId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getWebhookResultsCount
*
* Get a webhook results count for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CountDto
*/
public function getWebhookResultsCount($webhook_id, string $contentType = self::contentTypes['getWebhookResultsCount'][0])
{
list($response) = $this->getWebhookResultsCountWithHttpInfo($webhook_id, $contentType);
return $response;
}
/**
* Operation getWebhookResultsCountWithHttpInfo
*
* Get a webhook results count for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getWebhookResultsCountWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getWebhookResultsCount'][0])
{
$request = $this->getWebhookResultsCountRequest($webhook_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CountDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CountDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CountDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CountDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getWebhookResultsCountAsync
*
* Get a webhook results count for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultsCountAsync($webhook_id, string $contentType = self::contentTypes['getWebhookResultsCount'][0])
{
return $this->getWebhookResultsCountAsyncWithHttpInfo($webhook_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getWebhookResultsCountAsyncWithHttpInfo
*
* Get a webhook results count for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultsCountAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['getWebhookResultsCount'][0])
{
$returnType = '\MailSlurp\Models\CountDto';
$request = $this->getWebhookResultsCountRequest($webhook_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getWebhookResultsCount'
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getWebhookResultsCountRequest($webhook_id, string $contentType = self::contentTypes['getWebhookResultsCount'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling getWebhookResultsCount'
);
}
$resourcePath = '/webhooks/{webhookId}/results/count';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getWebhookResultsUnseenErrorCount
*
* Get count of unseen webhook results with error status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\UnseenErrorCountDto
*/
public function getWebhookResultsUnseenErrorCount(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0])
{
list($response) = $this->getWebhookResultsUnseenErrorCountWithHttpInfo($contentType);
return $response;
}
/**
* Operation getWebhookResultsUnseenErrorCountWithHttpInfo
*
* Get count of unseen webhook results with error status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\UnseenErrorCountDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getWebhookResultsUnseenErrorCountWithHttpInfo(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0])
{
$request = $this->getWebhookResultsUnseenErrorCountRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\UnseenErrorCountDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\UnseenErrorCountDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\UnseenErrorCountDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\UnseenErrorCountDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\UnseenErrorCountDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getWebhookResultsUnseenErrorCountAsync
*
* Get count of unseen webhook results with error status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultsUnseenErrorCountAsync(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0])
{
return $this->getWebhookResultsUnseenErrorCountAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getWebhookResultsUnseenErrorCountAsyncWithHttpInfo
*
* Get count of unseen webhook results with error status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getWebhookResultsUnseenErrorCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0])
{
$returnType = '\MailSlurp\Models\UnseenErrorCountDto';
$request = $this->getWebhookResultsUnseenErrorCountRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getWebhookResultsUnseenErrorCount'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhookResultsUnseenErrorCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getWebhookResultsUnseenErrorCountRequest(string $contentType = self::contentTypes['getWebhookResultsUnseenErrorCount'][0])
{
$resourcePath = '/webhooks/results/unseen-count';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getWebhooks
*
* Get all webhooks for an Inbox
*
* @param string $inbox_id inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookDto[]
* @deprecated
*/
public function getWebhooks($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0])
{
list($response) = $this->getWebhooksWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getWebhooksWithHttpInfo
*
* Get all webhooks for an Inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookDto[], HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getWebhooksWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0])
{
$request = $this->getWebhooksRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookDto[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookDto[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookDto[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookDto[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getWebhooksAsync
*
* Get all webhooks for an Inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getWebhooksAsync($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0])
{
return $this->getWebhooksAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getWebhooksAsyncWithHttpInfo
*
* Get all webhooks for an Inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getWebhooksAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0])
{
$returnType = '\MailSlurp\Models\WebhookDto[]';
$request = $this->getWebhooksRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getWebhooks'
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getWebhooks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getWebhooksRequest($inbox_id, string $contentType = self::contentTypes['getWebhooks'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getWebhooks'
);
}
$resourcePath = '/inboxes/{inboxId}/webhooks';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation redriveAllWebhookResults
*
* Redrive all webhook results that have failed status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveAllWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookRedriveAllResult
*/
public function redriveAllWebhookResults(string $contentType = self::contentTypes['redriveAllWebhookResults'][0])
{
list($response) = $this->redriveAllWebhookResultsWithHttpInfo($contentType);
return $response;
}
/**
* Operation redriveAllWebhookResultsWithHttpInfo
*
* Redrive all webhook results that have failed status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveAllWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookRedriveAllResult, HTTP status code, HTTP response headers (array of strings)
*/
public function redriveAllWebhookResultsWithHttpInfo(string $contentType = self::contentTypes['redriveAllWebhookResults'][0])
{
$request = $this->redriveAllWebhookResultsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookRedriveAllResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookRedriveAllResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookRedriveAllResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookRedriveAllResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookRedriveAllResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation redriveAllWebhookResultsAsync
*
* Redrive all webhook results that have failed status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveAllWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function redriveAllWebhookResultsAsync(string $contentType = self::contentTypes['redriveAllWebhookResults'][0])
{
return $this->redriveAllWebhookResultsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation redriveAllWebhookResultsAsyncWithHttpInfo
*
* Redrive all webhook results that have failed status
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveAllWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function redriveAllWebhookResultsAsyncWithHttpInfo(string $contentType = self::contentTypes['redriveAllWebhookResults'][0])
{
$returnType = '\MailSlurp\Models\WebhookRedriveAllResult';
$request = $this->redriveAllWebhookResultsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'redriveAllWebhookResults'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveAllWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function redriveAllWebhookResultsRequest(string $contentType = self::contentTypes['redriveAllWebhookResults'][0])
{
$resourcePath = '/webhooks/results/redrive';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation redriveWebhookResult
*
* Get a webhook result and try to resend the original webhook payload
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookRedriveResult
*/
public function redriveWebhookResult($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0])
{
list($response) = $this->redriveWebhookResultWithHttpInfo($webhook_result_id, $contentType);
return $response;
}
/**
* Operation redriveWebhookResultWithHttpInfo
*
* Get a webhook result and try to resend the original webhook payload
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookRedriveResult, HTTP status code, HTTP response headers (array of strings)
*/
public function redriveWebhookResultWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0])
{
$request = $this->redriveWebhookResultRequest($webhook_result_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookRedriveResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookRedriveResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookRedriveResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookRedriveResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookRedriveResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation redriveWebhookResultAsync
*
* Get a webhook result and try to resend the original webhook payload
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function redriveWebhookResultAsync($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0])
{
return $this->redriveWebhookResultAsyncWithHttpInfo($webhook_result_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation redriveWebhookResultAsyncWithHttpInfo
*
* Get a webhook result and try to resend the original webhook payload
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function redriveWebhookResultAsyncWithHttpInfo($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0])
{
$returnType = '\MailSlurp\Models\WebhookRedriveResult';
$request = $this->redriveWebhookResultRequest($webhook_result_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'redriveWebhookResult'
*
* @param string $webhook_result_id Webhook Result ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['redriveWebhookResult'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function redriveWebhookResultRequest($webhook_result_id, string $contentType = self::contentTypes['redriveWebhookResult'][0])
{
// verify the required parameter 'webhook_result_id' is set
if ($webhook_result_id === null || (is_array($webhook_result_id) && count($webhook_result_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_result_id when calling redriveWebhookResult'
);
}
$resourcePath = '/webhooks/results/{webhookResultId}/redrive';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_result_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookResultId' . '}',
ObjectSerializer::toPathValue($webhook_result_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendTestData
*
* Send webhook test data
*
* @param string $webhook_id webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookTestResult
*/
public function sendTestData($webhook_id, string $contentType = self::contentTypes['sendTestData'][0])
{
list($response) = $this->sendTestDataWithHttpInfo($webhook_id, $contentType);
return $response;
}
/**
* Operation sendTestDataWithHttpInfo
*
* Send webhook test data
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookTestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function sendTestDataWithHttpInfo($webhook_id, string $contentType = self::contentTypes['sendTestData'][0])
{
$request = $this->sendTestDataRequest($webhook_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\WebhookTestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookTestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookTestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookTestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookTestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation sendTestDataAsync
*
* Send webhook test data
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendTestDataAsync($webhook_id, string $contentType = self::contentTypes['sendTestData'][0])
{
return $this->sendTestDataAsyncWithHttpInfo($webhook_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendTestDataAsyncWithHttpInfo
*
* Send webhook test data
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendTestDataAsyncWithHttpInfo($webhook_id, string $contentType = self::contentTypes['sendTestData'][0])
{
$returnType = '\MailSlurp\Models\WebhookTestResult';
$request = $this->sendTestDataRequest($webhook_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendTestData'
*
* @param string $webhook_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestData'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendTestDataRequest($webhook_id, string $contentType = self::contentTypes['sendTestData'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling sendTestData'
);
}
$resourcePath = '/webhooks/{webhookId}/test';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateWebhookHeaders
*
* Update a webhook request headers
*
* @param string $webhook_id webhook_id (required)
* @param \MailSlurp\Models\WebhookHeaders $webhook_headers webhook_headers (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookDto
*/
public function updateWebhookHeaders($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0])
{
list($response) = $this->updateWebhookHeadersWithHttpInfo($webhook_id, $webhook_headers, $contentType);
return $response;
}
/**
* Operation updateWebhookHeadersWithHttpInfo
*
* Update a webhook request headers
*
* @param string $webhook_id (required)
* @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateWebhookHeadersWithHttpInfo($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0])
{
$request = $this->updateWebhookHeadersRequest($webhook_id, $webhook_headers, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateWebhookHeadersAsync
*
* Update a webhook request headers
*
* @param string $webhook_id (required)
* @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateWebhookHeadersAsync($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0])
{
return $this->updateWebhookHeadersAsyncWithHttpInfo($webhook_id, $webhook_headers, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateWebhookHeadersAsyncWithHttpInfo
*
* Update a webhook request headers
*
* @param string $webhook_id (required)
* @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateWebhookHeadersAsyncWithHttpInfo($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0])
{
$returnType = '\MailSlurp\Models\WebhookDto';
$request = $this->updateWebhookHeadersRequest($webhook_id, $webhook_headers, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateWebhookHeaders'
*
* @param string $webhook_id (required)
* @param \MailSlurp\Models\WebhookHeaders $webhook_headers (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookHeaders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateWebhookHeadersRequest($webhook_id, $webhook_headers, string $contentType = self::contentTypes['updateWebhookHeaders'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling updateWebhookHeaders'
);
}
// verify the required parameter 'webhook_headers' is set
if ($webhook_headers === null || (is_array($webhook_headers) && count($webhook_headers) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_headers when calling updateWebhookHeaders'
);
}
$resourcePath = '/webhooks/{webhookId}/headers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($webhook_headers)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($webhook_headers));
} else {
$httpBody = $webhook_headers;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation verifyWebhookSignature
*
* Verify a webhook payload signature
*
* @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options verify_webhook_signature_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\VerifyWebhookSignatureResults
*/
public function verifyWebhookSignature($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0])
{
list($response) = $this->verifyWebhookSignatureWithHttpInfo($verify_webhook_signature_options, $contentType);
return $response;
}
/**
* Operation verifyWebhookSignatureWithHttpInfo
*
* Verify a webhook payload signature
*
* @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\VerifyWebhookSignatureResults, HTTP status code, HTTP response headers (array of strings)
*/
public function verifyWebhookSignatureWithHttpInfo($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0])
{
$request = $this->verifyWebhookSignatureRequest($verify_webhook_signature_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\VerifyWebhookSignatureResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\VerifyWebhookSignatureResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\VerifyWebhookSignatureResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\VerifyWebhookSignatureResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\VerifyWebhookSignatureResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation verifyWebhookSignatureAsync
*
* Verify a webhook payload signature
*
* @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function verifyWebhookSignatureAsync($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0])
{
return $this->verifyWebhookSignatureAsyncWithHttpInfo($verify_webhook_signature_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation verifyWebhookSignatureAsyncWithHttpInfo
*
* Verify a webhook payload signature
*
* @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function verifyWebhookSignatureAsyncWithHttpInfo($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0])
{
$returnType = '\MailSlurp\Models\VerifyWebhookSignatureResults';
$request = $this->verifyWebhookSignatureRequest($verify_webhook_signature_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'verifyWebhookSignature'
*
* @param \MailSlurp\Models\VerifyWebhookSignatureOptions $verify_webhook_signature_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyWebhookSignature'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function verifyWebhookSignatureRequest($verify_webhook_signature_options, string $contentType = self::contentTypes['verifyWebhookSignature'][0])
{
// verify the required parameter 'verify_webhook_signature_options' is set
if ($verify_webhook_signature_options === null || (is_array($verify_webhook_signature_options) && count($verify_webhook_signature_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $verify_webhook_signature_options when calling verifyWebhookSignature'
);
}
$resourcePath = '/webhooks/verify';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($verify_webhook_signature_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($verify_webhook_signature_options));
} else {
$httpBody = $verify_webhook_signature_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForWebhookResults
*
* Wait for webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $expected_count Expected result count (required)
* @param int $timeout Max time to wait in milliseconds (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\WebhookResultDto[]
*/
public function waitForWebhookResults($webhook_id, $expected_count, $timeout, string $contentType = self::contentTypes['waitForWebhookResults'][0])
{
list($response) = $this->waitForWebhookResultsWithHttpInfo($webhook_id, $expected_count, $timeout, $contentType);
return $response;
}
/**
* Operation waitForWebhookResultsWithHttpInfo
*
* Wait for webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $expected_count Expected result count (required)
* @param int $timeout Max time to wait in milliseconds (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForWebhookResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\WebhookResultDto[], HTTP status code, HTTP response headers (array of strings)
*/
public function waitForWebhookResultsWithHttpInfo($webhook_id, $expected_count, $timeout, string $contentType = self::contentTypes['waitForWebhookResults'][0])
{
$request = $this->waitForWebhookResultsRequest($webhook_id, $expected_count, $timeout, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\WebhookResultDto[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\WebhookResultDto[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\WebhookResultDto[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\WebhookResultDto[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\WebhookResultDto[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForWebhookResultsAsync
*
* Wait for webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $expected_count Expected result count (required)
* @param int $timeout Max time to wait in milliseconds (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForWebhookResultsAsync($webhook_id, $expected_count, $timeout, string $contentType = self::contentTypes['waitForWebhookResults'][0])
{
return $this->waitForWebhookResultsAsyncWithHttpInfo($webhook_id, $expected_count, $timeout, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForWebhookResultsAsyncWithHttpInfo
*
* Wait for webhook results for a webhook
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $expected_count Expected result count (required)
* @param int $timeout Max time to wait in milliseconds (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForWebhookResultsAsyncWithHttpInfo($webhook_id, $expected_count, $timeout, string $contentType = self::contentTypes['waitForWebhookResults'][0])
{
$returnType = '\MailSlurp\Models\WebhookResultDto[]';
$request = $this->waitForWebhookResultsRequest($webhook_id, $expected_count, $timeout, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForWebhookResults'
*
* @param string $webhook_id ID of webhook to get results for (required)
* @param int $expected_count Expected result count (required)
* @param int $timeout Max time to wait in milliseconds (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForWebhookResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForWebhookResultsRequest($webhook_id, $expected_count, $timeout, string $contentType = self::contentTypes['waitForWebhookResults'][0])
{
// verify the required parameter 'webhook_id' is set
if ($webhook_id === null || (is_array($webhook_id) && count($webhook_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $webhook_id when calling waitForWebhookResults'
);
}
// verify the required parameter 'expected_count' is set
if ($expected_count === null || (is_array($expected_count) && count($expected_count) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $expected_count when calling waitForWebhookResults'
);
}
if ($expected_count > 100) {
throw new \InvalidArgumentException('invalid value for "$expected_count" when calling WebhookControllerApi.waitForWebhookResults, must be smaller than or equal to 100.');
}
// verify the required parameter 'timeout' is set
if ($timeout === null || (is_array($timeout) && count($timeout) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $timeout when calling waitForWebhookResults'
);
}
if ($timeout > 300000) {
throw new \InvalidArgumentException('invalid value for "$timeout" when calling WebhookControllerApi.waitForWebhookResults, must be smaller than or equal to 300000.');
}
if ($timeout < 1000) {
throw new \InvalidArgumentException('invalid value for "$timeout" when calling WebhookControllerApi.waitForWebhookResults, must be bigger than or equal to 1000.');
}
$resourcePath = '/webhooks/{webhookId}/wait';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$expected_count,
'expectedCount', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// path params
if ($webhook_id !== null) {
$resourcePath = str_replace(
'{' . 'webhookId' . '}',
ObjectSerializer::toPathValue($webhook_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* WaitForControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* WaitForControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class WaitForControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'waitFor' => [
'application/json',
],
'waitForEmailCount' => [
'application/json',
],
'waitForLatestEmail' => [
'application/json',
],
'waitForLatestSms' => [
'application/json',
],
'waitForMatchingEmails' => [
'application/json',
],
'waitForMatchingFirstEmail' => [
'application/json',
],
'waitForNthEmail' => [
'application/json',
],
'waitForSms' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation waitFor
*
* Wait for an email to match the provided filter conditions such as subject contains keyword.
*
* @param \MailSlurp\Models\WaitForConditions $wait_for_conditions wait_for_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreview[]
*/
public function waitFor($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0])
{
list($response) = $this->waitForWithHttpInfo($wait_for_conditions, $contentType);
return $response;
}
/**
* Operation waitForWithHttpInfo
*
* Wait for an email to match the provided filter conditions such as subject contains keyword.
*
* @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings)
*/
public function waitForWithHttpInfo($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0])
{
$request = $this->waitForRequest($wait_for_conditions, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreview[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreview[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreview[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForAsync
*
* Wait for an email to match the provided filter conditions such as subject contains keyword.
*
* @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForAsync($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0])
{
return $this->waitForAsyncWithHttpInfo($wait_for_conditions, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForAsyncWithHttpInfo
*
* Wait for an email to match the provided filter conditions such as subject contains keyword.
*
* @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForAsyncWithHttpInfo($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0])
{
$returnType = '\MailSlurp\Models\EmailPreview[]';
$request = $this->waitForRequest($wait_for_conditions, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitFor'
*
* @param \MailSlurp\Models\WaitForConditions $wait_for_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitFor'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForRequest($wait_for_conditions, string $contentType = self::contentTypes['waitFor'][0])
{
// verify the required parameter 'wait_for_conditions' is set
if ($wait_for_conditions === null || (is_array($wait_for_conditions) && count($wait_for_conditions) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $wait_for_conditions when calling waitFor'
);
}
$resourcePath = '/waitFor';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($wait_for_conditions)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($wait_for_conditions));
} else {
$httpBody = $wait_for_conditions;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForEmailCount
*
* Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater that 1 (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreview[]
*/
public function waitForEmailCount($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0])
{
list($response) = $this->waitForEmailCountWithHttpInfo($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType);
return $response;
}
/**
* Operation waitForEmailCountWithHttpInfo
*
* Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater that 1 (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings)
*/
public function waitForEmailCountWithHttpInfo($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0])
{
$request = $this->waitForEmailCountRequest($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreview[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreview[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreview[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForEmailCountAsync
*
* Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater that 1 (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForEmailCountAsync($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0])
{
return $this->waitForEmailCountAsyncWithHttpInfo($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForEmailCountAsyncWithHttpInfo
*
* Wait for and return count number of emails. Hold connection until inbox count matches expected or timeout occurs
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater that 1 (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForEmailCountAsyncWithHttpInfo($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0])
{
$returnType = '\MailSlurp\Models\EmailPreview[]';
$request = $this->waitForEmailCountRequest($inbox_id, $count, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForEmailCount'
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater that 1 (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForEmailCountRequest($inbox_id, $count, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForEmailCount'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling waitForEmailCount'
);
}
// verify the required parameter 'count' is set
if ($count === null || (is_array($count) && count($count) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $count when calling waitForEmailCount'
);
}
if ($count < 1) {
throw new \InvalidArgumentException('invalid value for "$count" when calling WaitForControllerApi.waitForEmailCount, must be bigger than or equal to 1.');
}
$resourcePath = '/waitForEmailCount';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$count,
'count', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$delay,
'delay', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForLatestEmail
*
* Fetch inbox's latest email or if empty wait for an email to arrive
*
* @param string $inbox_id Id of the inbox we are fetching emails from (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only. (optional, default to false)
* @param \DateTime $before Filter for emails that were before after the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Email
*/
public function waitForLatestEmail($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0])
{
list($response) = $this->waitForLatestEmailWithHttpInfo($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType);
return $response;
}
/**
* Operation waitForLatestEmailWithHttpInfo
*
* Fetch inbox's latest email or if empty wait for an email to arrive
*
* @param string $inbox_id Id of the inbox we are fetching emails from (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only. (optional, default to false)
* @param \DateTime $before Filter for emails that were before after the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings)
*/
public function waitForLatestEmailWithHttpInfo($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0])
{
$request = $this->waitForLatestEmailRequest($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Email' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Email' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Email';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Email',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForLatestEmailAsync
*
* Fetch inbox's latest email or if empty wait for an email to arrive
*
* @param string $inbox_id Id of the inbox we are fetching emails from (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only. (optional, default to false)
* @param \DateTime $before Filter for emails that were before after the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForLatestEmailAsync($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0])
{
return $this->waitForLatestEmailAsyncWithHttpInfo($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForLatestEmailAsyncWithHttpInfo
*
* Fetch inbox's latest email or if empty wait for an email to arrive
*
* @param string $inbox_id Id of the inbox we are fetching emails from (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only. (optional, default to false)
* @param \DateTime $before Filter for emails that were before after the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForLatestEmailAsyncWithHttpInfo($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0])
{
$returnType = '\MailSlurp\Models\Email';
$request = $this->waitForLatestEmailRequest($inbox_id, $timeout, $unread_only, $before, $since, $sort, $delay, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForLatestEmail'
*
* @param string $inbox_id Id of the inbox we are fetching emails from (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only. (optional, default to false)
* @param \DateTime $before Filter for emails that were before after the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForLatestEmailRequest($inbox_id = null, $timeout = null, $unread_only = false, $before = null, $since = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForLatestEmail'][0])
{
$resourcePath = '/waitForLatestEmail';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$delay,
'delay', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForLatestSms
*
* Wait for the latest SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options wait_for_single_sms_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SmsDto
*/
public function waitForLatestSms($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0])
{
list($response) = $this->waitForLatestSmsWithHttpInfo($wait_for_single_sms_options, $contentType);
return $response;
}
/**
* Operation waitForLatestSmsWithHttpInfo
*
* Wait for the latest SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SmsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function waitForLatestSmsWithHttpInfo($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0])
{
$request = $this->waitForLatestSmsRequest($wait_for_single_sms_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SmsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SmsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SmsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SmsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SmsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForLatestSmsAsync
*
* Wait for the latest SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForLatestSmsAsync($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0])
{
return $this->waitForLatestSmsAsyncWithHttpInfo($wait_for_single_sms_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForLatestSmsAsyncWithHttpInfo
*
* Wait for the latest SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForLatestSmsAsyncWithHttpInfo($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0])
{
$returnType = '\MailSlurp\Models\SmsDto';
$request = $this->waitForLatestSmsRequest($wait_for_single_sms_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForLatestSms'
*
* @param \MailSlurp\Models\WaitForSingleSmsOptions $wait_for_single_sms_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForLatestSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForLatestSmsRequest($wait_for_single_sms_options, string $contentType = self::contentTypes['waitForLatestSms'][0])
{
// verify the required parameter 'wait_for_single_sms_options' is set
if ($wait_for_single_sms_options === null || (is_array($wait_for_single_sms_options) && count($wait_for_single_sms_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $wait_for_single_sms_options when calling waitForLatestSms'
);
}
$resourcePath = '/waitForLatestSms';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($wait_for_single_sms_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($wait_for_single_sms_options));
} else {
$httpBody = $wait_for_single_sms_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForMatchingEmails
*
* Wait or return list of emails that match simple matching patterns
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater or equal to 1 (required)
* @param \MailSlurp\Models\MatchOptions $match_options match_options (required)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreview[]
*/
public function waitForMatchingEmails($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0])
{
list($response) = $this->waitForMatchingEmailsWithHttpInfo($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType);
return $response;
}
/**
* Operation waitForMatchingEmailsWithHttpInfo
*
* Wait or return list of emails that match simple matching patterns
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater or equal to 1 (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings)
*/
public function waitForMatchingEmailsWithHttpInfo($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0])
{
$request = $this->waitForMatchingEmailsRequest($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreview[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreview[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreview[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForMatchingEmailsAsync
*
* Wait or return list of emails that match simple matching patterns
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater or equal to 1 (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForMatchingEmailsAsync($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0])
{
return $this->waitForMatchingEmailsAsyncWithHttpInfo($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForMatchingEmailsAsyncWithHttpInfo
*
* Wait or return list of emails that match simple matching patterns
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater or equal to 1 (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForMatchingEmailsAsyncWithHttpInfo($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0])
{
$returnType = '\MailSlurp\Models\EmailPreview[]';
$request = $this->waitForMatchingEmailsRequest($inbox_id, $count, $match_options, $before, $since, $sort, $delay, $timeout, $unread_only, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForMatchingEmails'
*
* @param string $inbox_id Id of the inbox we are fetching emails from (required)
* @param int $count Number of emails to wait for. Must be greater or equal to 1 (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForMatchingEmailsRequest($inbox_id, $count, $match_options, $before = null, $since = null, $sort = null, $delay = null, $timeout = null, $unread_only = false, string $contentType = self::contentTypes['waitForMatchingEmails'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling waitForMatchingEmails'
);
}
// verify the required parameter 'count' is set
if ($count === null || (is_array($count) && count($count) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $count when calling waitForMatchingEmails'
);
}
if ($count < 1) {
throw new \InvalidArgumentException('invalid value for "$count" when calling WaitForControllerApi.waitForMatchingEmails, must be bigger than or equal to 1.');
}
// verify the required parameter 'match_options' is set
if ($match_options === null || (is_array($match_options) && count($match_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $match_options when calling waitForMatchingEmails'
);
}
$resourcePath = '/waitForMatchingEmails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$count,
'count', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$delay,
'delay', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($match_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($match_options));
} else {
$httpBody = $match_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForMatchingFirstEmail
*
* Wait for or return the first email that matches provided MatchOptions array
*
* @param string $inbox_id Id of the inbox we are matching an email for (required)
* @param \MailSlurp\Models\MatchOptions $match_options match_options (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Email
*/
public function waitForMatchingFirstEmail($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0])
{
list($response) = $this->waitForMatchingFirstEmailWithHttpInfo($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType);
return $response;
}
/**
* Operation waitForMatchingFirstEmailWithHttpInfo
*
* Wait for or return the first email that matches provided MatchOptions array
*
* @param string $inbox_id Id of the inbox we are matching an email for (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings)
*/
public function waitForMatchingFirstEmailWithHttpInfo($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0])
{
$request = $this->waitForMatchingFirstEmailRequest($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Email' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Email' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Email';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Email',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForMatchingFirstEmailAsync
*
* Wait for or return the first email that matches provided MatchOptions array
*
* @param string $inbox_id Id of the inbox we are matching an email for (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForMatchingFirstEmailAsync($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0])
{
return $this->waitForMatchingFirstEmailAsyncWithHttpInfo($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForMatchingFirstEmailAsyncWithHttpInfo
*
* Wait for or return the first email that matches provided MatchOptions array
*
* @param string $inbox_id Id of the inbox we are matching an email for (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForMatchingFirstEmailAsyncWithHttpInfo($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0])
{
$returnType = '\MailSlurp\Models\Email';
$request = $this->waitForMatchingFirstEmailRequest($inbox_id, $match_options, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForMatchingFirstEmail'
*
* @param string $inbox_id Id of the inbox we are matching an email for (required)
* @param \MailSlurp\Models\MatchOptions $match_options (required)
* @param int $timeout Max milliseconds to wait (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForMatchingFirstEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForMatchingFirstEmailRequest($inbox_id, $match_options, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForMatchingFirstEmail'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling waitForMatchingFirstEmail'
);
}
// verify the required parameter 'match_options' is set
if ($match_options === null || (is_array($match_options) && count($match_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $match_options when calling waitForMatchingFirstEmail'
);
}
$resourcePath = '/waitForMatchingFirstEmail';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$delay,
'delay', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($match_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($match_options));
} else {
$httpBody = $match_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForNthEmail
*
* Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.
*
* @param string $inbox_id Id of the inbox you are fetching emails from (optional)
* @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0)
* @param int $timeout Max milliseconds to wait for the nth email if not already present (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Email
*/
public function waitForNthEmail($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0])
{
list($response) = $this->waitForNthEmailWithHttpInfo($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType);
return $response;
}
/**
* Operation waitForNthEmailWithHttpInfo
*
* Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.
*
* @param string $inbox_id Id of the inbox you are fetching emails from (optional)
* @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0)
* @param int $timeout Max milliseconds to wait for the nth email if not already present (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings)
*/
public function waitForNthEmailWithHttpInfo($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0])
{
$request = $this->waitForNthEmailRequest($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Email' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Email' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Email';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Email',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForNthEmailAsync
*
* Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.
*
* @param string $inbox_id Id of the inbox you are fetching emails from (optional)
* @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0)
* @param int $timeout Max milliseconds to wait for the nth email if not already present (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForNthEmailAsync($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0])
{
return $this->waitForNthEmailAsyncWithHttpInfo($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForNthEmailAsyncWithHttpInfo
*
* Wait for or fetch the email with a given index in the inbox specified. If index doesn't exist waits for it to exist or timeout to occur.
*
* @param string $inbox_id Id of the inbox you are fetching emails from (optional)
* @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0)
* @param int $timeout Max milliseconds to wait for the nth email if not already present (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForNthEmailAsyncWithHttpInfo($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0])
{
$returnType = '\MailSlurp\Models\Email';
$request = $this->waitForNthEmailRequest($inbox_id, $index, $timeout, $unread_only, $since, $before, $sort, $delay, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForNthEmail'
*
* @param string $inbox_id Id of the inbox you are fetching emails from (optional)
* @param int $index Zero based index of the email to wait for. If an inbox has 1 email already and you want to wait for the 2nd email pass index=1 (optional, default to 0)
* @param int $timeout Max milliseconds to wait for the nth email if not already present (optional)
* @param bool $unread_only Optional filter for unread only (optional, default to false)
* @param \DateTime $since Filter for emails that were received after the given timestamp (optional)
* @param \DateTime $before Filter for emails that were received before the given timestamp (optional)
* @param string $sort Sort direction (optional)
* @param int $delay Max milliseconds delay between calls (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForNthEmailRequest($inbox_id = null, $index = 0, $timeout = null, $unread_only = false, $since = null, $before = null, $sort = null, $delay = null, string $contentType = self::contentTypes['waitForNthEmail'][0])
{
if ($index !== null && $index > 2147483647) {
throw new \InvalidArgumentException('invalid value for "$index" when calling WaitForControllerApi.waitForNthEmail, must be smaller than or equal to 2147483647.');
}
if ($index !== null && $index < 0) {
throw new \InvalidArgumentException('invalid value for "$index" when calling WaitForControllerApi.waitForNthEmail, must be bigger than or equal to 0.');
}
$resourcePath = '/waitForNthEmail';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$index,
'index', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$delay,
'delay', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForSms
*
* Wait for an SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions wait_for_sms_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SmsPreview[]
*/
public function waitForSms($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0])
{
list($response) = $this->waitForSmsWithHttpInfo($wait_for_sms_conditions, $contentType);
return $response;
}
/**
* Operation waitForSmsWithHttpInfo
*
* Wait for an SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SmsPreview[], HTTP status code, HTTP response headers (array of strings)
*/
public function waitForSmsWithHttpInfo($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0])
{
$request = $this->waitForSmsRequest($wait_for_sms_conditions, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SmsPreview[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SmsPreview[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SmsPreview[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SmsPreview[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SmsPreview[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForSmsAsync
*
* Wait for an SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForSmsAsync($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0])
{
return $this->waitForSmsAsyncWithHttpInfo($wait_for_sms_conditions, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForSmsAsyncWithHttpInfo
*
* Wait for an SMS message to match the provided filter conditions such as body contains keyword.
*
* @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForSmsAsyncWithHttpInfo($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0])
{
$returnType = '\MailSlurp\Models\SmsPreview[]';
$request = $this->waitForSmsRequest($wait_for_sms_conditions, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForSms'
*
* @param \MailSlurp\Models\WaitForSmsConditions $wait_for_sms_conditions (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForSmsRequest($wait_for_sms_conditions, string $contentType = self::contentTypes['waitForSms'][0])
{
// verify the required parameter 'wait_for_sms_conditions' is set
if ($wait_for_sms_conditions === null || (is_array($wait_for_sms_conditions) && count($wait_for_sms_conditions) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $wait_for_sms_conditions when calling waitForSms'
);
}
$resourcePath = '/waitForSms';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($wait_for_sms_conditions)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($wait_for_sms_conditions));
} else {
$httpBody = $wait_for_sms_conditions;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* UserControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* UserControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class UserControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'getJsonPropertyAsString' => [
'application/json',
],
'getUserInfo' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getJsonPropertyAsString
*
* @param string $property JSON property name or dot separated path selector such as `a.b.c` (required)
* @param object $body body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function getJsonPropertyAsString($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0])
{
list($response) = $this->getJsonPropertyAsStringWithHttpInfo($property, $body, $contentType);
return $response;
}
/**
* Operation getJsonPropertyAsStringWithHttpInfo
*
* @param string $property JSON property name or dot separated path selector such as `a.b.c` (required)
* @param object $body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function getJsonPropertyAsStringWithHttpInfo($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0])
{
$request = $this->getJsonPropertyAsStringRequest($property, $body, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getJsonPropertyAsStringAsync
*
* @param string $property JSON property name or dot separated path selector such as `a.b.c` (required)
* @param object $body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getJsonPropertyAsStringAsync($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0])
{
return $this->getJsonPropertyAsStringAsyncWithHttpInfo($property, $body, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getJsonPropertyAsStringAsyncWithHttpInfo
*
* @param string $property JSON property name or dot separated path selector such as `a.b.c` (required)
* @param object $body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getJsonPropertyAsStringAsyncWithHttpInfo($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0])
{
$returnType = 'string';
$request = $this->getJsonPropertyAsStringRequest($property, $body, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getJsonPropertyAsString'
*
* @param string $property JSON property name or dot separated path selector such as `a.b.c` (required)
* @param object $body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getJsonPropertyAsString'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getJsonPropertyAsStringRequest($property, $body, string $contentType = self::contentTypes['getJsonPropertyAsString'][0])
{
// verify the required parameter 'property' is set
if ($property === null || (is_array($property) && count($property) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $property when calling getJsonPropertyAsString'
);
}
// verify the required parameter 'body' is set
if ($body === null || (is_array($body) && count($body) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $body when calling getJsonPropertyAsString'
);
}
$resourcePath = '/user/json/pluck';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$property,
'property', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($body)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($body));
} else {
$httpBody = $body;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getUserInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\UserInfoDto
*/
public function getUserInfo(string $contentType = self::contentTypes['getUserInfo'][0])
{
list($response) = $this->getUserInfoWithHttpInfo($contentType);
return $response;
}
/**
* Operation getUserInfoWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\UserInfoDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getUserInfoWithHttpInfo(string $contentType = self::contentTypes['getUserInfo'][0])
{
$request = $this->getUserInfoRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\UserInfoDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\UserInfoDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\UserInfoDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\UserInfoDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\UserInfoDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getUserInfoAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getUserInfoAsync(string $contentType = self::contentTypes['getUserInfo'][0])
{
return $this->getUserInfoAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getUserInfoAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getUserInfoAsyncWithHttpInfo(string $contentType = self::contentTypes['getUserInfo'][0])
{
$returnType = '\MailSlurp\Models\UserInfoDto';
$request = $this->getUserInfoRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getUserInfo'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserInfo'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getUserInfoRequest(string $contentType = self::contentTypes['getUserInfo'][0])
{
$resourcePath = '/user/info';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* TrackingControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* TrackingControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class TrackingControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createTrackingPixel' => [
'application/json',
],
'getAllTrackingPixels' => [
'application/json',
],
'getTrackingPixel' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createTrackingPixel
*
* Create tracking pixel
*
* @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options create_tracking_pixel_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TrackingPixelDto
*/
public function createTrackingPixel($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0])
{
list($response) = $this->createTrackingPixelWithHttpInfo($create_tracking_pixel_options, $contentType);
return $response;
}
/**
* Operation createTrackingPixelWithHttpInfo
*
* Create tracking pixel
*
* @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TrackingPixelDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createTrackingPixelWithHttpInfo($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0])
{
$request = $this->createTrackingPixelRequest($create_tracking_pixel_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\TrackingPixelDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TrackingPixelDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TrackingPixelDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TrackingPixelDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TrackingPixelDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createTrackingPixelAsync
*
* Create tracking pixel
*
* @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createTrackingPixelAsync($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0])
{
return $this->createTrackingPixelAsyncWithHttpInfo($create_tracking_pixel_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createTrackingPixelAsyncWithHttpInfo
*
* Create tracking pixel
*
* @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createTrackingPixelAsyncWithHttpInfo($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0])
{
$returnType = '\MailSlurp\Models\TrackingPixelDto';
$request = $this->createTrackingPixelRequest($create_tracking_pixel_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createTrackingPixel'
*
* @param \MailSlurp\Models\CreateTrackingPixelOptions $create_tracking_pixel_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTrackingPixel'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createTrackingPixelRequest($create_tracking_pixel_options, string $contentType = self::contentTypes['createTrackingPixel'][0])
{
// verify the required parameter 'create_tracking_pixel_options' is set
if ($create_tracking_pixel_options === null || (is_array($create_tracking_pixel_options) && count($create_tracking_pixel_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_tracking_pixel_options when calling createTrackingPixel'
);
}
$resourcePath = '/tracking/pixels';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_tracking_pixel_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_tracking_pixel_options));
} else {
$httpBody = $create_tracking_pixel_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllTrackingPixels
*
* Get tracking pixels
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageTrackingPixelProjection
*/
public function getAllTrackingPixels($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0])
{
list($response) = $this->getAllTrackingPixelsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getAllTrackingPixelsWithHttpInfo
*
* Get tracking pixels
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllTrackingPixelsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0])
{
$request = $this->getAllTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageTrackingPixelProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllTrackingPixelsAsync
*
* Get tracking pixels
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllTrackingPixelsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0])
{
return $this->getAllTrackingPixelsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllTrackingPixelsAsyncWithHttpInfo
*
* Get tracking pixels
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllTrackingPixelsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0])
{
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
$request = $this->getAllTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllTrackingPixels'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllTrackingPixelsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllTrackingPixels'][0])
{
$resourcePath = '/tracking/pixels';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTrackingPixel
*
* Get pixel
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TrackingPixelDto
*/
public function getTrackingPixel($id, string $contentType = self::contentTypes['getTrackingPixel'][0])
{
list($response) = $this->getTrackingPixelWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getTrackingPixelWithHttpInfo
*
* Get pixel
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TrackingPixelDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getTrackingPixelWithHttpInfo($id, string $contentType = self::contentTypes['getTrackingPixel'][0])
{
$request = $this->getTrackingPixelRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\TrackingPixelDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TrackingPixelDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TrackingPixelDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TrackingPixelDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TrackingPixelDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTrackingPixelAsync
*
* Get pixel
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTrackingPixelAsync($id, string $contentType = self::contentTypes['getTrackingPixel'][0])
{
return $this->getTrackingPixelAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTrackingPixelAsyncWithHttpInfo
*
* Get pixel
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTrackingPixelAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getTrackingPixel'][0])
{
$returnType = '\MailSlurp\Models\TrackingPixelDto';
$request = $this->getTrackingPixelRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTrackingPixel'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTrackingPixel'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTrackingPixelRequest($id, string $contentType = self::contentTypes['getTrackingPixel'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getTrackingPixel'
);
}
$resourcePath = '/tracking/pixels/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* ToolsControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* ToolsControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ToolsControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'checkEmailFeaturesClientSupport' => [
'application/json',
],
'createNewFakeEmailAddress' => [
'application/json',
],
'generateBimiRecord' => [
'application/json',
],
'generateDmarcRecord' => [
'application/json',
],
'generateMtaStsRecord' => [
'application/json',
],
'generateTlsReportingRecord' => [
'application/json',
],
'getFakeEmailById' => [
'application/json',
],
'getFakeEmailsForAddress' => [
'application/json',
],
'lookupBimiDomain' => [
'application/json',
],
'lookupDmarcDomain' => [
'application/json',
],
'lookupMtaStsDomain' => [
'application/json',
],
'lookupTlsReportingDomain' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation checkEmailFeaturesClientSupport
*
* Check email client support for email HTML and CSS features
*
* @param \MailSlurp\Models\CheckEmailFeaturesClientSupportOptions $check_email_features_client_support_options check_email_features_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailFeaturesClientSupport'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CheckEmailFeaturesClientSupportResults
*/
public function checkEmailFeaturesClientSupport($check_email_features_client_support_options, string $contentType = self::contentTypes['checkEmailFeaturesClientSupport'][0])
{
list($response) = $this->checkEmailFeaturesClientSupportWithHttpInfo($check_email_features_client_support_options, $contentType);
return $response;
}
/**
* Operation checkEmailFeaturesClientSupportWithHttpInfo
*
* Check email client support for email HTML and CSS features
*
* @param \MailSlurp\Models\CheckEmailFeaturesClientSupportOptions $check_email_features_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailFeaturesClientSupport'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CheckEmailFeaturesClientSupportResults, HTTP status code, HTTP response headers (array of strings)
*/
public function checkEmailFeaturesClientSupportWithHttpInfo($check_email_features_client_support_options, string $contentType = self::contentTypes['checkEmailFeaturesClientSupport'][0])
{
$request = $this->checkEmailFeaturesClientSupportRequest($check_email_features_client_support_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CheckEmailFeaturesClientSupportResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CheckEmailFeaturesClientSupportResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CheckEmailFeaturesClientSupportResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CheckEmailFeaturesClientSupportResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CheckEmailFeaturesClientSupportResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation checkEmailFeaturesClientSupportAsync
*
* Check email client support for email HTML and CSS features
*
* @param \MailSlurp\Models\CheckEmailFeaturesClientSupportOptions $check_email_features_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailFeaturesClientSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailFeaturesClientSupportAsync($check_email_features_client_support_options, string $contentType = self::contentTypes['checkEmailFeaturesClientSupport'][0])
{
return $this->checkEmailFeaturesClientSupportAsyncWithHttpInfo($check_email_features_client_support_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation checkEmailFeaturesClientSupportAsyncWithHttpInfo
*
* Check email client support for email HTML and CSS features
*
* @param \MailSlurp\Models\CheckEmailFeaturesClientSupportOptions $check_email_features_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailFeaturesClientSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailFeaturesClientSupportAsyncWithHttpInfo($check_email_features_client_support_options, string $contentType = self::contentTypes['checkEmailFeaturesClientSupport'][0])
{
$returnType = '\MailSlurp\Models\CheckEmailFeaturesClientSupportResults';
$request = $this->checkEmailFeaturesClientSupportRequest($check_email_features_client_support_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'checkEmailFeaturesClientSupport'
*
* @param \MailSlurp\Models\CheckEmailFeaturesClientSupportOptions $check_email_features_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailFeaturesClientSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function checkEmailFeaturesClientSupportRequest($check_email_features_client_support_options, string $contentType = self::contentTypes['checkEmailFeaturesClientSupport'][0])
{
// verify the required parameter 'check_email_features_client_support_options' is set
if ($check_email_features_client_support_options === null || (is_array($check_email_features_client_support_options) && count($check_email_features_client_support_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $check_email_features_client_support_options when calling checkEmailFeaturesClientSupport'
);
}
$resourcePath = '/tools/check-email-features-client-support';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($check_email_features_client_support_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($check_email_features_client_support_options));
} else {
$httpBody = $check_email_features_client_support_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createNewFakeEmailAddress
*
* Create a new email address using the fake email domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewFakeEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\NewFakeEmailAddressResult
*/
public function createNewFakeEmailAddress(string $contentType = self::contentTypes['createNewFakeEmailAddress'][0])
{
list($response) = $this->createNewFakeEmailAddressWithHttpInfo($contentType);
return $response;
}
/**
* Operation createNewFakeEmailAddressWithHttpInfo
*
* Create a new email address using the fake email domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewFakeEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\NewFakeEmailAddressResult, HTTP status code, HTTP response headers (array of strings)
*/
public function createNewFakeEmailAddressWithHttpInfo(string $contentType = self::contentTypes['createNewFakeEmailAddress'][0])
{
$request = $this->createNewFakeEmailAddressRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\NewFakeEmailAddressResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\NewFakeEmailAddressResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\NewFakeEmailAddressResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\NewFakeEmailAddressResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\NewFakeEmailAddressResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createNewFakeEmailAddressAsync
*
* Create a new email address using the fake email domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewFakeEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewFakeEmailAddressAsync(string $contentType = self::contentTypes['createNewFakeEmailAddress'][0])
{
return $this->createNewFakeEmailAddressAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createNewFakeEmailAddressAsyncWithHttpInfo
*
* Create a new email address using the fake email domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewFakeEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewFakeEmailAddressAsyncWithHttpInfo(string $contentType = self::contentTypes['createNewFakeEmailAddress'][0])
{
$returnType = '\MailSlurp\Models\NewFakeEmailAddressResult';
$request = $this->createNewFakeEmailAddressRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createNewFakeEmailAddress'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewFakeEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createNewFakeEmailAddressRequest(string $contentType = self::contentTypes['createNewFakeEmailAddress'][0])
{
$resourcePath = '/tools/fake-email';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation generateBimiRecord
*
* Create a BIMI record policy
*
* @param \MailSlurp\Models\GenerateBimiRecordOptions $generate_bimi_record_options generate_bimi_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateBimiRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GenerateBimiRecordResults
*/
public function generateBimiRecord($generate_bimi_record_options, string $contentType = self::contentTypes['generateBimiRecord'][0])
{
list($response) = $this->generateBimiRecordWithHttpInfo($generate_bimi_record_options, $contentType);
return $response;
}
/**
* Operation generateBimiRecordWithHttpInfo
*
* Create a BIMI record policy
*
* @param \MailSlurp\Models\GenerateBimiRecordOptions $generate_bimi_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateBimiRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GenerateBimiRecordResults, HTTP status code, HTTP response headers (array of strings)
*/
public function generateBimiRecordWithHttpInfo($generate_bimi_record_options, string $contentType = self::contentTypes['generateBimiRecord'][0])
{
$request = $this->generateBimiRecordRequest($generate_bimi_record_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GenerateBimiRecordResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GenerateBimiRecordResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GenerateBimiRecordResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GenerateBimiRecordResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GenerateBimiRecordResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation generateBimiRecordAsync
*
* Create a BIMI record policy
*
* @param \MailSlurp\Models\GenerateBimiRecordOptions $generate_bimi_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateBimiRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateBimiRecordAsync($generate_bimi_record_options, string $contentType = self::contentTypes['generateBimiRecord'][0])
{
return $this->generateBimiRecordAsyncWithHttpInfo($generate_bimi_record_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation generateBimiRecordAsyncWithHttpInfo
*
* Create a BIMI record policy
*
* @param \MailSlurp\Models\GenerateBimiRecordOptions $generate_bimi_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateBimiRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateBimiRecordAsyncWithHttpInfo($generate_bimi_record_options, string $contentType = self::contentTypes['generateBimiRecord'][0])
{
$returnType = '\MailSlurp\Models\GenerateBimiRecordResults';
$request = $this->generateBimiRecordRequest($generate_bimi_record_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'generateBimiRecord'
*
* @param \MailSlurp\Models\GenerateBimiRecordOptions $generate_bimi_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateBimiRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function generateBimiRecordRequest($generate_bimi_record_options, string $contentType = self::contentTypes['generateBimiRecord'][0])
{
// verify the required parameter 'generate_bimi_record_options' is set
if ($generate_bimi_record_options === null || (is_array($generate_bimi_record_options) && count($generate_bimi_record_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $generate_bimi_record_options when calling generateBimiRecord'
);
}
$resourcePath = '/tools/generate-bimi-record';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($generate_bimi_record_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($generate_bimi_record_options));
} else {
$httpBody = $generate_bimi_record_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation generateDmarcRecord
*
* Create a DMARC record policy
*
* @param \MailSlurp\Models\GenerateDmarcRecordOptions $generate_dmarc_record_options generate_dmarc_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateDmarcRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GenerateDmarcRecordResults
*/
public function generateDmarcRecord($generate_dmarc_record_options, string $contentType = self::contentTypes['generateDmarcRecord'][0])
{
list($response) = $this->generateDmarcRecordWithHttpInfo($generate_dmarc_record_options, $contentType);
return $response;
}
/**
* Operation generateDmarcRecordWithHttpInfo
*
* Create a DMARC record policy
*
* @param \MailSlurp\Models\GenerateDmarcRecordOptions $generate_dmarc_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateDmarcRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GenerateDmarcRecordResults, HTTP status code, HTTP response headers (array of strings)
*/
public function generateDmarcRecordWithHttpInfo($generate_dmarc_record_options, string $contentType = self::contentTypes['generateDmarcRecord'][0])
{
$request = $this->generateDmarcRecordRequest($generate_dmarc_record_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GenerateDmarcRecordResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GenerateDmarcRecordResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GenerateDmarcRecordResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GenerateDmarcRecordResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GenerateDmarcRecordResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation generateDmarcRecordAsync
*
* Create a DMARC record policy
*
* @param \MailSlurp\Models\GenerateDmarcRecordOptions $generate_dmarc_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateDmarcRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateDmarcRecordAsync($generate_dmarc_record_options, string $contentType = self::contentTypes['generateDmarcRecord'][0])
{
return $this->generateDmarcRecordAsyncWithHttpInfo($generate_dmarc_record_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation generateDmarcRecordAsyncWithHttpInfo
*
* Create a DMARC record policy
*
* @param \MailSlurp\Models\GenerateDmarcRecordOptions $generate_dmarc_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateDmarcRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateDmarcRecordAsyncWithHttpInfo($generate_dmarc_record_options, string $contentType = self::contentTypes['generateDmarcRecord'][0])
{
$returnType = '\MailSlurp\Models\GenerateDmarcRecordResults';
$request = $this->generateDmarcRecordRequest($generate_dmarc_record_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'generateDmarcRecord'
*
* @param \MailSlurp\Models\GenerateDmarcRecordOptions $generate_dmarc_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateDmarcRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function generateDmarcRecordRequest($generate_dmarc_record_options, string $contentType = self::contentTypes['generateDmarcRecord'][0])
{
// verify the required parameter 'generate_dmarc_record_options' is set
if ($generate_dmarc_record_options === null || (is_array($generate_dmarc_record_options) && count($generate_dmarc_record_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $generate_dmarc_record_options when calling generateDmarcRecord'
);
}
$resourcePath = '/tools/generate-dmarc-record';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($generate_dmarc_record_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($generate_dmarc_record_options));
} else {
$httpBody = $generate_dmarc_record_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation generateMtaStsRecord
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateMtaStsRecordOptions $generate_mta_sts_record_options generate_mta_sts_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMtaStsRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GenerateMtaStsRecordResults
*/
public function generateMtaStsRecord($generate_mta_sts_record_options, string $contentType = self::contentTypes['generateMtaStsRecord'][0])
{
list($response) = $this->generateMtaStsRecordWithHttpInfo($generate_mta_sts_record_options, $contentType);
return $response;
}
/**
* Operation generateMtaStsRecordWithHttpInfo
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateMtaStsRecordOptions $generate_mta_sts_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMtaStsRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GenerateMtaStsRecordResults, HTTP status code, HTTP response headers (array of strings)
*/
public function generateMtaStsRecordWithHttpInfo($generate_mta_sts_record_options, string $contentType = self::contentTypes['generateMtaStsRecord'][0])
{
$request = $this->generateMtaStsRecordRequest($generate_mta_sts_record_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GenerateMtaStsRecordResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GenerateMtaStsRecordResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GenerateMtaStsRecordResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GenerateMtaStsRecordResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GenerateMtaStsRecordResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation generateMtaStsRecordAsync
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateMtaStsRecordOptions $generate_mta_sts_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMtaStsRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateMtaStsRecordAsync($generate_mta_sts_record_options, string $contentType = self::contentTypes['generateMtaStsRecord'][0])
{
return $this->generateMtaStsRecordAsyncWithHttpInfo($generate_mta_sts_record_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation generateMtaStsRecordAsyncWithHttpInfo
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateMtaStsRecordOptions $generate_mta_sts_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMtaStsRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateMtaStsRecordAsyncWithHttpInfo($generate_mta_sts_record_options, string $contentType = self::contentTypes['generateMtaStsRecord'][0])
{
$returnType = '\MailSlurp\Models\GenerateMtaStsRecordResults';
$request = $this->generateMtaStsRecordRequest($generate_mta_sts_record_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'generateMtaStsRecord'
*
* @param \MailSlurp\Models\GenerateMtaStsRecordOptions $generate_mta_sts_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMtaStsRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function generateMtaStsRecordRequest($generate_mta_sts_record_options, string $contentType = self::contentTypes['generateMtaStsRecord'][0])
{
// verify the required parameter 'generate_mta_sts_record_options' is set
if ($generate_mta_sts_record_options === null || (is_array($generate_mta_sts_record_options) && count($generate_mta_sts_record_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $generate_mta_sts_record_options when calling generateMtaStsRecord'
);
}
$resourcePath = '/tools/generate-mta-sts-record';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($generate_mta_sts_record_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($generate_mta_sts_record_options));
} else {
$httpBody = $generate_mta_sts_record_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation generateTlsReportingRecord
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateTlsReportingRecordOptions $generate_tls_reporting_record_options generate_tls_reporting_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateTlsReportingRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GenerateTlsReportingRecordResults
*/
public function generateTlsReportingRecord($generate_tls_reporting_record_options, string $contentType = self::contentTypes['generateTlsReportingRecord'][0])
{
list($response) = $this->generateTlsReportingRecordWithHttpInfo($generate_tls_reporting_record_options, $contentType);
return $response;
}
/**
* Operation generateTlsReportingRecordWithHttpInfo
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateTlsReportingRecordOptions $generate_tls_reporting_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateTlsReportingRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GenerateTlsReportingRecordResults, HTTP status code, HTTP response headers (array of strings)
*/
public function generateTlsReportingRecordWithHttpInfo($generate_tls_reporting_record_options, string $contentType = self::contentTypes['generateTlsReportingRecord'][0])
{
$request = $this->generateTlsReportingRecordRequest($generate_tls_reporting_record_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GenerateTlsReportingRecordResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GenerateTlsReportingRecordResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GenerateTlsReportingRecordResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GenerateTlsReportingRecordResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GenerateTlsReportingRecordResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation generateTlsReportingRecordAsync
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateTlsReportingRecordOptions $generate_tls_reporting_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateTlsReportingRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateTlsReportingRecordAsync($generate_tls_reporting_record_options, string $contentType = self::contentTypes['generateTlsReportingRecord'][0])
{
return $this->generateTlsReportingRecordAsyncWithHttpInfo($generate_tls_reporting_record_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation generateTlsReportingRecordAsyncWithHttpInfo
*
* Create a TLS reporting record policy
*
* @param \MailSlurp\Models\GenerateTlsReportingRecordOptions $generate_tls_reporting_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateTlsReportingRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function generateTlsReportingRecordAsyncWithHttpInfo($generate_tls_reporting_record_options, string $contentType = self::contentTypes['generateTlsReportingRecord'][0])
{
$returnType = '\MailSlurp\Models\GenerateTlsReportingRecordResults';
$request = $this->generateTlsReportingRecordRequest($generate_tls_reporting_record_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'generateTlsReportingRecord'
*
* @param \MailSlurp\Models\GenerateTlsReportingRecordOptions $generate_tls_reporting_record_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateTlsReportingRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function generateTlsReportingRecordRequest($generate_tls_reporting_record_options, string $contentType = self::contentTypes['generateTlsReportingRecord'][0])
{
// verify the required parameter 'generate_tls_reporting_record_options' is set
if ($generate_tls_reporting_record_options === null || (is_array($generate_tls_reporting_record_options) && count($generate_tls_reporting_record_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $generate_tls_reporting_record_options when calling generateTlsReportingRecord'
);
}
$resourcePath = '/tools/generate-tls-reporting-record';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($generate_tls_reporting_record_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($generate_tls_reporting_record_options));
} else {
$httpBody = $generate_tls_reporting_record_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getFakeEmailById
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailById'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\FakeEmailResult
*/
public function getFakeEmailById($id, string $contentType = self::contentTypes['getFakeEmailById'][0])
{
list($response) = $this->getFakeEmailByIdWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getFakeEmailByIdWithHttpInfo
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailById'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\FakeEmailResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getFakeEmailByIdWithHttpInfo($id, string $contentType = self::contentTypes['getFakeEmailById'][0])
{
$request = $this->getFakeEmailByIdRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\FakeEmailResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\FakeEmailResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\FakeEmailResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\FakeEmailResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\FakeEmailResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getFakeEmailByIdAsync
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFakeEmailByIdAsync($id, string $contentType = self::contentTypes['getFakeEmailById'][0])
{
return $this->getFakeEmailByIdAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFakeEmailByIdAsyncWithHttpInfo
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFakeEmailByIdAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getFakeEmailById'][0])
{
$returnType = '\MailSlurp\Models\FakeEmailResult';
$request = $this->getFakeEmailByIdRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getFakeEmailById'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getFakeEmailByIdRequest($id, string $contentType = self::contentTypes['getFakeEmailById'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getFakeEmailById'
);
}
$resourcePath = '/tools/fake-email';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$id,
'id', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getFakeEmailsForAddress
*
* @param string $email_address email_address (required)
* @param int $page page (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailsForAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\FakeEmailPreview[]
*/
public function getFakeEmailsForAddress($email_address, $page = null, string $contentType = self::contentTypes['getFakeEmailsForAddress'][0])
{
list($response) = $this->getFakeEmailsForAddressWithHttpInfo($email_address, $page, $contentType);
return $response;
}
/**
* Operation getFakeEmailsForAddressWithHttpInfo
*
* @param string $email_address (required)
* @param int $page (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailsForAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\FakeEmailPreview[], HTTP status code, HTTP response headers (array of strings)
*/
public function getFakeEmailsForAddressWithHttpInfo($email_address, $page = null, string $contentType = self::contentTypes['getFakeEmailsForAddress'][0])
{
$request = $this->getFakeEmailsForAddressRequest($email_address, $page, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\FakeEmailPreview[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\FakeEmailPreview[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\FakeEmailPreview[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\FakeEmailPreview[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\FakeEmailPreview[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getFakeEmailsForAddressAsync
*
* @param string $email_address (required)
* @param int $page (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailsForAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFakeEmailsForAddressAsync($email_address, $page = null, string $contentType = self::contentTypes['getFakeEmailsForAddress'][0])
{
return $this->getFakeEmailsForAddressAsyncWithHttpInfo($email_address, $page, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFakeEmailsForAddressAsyncWithHttpInfo
*
* @param string $email_address (required)
* @param int $page (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailsForAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFakeEmailsForAddressAsyncWithHttpInfo($email_address, $page = null, string $contentType = self::contentTypes['getFakeEmailsForAddress'][0])
{
$returnType = '\MailSlurp\Models\FakeEmailPreview[]';
$request = $this->getFakeEmailsForAddressRequest($email_address, $page, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getFakeEmailsForAddress'
*
* @param string $email_address (required)
* @param int $page (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getFakeEmailsForAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getFakeEmailsForAddressRequest($email_address, $page = null, string $contentType = self::contentTypes['getFakeEmailsForAddress'][0])
{
// verify the required parameter 'email_address' is set
if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_address when calling getFakeEmailsForAddress'
);
}
$resourcePath = '/tools/fake-emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation lookupBimiDomain
*
* Lookup a BIMI record policy
*
* @param \MailSlurp\Models\LookupBimiDomainOptions $lookup_bimi_domain_options lookup_bimi_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupBimiDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\LookupBimiDomainResults
*/
public function lookupBimiDomain($lookup_bimi_domain_options, string $contentType = self::contentTypes['lookupBimiDomain'][0])
{
list($response) = $this->lookupBimiDomainWithHttpInfo($lookup_bimi_domain_options, $contentType);
return $response;
}
/**
* Operation lookupBimiDomainWithHttpInfo
*
* Lookup a BIMI record policy
*
* @param \MailSlurp\Models\LookupBimiDomainOptions $lookup_bimi_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupBimiDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\LookupBimiDomainResults, HTTP status code, HTTP response headers (array of strings)
*/
public function lookupBimiDomainWithHttpInfo($lookup_bimi_domain_options, string $contentType = self::contentTypes['lookupBimiDomain'][0])
{
$request = $this->lookupBimiDomainRequest($lookup_bimi_domain_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\LookupBimiDomainResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\LookupBimiDomainResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\LookupBimiDomainResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\LookupBimiDomainResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\LookupBimiDomainResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation lookupBimiDomainAsync
*
* Lookup a BIMI record policy
*
* @param \MailSlurp\Models\LookupBimiDomainOptions $lookup_bimi_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupBimiDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupBimiDomainAsync($lookup_bimi_domain_options, string $contentType = self::contentTypes['lookupBimiDomain'][0])
{
return $this->lookupBimiDomainAsyncWithHttpInfo($lookup_bimi_domain_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation lookupBimiDomainAsyncWithHttpInfo
*
* Lookup a BIMI record policy
*
* @param \MailSlurp\Models\LookupBimiDomainOptions $lookup_bimi_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupBimiDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupBimiDomainAsyncWithHttpInfo($lookup_bimi_domain_options, string $contentType = self::contentTypes['lookupBimiDomain'][0])
{
$returnType = '\MailSlurp\Models\LookupBimiDomainResults';
$request = $this->lookupBimiDomainRequest($lookup_bimi_domain_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'lookupBimiDomain'
*
* @param \MailSlurp\Models\LookupBimiDomainOptions $lookup_bimi_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupBimiDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function lookupBimiDomainRequest($lookup_bimi_domain_options, string $contentType = self::contentTypes['lookupBimiDomain'][0])
{
// verify the required parameter 'lookup_bimi_domain_options' is set
if ($lookup_bimi_domain_options === null || (is_array($lookup_bimi_domain_options) && count($lookup_bimi_domain_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $lookup_bimi_domain_options when calling lookupBimiDomain'
);
}
$resourcePath = '/tools/lookup-bimi-domain';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($lookup_bimi_domain_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($lookup_bimi_domain_options));
} else {
$httpBody = $lookup_bimi_domain_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation lookupDmarcDomain
*
* Lookup a DMARC record policy
*
* @param \MailSlurp\Models\LookupDmarcDomainOptions $lookup_dmarc_domain_options lookup_dmarc_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDmarcDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\LookupDmarcDomainResults
*/
public function lookupDmarcDomain($lookup_dmarc_domain_options, string $contentType = self::contentTypes['lookupDmarcDomain'][0])
{
list($response) = $this->lookupDmarcDomainWithHttpInfo($lookup_dmarc_domain_options, $contentType);
return $response;
}
/**
* Operation lookupDmarcDomainWithHttpInfo
*
* Lookup a DMARC record policy
*
* @param \MailSlurp\Models\LookupDmarcDomainOptions $lookup_dmarc_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDmarcDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\LookupDmarcDomainResults, HTTP status code, HTTP response headers (array of strings)
*/
public function lookupDmarcDomainWithHttpInfo($lookup_dmarc_domain_options, string $contentType = self::contentTypes['lookupDmarcDomain'][0])
{
$request = $this->lookupDmarcDomainRequest($lookup_dmarc_domain_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\LookupDmarcDomainResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\LookupDmarcDomainResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\LookupDmarcDomainResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\LookupDmarcDomainResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\LookupDmarcDomainResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation lookupDmarcDomainAsync
*
* Lookup a DMARC record policy
*
* @param \MailSlurp\Models\LookupDmarcDomainOptions $lookup_dmarc_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDmarcDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupDmarcDomainAsync($lookup_dmarc_domain_options, string $contentType = self::contentTypes['lookupDmarcDomain'][0])
{
return $this->lookupDmarcDomainAsyncWithHttpInfo($lookup_dmarc_domain_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation lookupDmarcDomainAsyncWithHttpInfo
*
* Lookup a DMARC record policy
*
* @param \MailSlurp\Models\LookupDmarcDomainOptions $lookup_dmarc_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDmarcDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupDmarcDomainAsyncWithHttpInfo($lookup_dmarc_domain_options, string $contentType = self::contentTypes['lookupDmarcDomain'][0])
{
$returnType = '\MailSlurp\Models\LookupDmarcDomainResults';
$request = $this->lookupDmarcDomainRequest($lookup_dmarc_domain_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'lookupDmarcDomain'
*
* @param \MailSlurp\Models\LookupDmarcDomainOptions $lookup_dmarc_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupDmarcDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function lookupDmarcDomainRequest($lookup_dmarc_domain_options, string $contentType = self::contentTypes['lookupDmarcDomain'][0])
{
// verify the required parameter 'lookup_dmarc_domain_options' is set
if ($lookup_dmarc_domain_options === null || (is_array($lookup_dmarc_domain_options) && count($lookup_dmarc_domain_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $lookup_dmarc_domain_options when calling lookupDmarcDomain'
);
}
$resourcePath = '/tools/lookup-dmarc-domain';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($lookup_dmarc_domain_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($lookup_dmarc_domain_options));
} else {
$httpBody = $lookup_dmarc_domain_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation lookupMtaStsDomain
*
* Lookup a MTA-STS domain policy
*
* @param \MailSlurp\Models\LookupMtaStsDomainOptions $lookup_mta_sts_domain_options lookup_mta_sts_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupMtaStsDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\LookupMtaStsDomainResults
*/
public function lookupMtaStsDomain($lookup_mta_sts_domain_options, string $contentType = self::contentTypes['lookupMtaStsDomain'][0])
{
list($response) = $this->lookupMtaStsDomainWithHttpInfo($lookup_mta_sts_domain_options, $contentType);
return $response;
}
/**
* Operation lookupMtaStsDomainWithHttpInfo
*
* Lookup a MTA-STS domain policy
*
* @param \MailSlurp\Models\LookupMtaStsDomainOptions $lookup_mta_sts_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupMtaStsDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\LookupMtaStsDomainResults, HTTP status code, HTTP response headers (array of strings)
*/
public function lookupMtaStsDomainWithHttpInfo($lookup_mta_sts_domain_options, string $contentType = self::contentTypes['lookupMtaStsDomain'][0])
{
$request = $this->lookupMtaStsDomainRequest($lookup_mta_sts_domain_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\LookupMtaStsDomainResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\LookupMtaStsDomainResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\LookupMtaStsDomainResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\LookupMtaStsDomainResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\LookupMtaStsDomainResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation lookupMtaStsDomainAsync
*
* Lookup a MTA-STS domain policy
*
* @param \MailSlurp\Models\LookupMtaStsDomainOptions $lookup_mta_sts_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupMtaStsDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupMtaStsDomainAsync($lookup_mta_sts_domain_options, string $contentType = self::contentTypes['lookupMtaStsDomain'][0])
{
return $this->lookupMtaStsDomainAsyncWithHttpInfo($lookup_mta_sts_domain_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation lookupMtaStsDomainAsyncWithHttpInfo
*
* Lookup a MTA-STS domain policy
*
* @param \MailSlurp\Models\LookupMtaStsDomainOptions $lookup_mta_sts_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupMtaStsDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupMtaStsDomainAsyncWithHttpInfo($lookup_mta_sts_domain_options, string $contentType = self::contentTypes['lookupMtaStsDomain'][0])
{
$returnType = '\MailSlurp\Models\LookupMtaStsDomainResults';
$request = $this->lookupMtaStsDomainRequest($lookup_mta_sts_domain_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'lookupMtaStsDomain'
*
* @param \MailSlurp\Models\LookupMtaStsDomainOptions $lookup_mta_sts_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupMtaStsDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function lookupMtaStsDomainRequest($lookup_mta_sts_domain_options, string $contentType = self::contentTypes['lookupMtaStsDomain'][0])
{
// verify the required parameter 'lookup_mta_sts_domain_options' is set
if ($lookup_mta_sts_domain_options === null || (is_array($lookup_mta_sts_domain_options) && count($lookup_mta_sts_domain_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $lookup_mta_sts_domain_options when calling lookupMtaStsDomain'
);
}
$resourcePath = '/tools/lookup-mta-sts-domain';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($lookup_mta_sts_domain_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($lookup_mta_sts_domain_options));
} else {
$httpBody = $lookup_mta_sts_domain_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation lookupTlsReportingDomain
*
* Lookup a TLS reporting domain policy
*
* @param \MailSlurp\Models\LookupTlsReportingDomainOptions $lookup_tls_reporting_domain_options lookup_tls_reporting_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupTlsReportingDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\LookupTlsReportingDomainResults
*/
public function lookupTlsReportingDomain($lookup_tls_reporting_domain_options, string $contentType = self::contentTypes['lookupTlsReportingDomain'][0])
{
list($response) = $this->lookupTlsReportingDomainWithHttpInfo($lookup_tls_reporting_domain_options, $contentType);
return $response;
}
/**
* Operation lookupTlsReportingDomainWithHttpInfo
*
* Lookup a TLS reporting domain policy
*
* @param \MailSlurp\Models\LookupTlsReportingDomainOptions $lookup_tls_reporting_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupTlsReportingDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\LookupTlsReportingDomainResults, HTTP status code, HTTP response headers (array of strings)
*/
public function lookupTlsReportingDomainWithHttpInfo($lookup_tls_reporting_domain_options, string $contentType = self::contentTypes['lookupTlsReportingDomain'][0])
{
$request = $this->lookupTlsReportingDomainRequest($lookup_tls_reporting_domain_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\LookupTlsReportingDomainResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\LookupTlsReportingDomainResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\LookupTlsReportingDomainResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\LookupTlsReportingDomainResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\LookupTlsReportingDomainResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation lookupTlsReportingDomainAsync
*
* Lookup a TLS reporting domain policy
*
* @param \MailSlurp\Models\LookupTlsReportingDomainOptions $lookup_tls_reporting_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupTlsReportingDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupTlsReportingDomainAsync($lookup_tls_reporting_domain_options, string $contentType = self::contentTypes['lookupTlsReportingDomain'][0])
{
return $this->lookupTlsReportingDomainAsyncWithHttpInfo($lookup_tls_reporting_domain_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation lookupTlsReportingDomainAsyncWithHttpInfo
*
* Lookup a TLS reporting domain policy
*
* @param \MailSlurp\Models\LookupTlsReportingDomainOptions $lookup_tls_reporting_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupTlsReportingDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function lookupTlsReportingDomainAsyncWithHttpInfo($lookup_tls_reporting_domain_options, string $contentType = self::contentTypes['lookupTlsReportingDomain'][0])
{
$returnType = '\MailSlurp\Models\LookupTlsReportingDomainResults';
$request = $this->lookupTlsReportingDomainRequest($lookup_tls_reporting_domain_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'lookupTlsReportingDomain'
*
* @param \MailSlurp\Models\LookupTlsReportingDomainOptions $lookup_tls_reporting_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['lookupTlsReportingDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function lookupTlsReportingDomainRequest($lookup_tls_reporting_domain_options, string $contentType = self::contentTypes['lookupTlsReportingDomain'][0])
{
// verify the required parameter 'lookup_tls_reporting_domain_options' is set
if ($lookup_tls_reporting_domain_options === null || (is_array($lookup_tls_reporting_domain_options) && count($lookup_tls_reporting_domain_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $lookup_tls_reporting_domain_options when calling lookupTlsReportingDomain'
);
}
$resourcePath = '/tools/lookup-tls-reporting-domain';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($lookup_tls_reporting_domain_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($lookup_tls_reporting_domain_options));
} else {
$httpBody = $lookup_tls_reporting_domain_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* TemplateControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* TemplateControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class TemplateControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createTemplate' => [
'application/json',
],
'deleteTemplate' => [
'application/json',
],
'getAllTemplates' => [
'application/json',
],
'getTemplate' => [
'application/json',
],
'getTemplatePreviewHtml' => [
'application/json',
],
'getTemplatePreviewJson' => [
'application/json',
],
'getTemplates' => [
'application/json',
],
'updateTemplate' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createTemplate
*
* Create a Template
*
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TemplateDto
*/
public function createTemplate($create_template_options, string $contentType = self::contentTypes['createTemplate'][0])
{
list($response) = $this->createTemplateWithHttpInfo($create_template_options, $contentType);
return $response;
}
/**
* Operation createTemplateWithHttpInfo
*
* Create a Template
*
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TemplateDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createTemplateWithHttpInfo($create_template_options, string $contentType = self::contentTypes['createTemplate'][0])
{
$request = $this->createTemplateRequest($create_template_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\TemplateDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TemplateDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TemplateDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TemplateDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createTemplateAsync
*
* Create a Template
*
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createTemplateAsync($create_template_options, string $contentType = self::contentTypes['createTemplate'][0])
{
return $this->createTemplateAsyncWithHttpInfo($create_template_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createTemplateAsyncWithHttpInfo
*
* Create a Template
*
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createTemplateAsyncWithHttpInfo($create_template_options, string $contentType = self::contentTypes['createTemplate'][0])
{
$returnType = '\MailSlurp\Models\TemplateDto';
$request = $this->createTemplateRequest($create_template_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createTemplate'
*
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createTemplateRequest($create_template_options, string $contentType = self::contentTypes['createTemplate'][0])
{
// verify the required parameter 'create_template_options' is set
if ($create_template_options === null || (is_array($create_template_options) && count($create_template_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_template_options when calling createTemplate'
);
}
$resourcePath = '/templates';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_template_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_template_options));
} else {
$httpBody = $create_template_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteTemplate
*
* Delete email template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteTemplate($template_id, string $contentType = self::contentTypes['deleteTemplate'][0])
{
$this->deleteTemplateWithHttpInfo($template_id, $contentType);
}
/**
* Operation deleteTemplateWithHttpInfo
*
* Delete email template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteTemplateWithHttpInfo($template_id, string $contentType = self::contentTypes['deleteTemplate'][0])
{
$request = $this->deleteTemplateRequest($template_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteTemplateAsync
*
* Delete email template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteTemplateAsync($template_id, string $contentType = self::contentTypes['deleteTemplate'][0])
{
return $this->deleteTemplateAsyncWithHttpInfo($template_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteTemplateAsyncWithHttpInfo
*
* Delete email template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteTemplateAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['deleteTemplate'][0])
{
$returnType = '';
$request = $this->deleteTemplateRequest($template_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteTemplate'
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteTemplateRequest($template_id, string $contentType = self::contentTypes['deleteTemplate'][0])
{
// verify the required parameter 'template_id' is set
if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $template_id when calling deleteTemplate'
);
}
$resourcePath = '/templates/{templateId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($template_id !== null) {
$resourcePath = str_replace(
'{' . 'templateId' . '}',
ObjectSerializer::toPathValue($template_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllTemplates
*
* List templates
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageTemplateProjection
*/
public function getAllTemplates($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0])
{
list($response) = $this->getAllTemplatesWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getAllTemplatesWithHttpInfo
*
* List templates
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageTemplateProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllTemplatesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0])
{
$request = $this->getAllTemplatesRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageTemplateProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageTemplateProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTemplateProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageTemplateProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageTemplateProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllTemplatesAsync
*
* List templates
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllTemplatesAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0])
{
return $this->getAllTemplatesAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllTemplatesAsyncWithHttpInfo
*
* List templates
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllTemplatesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0])
{
$returnType = '\MailSlurp\Models\PageTemplateProjection';
$request = $this->getAllTemplatesRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllTemplates'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllTemplates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllTemplatesRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllTemplates'][0])
{
$resourcePath = '/templates/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTemplate
*
* Get template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TemplateDto
*/
public function getTemplate($template_id, string $contentType = self::contentTypes['getTemplate'][0])
{
list($response) = $this->getTemplateWithHttpInfo($template_id, $contentType);
return $response;
}
/**
* Operation getTemplateWithHttpInfo
*
* Get template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TemplateDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getTemplateWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplate'][0])
{
$request = $this->getTemplateRequest($template_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\TemplateDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TemplateDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TemplateDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TemplateDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTemplateAsync
*
* Get template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplateAsync($template_id, string $contentType = self::contentTypes['getTemplate'][0])
{
return $this->getTemplateAsyncWithHttpInfo($template_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTemplateAsyncWithHttpInfo
*
* Get template
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplateAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplate'][0])
{
$returnType = '\MailSlurp\Models\TemplateDto';
$request = $this->getTemplateRequest($template_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTemplate'
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTemplateRequest($template_id, string $contentType = self::contentTypes['getTemplate'][0])
{
// verify the required parameter 'template_id' is set
if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $template_id when calling getTemplate'
);
}
$resourcePath = '/templates/{templateId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($template_id !== null) {
$resourcePath = str_replace(
'{' . 'templateId' . '}',
ObjectSerializer::toPathValue($template_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTemplatePreviewHtml
*
* Get template preview HTML
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function getTemplatePreviewHtml($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0])
{
list($response) = $this->getTemplatePreviewHtmlWithHttpInfo($template_id, $contentType);
return $response;
}
/**
* Operation getTemplatePreviewHtmlWithHttpInfo
*
* Get template preview HTML
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function getTemplatePreviewHtmlWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0])
{
$request = $this->getTemplatePreviewHtmlRequest($template_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTemplatePreviewHtmlAsync
*
* Get template preview HTML
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplatePreviewHtmlAsync($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0])
{
return $this->getTemplatePreviewHtmlAsyncWithHttpInfo($template_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTemplatePreviewHtmlAsyncWithHttpInfo
*
* Get template preview HTML
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplatePreviewHtmlAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0])
{
$returnType = 'string';
$request = $this->getTemplatePreviewHtmlRequest($template_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTemplatePreviewHtml'
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewHtml'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTemplatePreviewHtmlRequest($template_id, string $contentType = self::contentTypes['getTemplatePreviewHtml'][0])
{
// verify the required parameter 'template_id' is set
if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $template_id when calling getTemplatePreviewHtml'
);
}
$resourcePath = '/templates/{templateId}/preview/html';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($template_id !== null) {
$resourcePath = str_replace(
'{' . 'templateId' . '}',
ObjectSerializer::toPathValue($template_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['text/html;charset=utf-8', 'text/html', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTemplatePreviewJson
*
* Get template preview Json
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TemplatePreview
*/
public function getTemplatePreviewJson($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0])
{
list($response) = $this->getTemplatePreviewJsonWithHttpInfo($template_id, $contentType);
return $response;
}
/**
* Operation getTemplatePreviewJsonWithHttpInfo
*
* Get template preview Json
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TemplatePreview, HTTP status code, HTTP response headers (array of strings)
*/
public function getTemplatePreviewJsonWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0])
{
$request = $this->getTemplatePreviewJsonRequest($template_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\TemplatePreview' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TemplatePreview' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplatePreview', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TemplatePreview';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TemplatePreview',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTemplatePreviewJsonAsync
*
* Get template preview Json
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplatePreviewJsonAsync($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0])
{
return $this->getTemplatePreviewJsonAsyncWithHttpInfo($template_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTemplatePreviewJsonAsyncWithHttpInfo
*
* Get template preview Json
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplatePreviewJsonAsyncWithHttpInfo($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0])
{
$returnType = '\MailSlurp\Models\TemplatePreview';
$request = $this->getTemplatePreviewJsonRequest($template_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTemplatePreviewJson'
*
* @param string $template_id Template ID (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplatePreviewJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTemplatePreviewJsonRequest($template_id, string $contentType = self::contentTypes['getTemplatePreviewJson'][0])
{
// verify the required parameter 'template_id' is set
if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $template_id when calling getTemplatePreviewJson'
);
}
$resourcePath = '/templates/{templateId}/preview/json';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($template_id !== null) {
$resourcePath = str_replace(
'{' . 'templateId' . '}',
ObjectSerializer::toPathValue($template_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getTemplates
*
* List templates
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TemplateProjection[]
*/
public function getTemplates(string $contentType = self::contentTypes['getTemplates'][0])
{
list($response) = $this->getTemplatesWithHttpInfo($contentType);
return $response;
}
/**
* Operation getTemplatesWithHttpInfo
*
* List templates
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TemplateProjection[], HTTP status code, HTTP response headers (array of strings)
*/
public function getTemplatesWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0])
{
$request = $this->getTemplatesRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\TemplateProjection[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TemplateProjection[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateProjection[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TemplateProjection[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TemplateProjection[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getTemplatesAsync
*
* List templates
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplatesAsync(string $contentType = self::contentTypes['getTemplates'][0])
{
return $this->getTemplatesAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTemplatesAsyncWithHttpInfo
*
* List templates
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTemplatesAsyncWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0])
{
$returnType = '\MailSlurp\Models\TemplateProjection[]';
$request = $this->getTemplatesRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getTemplates'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getTemplatesRequest(string $contentType = self::contentTypes['getTemplates'][0])
{
$resourcePath = '/templates';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateTemplate
*
* Update template
*
* @param string $template_id Template ID (required)
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TemplateDto
*/
public function updateTemplate($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0])
{
list($response) = $this->updateTemplateWithHttpInfo($template_id, $create_template_options, $contentType);
return $response;
}
/**
* Operation updateTemplateWithHttpInfo
*
* Update template
*
* @param string $template_id Template ID (required)
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TemplateDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateTemplateWithHttpInfo($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0])
{
$request = $this->updateTemplateRequest($template_id, $create_template_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\TemplateDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TemplateDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TemplateDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TemplateDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TemplateDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateTemplateAsync
*
* Update template
*
* @param string $template_id Template ID (required)
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateTemplateAsync($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0])
{
return $this->updateTemplateAsyncWithHttpInfo($template_id, $create_template_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateTemplateAsyncWithHttpInfo
*
* Update template
*
* @param string $template_id Template ID (required)
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateTemplateAsyncWithHttpInfo($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0])
{
$returnType = '\MailSlurp\Models\TemplateDto';
$request = $this->updateTemplateRequest($template_id, $create_template_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateTemplate'
*
* @param string $template_id Template ID (required)
* @param \MailSlurp\Models\CreateTemplateOptions $create_template_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTemplate'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateTemplateRequest($template_id, $create_template_options, string $contentType = self::contentTypes['updateTemplate'][0])
{
// verify the required parameter 'template_id' is set
if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $template_id when calling updateTemplate'
);
}
// verify the required parameter 'create_template_options' is set
if ($create_template_options === null || (is_array($create_template_options) && count($create_template_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_template_options when calling updateTemplate'
);
}
$resourcePath = '/templates/{templateId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($template_id !== null) {
$resourcePath = str_replace(
'{' . 'templateId' . '}',
ObjectSerializer::toPathValue($template_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_template_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_template_options));
} else {
$httpBody = $create_template_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* SmsControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* SmsControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class SmsControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'deleteSmsMessage' => [
'application/json',
],
'deleteSmsMessages' => [
'application/json',
],
'getReplyForSmsMessage' => [
'application/json',
],
'getSmsCount' => [
'application/json',
],
'getSmsMessage' => [
'application/json',
],
'getSmsMessagesPaginated' => [
'application/json',
],
'getUnreadSmsCount' => [
'application/json',
],
'replyToSmsMessage' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation deleteSmsMessage
*
* Delete SMS message.
*
* @param string $sms_id sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteSmsMessage($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0])
{
$this->deleteSmsMessageWithHttpInfo($sms_id, $contentType);
}
/**
* Operation deleteSmsMessageWithHttpInfo
*
* Delete SMS message.
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteSmsMessageWithHttpInfo($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0])
{
$request = $this->deleteSmsMessageRequest($sms_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteSmsMessageAsync
*
* Delete SMS message.
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSmsMessageAsync($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0])
{
return $this->deleteSmsMessageAsyncWithHttpInfo($sms_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteSmsMessageAsyncWithHttpInfo
*
* Delete SMS message.
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSmsMessageAsyncWithHttpInfo($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0])
{
$returnType = '';
$request = $this->deleteSmsMessageRequest($sms_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteSmsMessage'
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteSmsMessageRequest($sms_id, string $contentType = self::contentTypes['deleteSmsMessage'][0])
{
// verify the required parameter 'sms_id' is set
if ($sms_id === null || (is_array($sms_id) && count($sms_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sms_id when calling deleteSmsMessage'
);
}
$resourcePath = '/sms/{smsId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($sms_id !== null) {
$resourcePath = str_replace(
'{' . 'smsId' . '}',
ObjectSerializer::toPathValue($sms_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteSmsMessages
*
* Delete all SMS messages
*
* @param string $phone_number_id phone_number_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteSmsMessages($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0])
{
$this->deleteSmsMessagesWithHttpInfo($phone_number_id, $contentType);
}
/**
* Operation deleteSmsMessagesWithHttpInfo
*
* Delete all SMS messages
*
* @param string $phone_number_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteSmsMessagesWithHttpInfo($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0])
{
$request = $this->deleteSmsMessagesRequest($phone_number_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteSmsMessagesAsync
*
* Delete all SMS messages
*
* @param string $phone_number_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSmsMessagesAsync($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0])
{
return $this->deleteSmsMessagesAsyncWithHttpInfo($phone_number_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteSmsMessagesAsyncWithHttpInfo
*
* Delete all SMS messages
*
* @param string $phone_number_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSmsMessagesAsyncWithHttpInfo($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0])
{
$returnType = '';
$request = $this->deleteSmsMessagesRequest($phone_number_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteSmsMessages'
*
* @param string $phone_number_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSmsMessages'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteSmsMessagesRequest($phone_number_id = null, string $contentType = self::contentTypes['deleteSmsMessages'][0])
{
$resourcePath = '/sms';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$phone_number_id,
'phoneNumberId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getReplyForSmsMessage
*
* Get reply for an SMS message
*
* @param string $sms_id sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReplyForSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ReplyForSms
*/
public function getReplyForSmsMessage($sms_id, string $contentType = self::contentTypes['getReplyForSmsMessage'][0])
{
list($response) = $this->getReplyForSmsMessageWithHttpInfo($sms_id, $contentType);
return $response;
}
/**
* Operation getReplyForSmsMessageWithHttpInfo
*
* Get reply for an SMS message
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReplyForSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ReplyForSms, HTTP status code, HTTP response headers (array of strings)
*/
public function getReplyForSmsMessageWithHttpInfo($sms_id, string $contentType = self::contentTypes['getReplyForSmsMessage'][0])
{
$request = $this->getReplyForSmsMessageRequest($sms_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ReplyForSms' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ReplyForSms' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ReplyForSms', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ReplyForSms';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ReplyForSms',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getReplyForSmsMessageAsync
*
* Get reply for an SMS message
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReplyForSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReplyForSmsMessageAsync($sms_id, string $contentType = self::contentTypes['getReplyForSmsMessage'][0])
{
return $this->getReplyForSmsMessageAsyncWithHttpInfo($sms_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getReplyForSmsMessageAsyncWithHttpInfo
*
* Get reply for an SMS message
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReplyForSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReplyForSmsMessageAsyncWithHttpInfo($sms_id, string $contentType = self::contentTypes['getReplyForSmsMessage'][0])
{
$returnType = '\MailSlurp\Models\ReplyForSms';
$request = $this->getReplyForSmsMessageRequest($sms_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getReplyForSmsMessage'
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReplyForSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getReplyForSmsMessageRequest($sms_id, string $contentType = self::contentTypes['getReplyForSmsMessage'][0])
{
// verify the required parameter 'sms_id' is set
if ($sms_id === null || (is_array($sms_id) && count($sms_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sms_id when calling getReplyForSmsMessage'
);
}
$resourcePath = '/sms/{smsId}/reply';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($sms_id !== null) {
$resourcePath = str_replace(
'{' . 'smsId' . '}',
ObjectSerializer::toPathValue($sms_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSmsCount
*
* Get SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CountDto
*/
public function getSmsCount(string $contentType = self::contentTypes['getSmsCount'][0])
{
list($response) = $this->getSmsCountWithHttpInfo($contentType);
return $response;
}
/**
* Operation getSmsCountWithHttpInfo
*
* Get SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getSmsCountWithHttpInfo(string $contentType = self::contentTypes['getSmsCount'][0])
{
$request = $this->getSmsCountRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CountDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CountDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CountDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CountDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSmsCountAsync
*
* Get SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmsCountAsync(string $contentType = self::contentTypes['getSmsCount'][0])
{
return $this->getSmsCountAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSmsCountAsyncWithHttpInfo
*
* Get SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmsCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getSmsCount'][0])
{
$returnType = '\MailSlurp\Models\CountDto';
$request = $this->getSmsCountRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSmsCount'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSmsCountRequest(string $contentType = self::contentTypes['getSmsCount'][0])
{
$resourcePath = '/sms/count';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSmsMessage
*
* Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController.
*
* @param string $sms_id sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SmsDto
*/
public function getSmsMessage($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0])
{
list($response) = $this->getSmsMessageWithHttpInfo($sms_id, $contentType);
return $response;
}
/**
* Operation getSmsMessageWithHttpInfo
*
* Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController.
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SmsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getSmsMessageWithHttpInfo($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0])
{
$request = $this->getSmsMessageRequest($sms_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SmsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SmsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SmsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SmsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SmsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSmsMessageAsync
*
* Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController.
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmsMessageAsync($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0])
{
return $this->getSmsMessageAsyncWithHttpInfo($sms_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSmsMessageAsyncWithHttpInfo
*
* Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController.
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmsMessageAsyncWithHttpInfo($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0])
{
$returnType = '\MailSlurp\Models\SmsDto';
$request = $this->getSmsMessageRequest($sms_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSmsMessage'
*
* @param string $sms_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSmsMessageRequest($sms_id, string $contentType = self::contentTypes['getSmsMessage'][0])
{
// verify the required parameter 'sms_id' is set
if ($sms_id === null || (is_array($sms_id) && count($sms_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sms_id when calling getSmsMessage'
);
}
$resourcePath = '/sms/{smsId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($sms_id !== null) {
$resourcePath = str_replace(
'{' . 'smsId' . '}',
ObjectSerializer::toPathValue($sms_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSmsMessagesPaginated
*
* Get all SMS messages in all phone numbers in paginated form. .
*
* @param string $phone_number Optional receiving phone number to filter SMS messages for (optional)
* @param int $page Optional page index in SMS list pagination (optional, default to 0)
* @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param \DateTime $since Optional filter SMSs received after given date time (optional)
* @param \DateTime $before Optional filter SMSs received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageSmsProjection
*/
public function getSmsMessagesPaginated($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0])
{
list($response) = $this->getSmsMessagesPaginatedWithHttpInfo($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType);
return $response;
}
/**
* Operation getSmsMessagesPaginatedWithHttpInfo
*
* Get all SMS messages in all phone numbers in paginated form. .
*
* @param string $phone_number Optional receiving phone number to filter SMS messages for (optional)
* @param int $page Optional page index in SMS list pagination (optional, default to 0)
* @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param \DateTime $since Optional filter SMSs received after given date time (optional)
* @param \DateTime $before Optional filter SMSs received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageSmsProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getSmsMessagesPaginatedWithHttpInfo($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0])
{
$request = $this->getSmsMessagesPaginatedRequest($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageSmsProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageSmsProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSmsProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageSmsProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageSmsProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSmsMessagesPaginatedAsync
*
* Get all SMS messages in all phone numbers in paginated form. .
*
* @param string $phone_number Optional receiving phone number to filter SMS messages for (optional)
* @param int $page Optional page index in SMS list pagination (optional, default to 0)
* @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param \DateTime $since Optional filter SMSs received after given date time (optional)
* @param \DateTime $before Optional filter SMSs received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmsMessagesPaginatedAsync($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0])
{
return $this->getSmsMessagesPaginatedAsyncWithHttpInfo($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSmsMessagesPaginatedAsyncWithHttpInfo
*
* Get all SMS messages in all phone numbers in paginated form. .
*
* @param string $phone_number Optional receiving phone number to filter SMS messages for (optional)
* @param int $page Optional page index in SMS list pagination (optional, default to 0)
* @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param \DateTime $since Optional filter SMSs received after given date time (optional)
* @param \DateTime $before Optional filter SMSs received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmsMessagesPaginatedAsyncWithHttpInfo($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageSmsProjection';
$request = $this->getSmsMessagesPaginatedRequest($phone_number, $page, $size, $sort, $unread_only, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSmsMessagesPaginated'
*
* @param string $phone_number Optional receiving phone number to filter SMS messages for (optional)
* @param int $page Optional page index in SMS list pagination (optional, default to 0)
* @param int $size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param \DateTime $since Optional filter SMSs received after given date time (optional)
* @param \DateTime $before Optional filter SMSs received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmsMessagesPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSmsMessagesPaginatedRequest($phone_number = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $since = null, $before = null, string $contentType = self::contentTypes['getSmsMessagesPaginated'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling SmsControllerApi.getSmsMessagesPaginated, must be smaller than or equal to 100.');
}
$resourcePath = '/sms';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$phone_number,
'phoneNumber', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getUnreadSmsCount
*
* Get unread SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadSmsCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\UnreadCount
*/
public function getUnreadSmsCount(string $contentType = self::contentTypes['getUnreadSmsCount'][0])
{
list($response) = $this->getUnreadSmsCountWithHttpInfo($contentType);
return $response;
}
/**
* Operation getUnreadSmsCountWithHttpInfo
*
* Get unread SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadSmsCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\UnreadCount, HTTP status code, HTTP response headers (array of strings)
*/
public function getUnreadSmsCountWithHttpInfo(string $contentType = self::contentTypes['getUnreadSmsCount'][0])
{
$request = $this->getUnreadSmsCountRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\UnreadCount' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\UnreadCount' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\UnreadCount', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\UnreadCount';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\UnreadCount',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getUnreadSmsCountAsync
*
* Get unread SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadSmsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getUnreadSmsCountAsync(string $contentType = self::contentTypes['getUnreadSmsCount'][0])
{
return $this->getUnreadSmsCountAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getUnreadSmsCountAsyncWithHttpInfo
*
* Get unread SMS count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadSmsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getUnreadSmsCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getUnreadSmsCount'][0])
{
$returnType = '\MailSlurp\Models\UnreadCount';
$request = $this->getUnreadSmsCountRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getUnreadSmsCount'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadSmsCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getUnreadSmsCountRequest(string $contentType = self::contentTypes['getUnreadSmsCount'][0])
{
$resourcePath = '/sms/unreadCount';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation replyToSmsMessage
*
* Send a reply to a received SMS message. Replies are sent from the receiving number.
*
* @param string $sms_id sms_id (required)
* @param \MailSlurp\Models\SmsReplyOptions $sms_reply_options sms_reply_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentSmsDto
*/
public function replyToSmsMessage($sms_id, $sms_reply_options, string $contentType = self::contentTypes['replyToSmsMessage'][0])
{
list($response) = $this->replyToSmsMessageWithHttpInfo($sms_id, $sms_reply_options, $contentType);
return $response;
}
/**
* Operation replyToSmsMessageWithHttpInfo
*
* Send a reply to a received SMS message. Replies are sent from the receiving number.
*
* @param string $sms_id (required)
* @param \MailSlurp\Models\SmsReplyOptions $sms_reply_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToSmsMessage'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentSmsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function replyToSmsMessageWithHttpInfo($sms_id, $sms_reply_options, string $contentType = self::contentTypes['replyToSmsMessage'][0])
{
$request = $this->replyToSmsMessageRequest($sms_id, $sms_reply_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SentSmsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentSmsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentSmsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentSmsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentSmsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation replyToSmsMessageAsync
*
* Send a reply to a received SMS message. Replies are sent from the receiving number.
*
* @param string $sms_id (required)
* @param \MailSlurp\Models\SmsReplyOptions $sms_reply_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function replyToSmsMessageAsync($sms_id, $sms_reply_options, string $contentType = self::contentTypes['replyToSmsMessage'][0])
{
return $this->replyToSmsMessageAsyncWithHttpInfo($sms_id, $sms_reply_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation replyToSmsMessageAsyncWithHttpInfo
*
* Send a reply to a received SMS message. Replies are sent from the receiving number.
*
* @param string $sms_id (required)
* @param \MailSlurp\Models\SmsReplyOptions $sms_reply_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function replyToSmsMessageAsyncWithHttpInfo($sms_id, $sms_reply_options, string $contentType = self::contentTypes['replyToSmsMessage'][0])
{
$returnType = '\MailSlurp\Models\SentSmsDto';
$request = $this->replyToSmsMessageRequest($sms_id, $sms_reply_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'replyToSmsMessage'
*
* @param string $sms_id (required)
* @param \MailSlurp\Models\SmsReplyOptions $sms_reply_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToSmsMessage'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function replyToSmsMessageRequest($sms_id, $sms_reply_options, string $contentType = self::contentTypes['replyToSmsMessage'][0])
{
// verify the required parameter 'sms_id' is set
if ($sms_id === null || (is_array($sms_id) && count($sms_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sms_id when calling replyToSmsMessage'
);
}
// verify the required parameter 'sms_reply_options' is set
if ($sms_reply_options === null || (is_array($sms_reply_options) && count($sms_reply_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sms_reply_options when calling replyToSmsMessage'
);
}
$resourcePath = '/sms/{smsId}/reply';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($sms_id !== null) {
$resourcePath = str_replace(
'{' . 'smsId' . '}',
ObjectSerializer::toPathValue($sms_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($sms_reply_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($sms_reply_options));
} else {
$httpBody = $sms_reply_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* SentEmailsControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* SentEmailsControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class SentEmailsControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'deleteAllSentEmails' => [
'application/json',
],
'deleteSentEmail' => [
'application/json',
],
'getAllSentTrackingPixels' => [
'application/json',
],
'getRawSentEmailContents' => [
'application/json',
],
'getRawSentEmailJson' => [
'application/json',
],
'getSentDeliveryStatus' => [
'application/json',
],
'getSentDeliveryStatuses' => [
'application/json',
],
'getSentDeliveryStatusesBySentId' => [
'application/json',
],
'getSentEmail' => [
'application/json',
],
'getSentEmailHTMLContent' => [
'application/json',
],
'getSentEmailPreviewURLs' => [
'application/json',
],
'getSentEmailTrackingPixels' => [
'application/json',
],
'getSentEmails' => [
'application/json',
],
'getSentEmailsWithQueueResults' => [
'application/json',
],
'getSentOrganizationEmails' => [
'application/json',
],
'waitForDeliveryStatuses' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation deleteAllSentEmails
*
* Delete all sent email receipts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllSentEmails(string $contentType = self::contentTypes['deleteAllSentEmails'][0])
{
$this->deleteAllSentEmailsWithHttpInfo($contentType);
}
/**
* Operation deleteAllSentEmailsWithHttpInfo
*
* Delete all sent email receipts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllSentEmailsWithHttpInfo(string $contentType = self::contentTypes['deleteAllSentEmails'][0])
{
$request = $this->deleteAllSentEmailsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllSentEmailsAsync
*
* Delete all sent email receipts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllSentEmailsAsync(string $contentType = self::contentTypes['deleteAllSentEmails'][0])
{
return $this->deleteAllSentEmailsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllSentEmailsAsyncWithHttpInfo
*
* Delete all sent email receipts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllSentEmailsAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllSentEmails'][0])
{
$returnType = '';
$request = $this->deleteAllSentEmailsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllSentEmails'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllSentEmailsRequest(string $contentType = self::contentTypes['deleteAllSentEmails'][0])
{
$resourcePath = '/sent';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteSentEmail
*
* Delete sent email receipt
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteSentEmail($id, string $contentType = self::contentTypes['deleteSentEmail'][0])
{
$this->deleteSentEmailWithHttpInfo($id, $contentType);
}
/**
* Operation deleteSentEmailWithHttpInfo
*
* Delete sent email receipt
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteSentEmailWithHttpInfo($id, string $contentType = self::contentTypes['deleteSentEmail'][0])
{
$request = $this->deleteSentEmailRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteSentEmailAsync
*
* Delete sent email receipt
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSentEmailAsync($id, string $contentType = self::contentTypes['deleteSentEmail'][0])
{
return $this->deleteSentEmailAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteSentEmailAsyncWithHttpInfo
*
* Delete sent email receipt
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSentEmailAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteSentEmail'][0])
{
$returnType = '';
$request = $this->deleteSentEmailRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteSentEmail'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSentEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteSentEmailRequest($id, string $contentType = self::contentTypes['deleteSentEmail'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteSentEmail'
);
}
$resourcePath = '/sent/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllSentTrackingPixels
*
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageTrackingPixelProjection
*/
public function getAllSentTrackingPixels($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0])
{
list($response) = $this->getAllSentTrackingPixelsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getAllSentTrackingPixelsWithHttpInfo
*
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllSentTrackingPixelsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0])
{
$request = $this->getAllSentTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageTrackingPixelProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllSentTrackingPixelsAsync
*
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllSentTrackingPixelsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0])
{
return $this->getAllSentTrackingPixelsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllSentTrackingPixelsAsyncWithHttpInfo
*
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllSentTrackingPixelsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0])
{
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
$request = $this->getAllSentTrackingPixelsRequest($page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllSentTrackingPixels'
*
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllSentTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllSentTrackingPixelsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getAllSentTrackingPixels'][0])
{
$resourcePath = '/sent/tracking-pixels';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getRawSentEmailContents
*
* Get raw sent email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function getRawSentEmailContents($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0])
{
$this->getRawSentEmailContentsWithHttpInfo($email_id, $contentType);
}
/**
* Operation getRawSentEmailContentsWithHttpInfo
*
* Get raw sent email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function getRawSentEmailContentsWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0])
{
$request = $this->getRawSentEmailContentsRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation getRawSentEmailContentsAsync
*
* Get raw sent email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawSentEmailContentsAsync($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0])
{
return $this->getRawSentEmailContentsAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getRawSentEmailContentsAsyncWithHttpInfo
*
* Get raw sent email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawSentEmailContentsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0])
{
$returnType = '';
$request = $this->getRawSentEmailContentsRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getRawSentEmailContents'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailContents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getRawSentEmailContentsRequest($email_id, string $contentType = self::contentTypes['getRawSentEmailContents'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getRawSentEmailContents'
);
}
$resourcePath = '/sent/{emailId}/raw';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getRawSentEmailJson
*
* Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\RawEmailJson
*/
public function getRawSentEmailJson($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0])
{
list($response) = $this->getRawSentEmailJsonWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation getRawSentEmailJsonWithHttpInfo
*
* Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\RawEmailJson, HTTP status code, HTTP response headers (array of strings)
*/
public function getRawSentEmailJsonWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0])
{
$request = $this->getRawSentEmailJsonRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\RawEmailJson' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\RawEmailJson' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\RawEmailJson', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\RawEmailJson';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\RawEmailJson',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getRawSentEmailJsonAsync
*
* Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawSentEmailJsonAsync($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0])
{
return $this->getRawSentEmailJsonAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getRawSentEmailJsonAsyncWithHttpInfo
*
* Get raw sent email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawSentEmailJsonAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0])
{
$returnType = '\MailSlurp\Models\RawEmailJson';
$request = $this->getRawSentEmailJsonRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getRawSentEmailJson'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawSentEmailJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getRawSentEmailJsonRequest($email_id, string $contentType = self::contentTypes['getRawSentEmailJson'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getRawSentEmailJson'
);
}
$resourcePath = '/sent/{emailId}/raw/json';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentDeliveryStatus
*
* @param string $delivery_id delivery_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DeliveryStatusDto
*/
public function getSentDeliveryStatus($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0])
{
list($response) = $this->getSentDeliveryStatusWithHttpInfo($delivery_id, $contentType);
return $response;
}
/**
* Operation getSentDeliveryStatusWithHttpInfo
*
* @param string $delivery_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DeliveryStatusDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentDeliveryStatusWithHttpInfo($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0])
{
$request = $this->getSentDeliveryStatusRequest($delivery_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DeliveryStatusDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DeliveryStatusDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DeliveryStatusDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DeliveryStatusDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DeliveryStatusDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentDeliveryStatusAsync
*
* @param string $delivery_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentDeliveryStatusAsync($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0])
{
return $this->getSentDeliveryStatusAsyncWithHttpInfo($delivery_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentDeliveryStatusAsyncWithHttpInfo
*
* @param string $delivery_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentDeliveryStatusAsyncWithHttpInfo($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0])
{
$returnType = '\MailSlurp\Models\DeliveryStatusDto';
$request = $this->getSentDeliveryStatusRequest($delivery_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentDeliveryStatus'
*
* @param string $delivery_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentDeliveryStatusRequest($delivery_id, string $contentType = self::contentTypes['getSentDeliveryStatus'][0])
{
// verify the required parameter 'delivery_id' is set
if ($delivery_id === null || (is_array($delivery_id) && count($delivery_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $delivery_id when calling getSentDeliveryStatus'
);
}
$resourcePath = '/sent/delivery-status/{deliveryId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($delivery_id !== null) {
$resourcePath = str_replace(
'{' . 'deliveryId' . '}',
ObjectSerializer::toPathValue($delivery_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentDeliveryStatuses
*
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageDeliveryStatus
*/
public function getSentDeliveryStatuses($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0])
{
list($response) = $this->getSentDeliveryStatusesWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getSentDeliveryStatusesWithHttpInfo
*
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageDeliveryStatus, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentDeliveryStatusesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0])
{
$request = $this->getSentDeliveryStatusesRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageDeliveryStatus' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageDeliveryStatus' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageDeliveryStatus', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageDeliveryStatus';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageDeliveryStatus',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentDeliveryStatusesAsync
*
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentDeliveryStatusesAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0])
{
return $this->getSentDeliveryStatusesAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentDeliveryStatusesAsyncWithHttpInfo
*
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentDeliveryStatusesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0])
{
$returnType = '\MailSlurp\Models\PageDeliveryStatus';
$request = $this->getSentDeliveryStatusesRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentDeliveryStatuses'
*
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatuses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentDeliveryStatusesRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatuses'][0])
{
$resourcePath = '/sent/delivery-status';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentDeliveryStatusesBySentId
*
* @param string $sent_id ID of the sent email that you want to get the delivery status of. Sent email object is returned when sending an email (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageDeliveryStatus
*/
public function getSentDeliveryStatusesBySentId($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0])
{
list($response) = $this->getSentDeliveryStatusesBySentIdWithHttpInfo($sent_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getSentDeliveryStatusesBySentIdWithHttpInfo
*
* @param string $sent_id ID of the sent email that you want to get the delivery status of. Sent email object is returned when sending an email (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageDeliveryStatus, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentDeliveryStatusesBySentIdWithHttpInfo($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0])
{
$request = $this->getSentDeliveryStatusesBySentIdRequest($sent_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageDeliveryStatus' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageDeliveryStatus' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageDeliveryStatus', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageDeliveryStatus';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageDeliveryStatus',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentDeliveryStatusesBySentIdAsync
*
* @param string $sent_id ID of the sent email that you want to get the delivery status of. Sent email object is returned when sending an email (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentDeliveryStatusesBySentIdAsync($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0])
{
return $this->getSentDeliveryStatusesBySentIdAsyncWithHttpInfo($sent_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentDeliveryStatusesBySentIdAsyncWithHttpInfo
*
* @param string $sent_id ID of the sent email that you want to get the delivery status of. Sent email object is returned when sending an email (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentDeliveryStatusesBySentIdAsyncWithHttpInfo($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0])
{
$returnType = '\MailSlurp\Models\PageDeliveryStatus';
$request = $this->getSentDeliveryStatusesBySentIdRequest($sent_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentDeliveryStatusesBySentId'
*
* @param string $sent_id ID of the sent email that you want to get the delivery status of. Sent email object is returned when sending an email (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentDeliveryStatusesBySentId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentDeliveryStatusesBySentIdRequest($sent_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentDeliveryStatusesBySentId'][0])
{
// verify the required parameter 'sent_id' is set
if ($sent_id === null || (is_array($sent_id) && count($sent_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $sent_id when calling getSentDeliveryStatusesBySentId'
);
}
$resourcePath = '/sent/{sentId}/delivery-status';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($sent_id !== null) {
$resourcePath = str_replace(
'{' . 'sentId' . '}',
ObjectSerializer::toPathValue($sent_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentEmail
*
* Get sent email receipt
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentEmailDto
*/
public function getSentEmail($id, string $contentType = self::contentTypes['getSentEmail'][0])
{
list($response) = $this->getSentEmailWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getSentEmailWithHttpInfo
*
* Get sent email receipt
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentEmailWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmail'][0])
{
$request = $this->getSentEmailRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentEmailAsync
*
* Get sent email receipt
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailAsync($id, string $contentType = self::contentTypes['getSentEmail'][0])
{
return $this->getSentEmailAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentEmailAsyncWithHttpInfo
*
* Get sent email receipt
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmail'][0])
{
$returnType = '\MailSlurp\Models\SentEmailDto';
$request = $this->getSentEmailRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentEmail'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentEmailRequest($id, string $contentType = self::contentTypes['getSentEmail'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getSentEmail'
);
}
$resourcePath = '/sent/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentEmailHTMLContent
*
* Get sent email HTML content
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function getSentEmailHTMLContent($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0])
{
list($response) = $this->getSentEmailHTMLContentWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getSentEmailHTMLContentWithHttpInfo
*
* Get sent email HTML content
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentEmailHTMLContentWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0])
{
$request = $this->getSentEmailHTMLContentRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentEmailHTMLContentAsync
*
* Get sent email HTML content
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailHTMLContentAsync($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0])
{
return $this->getSentEmailHTMLContentAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentEmailHTMLContentAsyncWithHttpInfo
*
* Get sent email HTML content
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailHTMLContentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0])
{
$returnType = 'string';
$request = $this->getSentEmailHTMLContentRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentEmailHTMLContent'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailHTMLContent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentEmailHTMLContentRequest($id, string $contentType = self::contentTypes['getSentEmailHTMLContent'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getSentEmailHTMLContent'
);
}
$resourcePath = '/sent/{id}/html';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['text/html', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentEmailPreviewURLs
*
* Get sent email URL for viewing in browser or downloading
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreviewUrls
*/
public function getSentEmailPreviewURLs($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0])
{
list($response) = $this->getSentEmailPreviewURLsWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getSentEmailPreviewURLsWithHttpInfo
*
* Get sent email URL for viewing in browser or downloading
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreviewUrls, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentEmailPreviewURLsWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0])
{
$request = $this->getSentEmailPreviewURLsRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreviewUrls' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreviewUrls' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreviewUrls', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreviewUrls';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreviewUrls',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentEmailPreviewURLsAsync
*
* Get sent email URL for viewing in browser or downloading
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailPreviewURLsAsync($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0])
{
return $this->getSentEmailPreviewURLsAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentEmailPreviewURLsAsyncWithHttpInfo
*
* Get sent email URL for viewing in browser or downloading
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailPreviewURLsAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0])
{
$returnType = '\MailSlurp\Models\EmailPreviewUrls';
$request = $this->getSentEmailPreviewURLsRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentEmailPreviewURLs'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentEmailPreviewURLsRequest($id, string $contentType = self::contentTypes['getSentEmailPreviewURLs'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getSentEmailPreviewURLs'
);
}
$resourcePath = '/sent/{id}/urls';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentEmailTrackingPixels
*
* @param string $id id (required)
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageTrackingPixelProjection
*/
public function getSentEmailTrackingPixels($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0])
{
list($response) = $this->getSentEmailTrackingPixelsWithHttpInfo($id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getSentEmailTrackingPixelsWithHttpInfo
*
* @param string $id (required)
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentEmailTrackingPixelsWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0])
{
$request = $this->getSentEmailTrackingPixelsRequest($id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageTrackingPixelProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentEmailTrackingPixelsAsync
*
* @param string $id (required)
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailTrackingPixelsAsync($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0])
{
return $this->getSentEmailTrackingPixelsAsyncWithHttpInfo($id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentEmailTrackingPixelsAsyncWithHttpInfo
*
* @param string $id (required)
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailTrackingPixelsAsyncWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0])
{
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
$request = $this->getSentEmailTrackingPixelsRequest($id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentEmailTrackingPixels'
*
* @param string $id (required)
* @param int $page Optional page index in sent email tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in sent email tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentEmailTrackingPixelsRequest($id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailTrackingPixels'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getSentEmailTrackingPixels'
);
}
$resourcePath = '/sent/{id}/tracking-pixels';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentEmails
*
* Get all sent emails in paginated form
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageSentEmailProjection
*/
public function getSentEmails($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0])
{
list($response) = $this->getSentEmailsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getSentEmailsWithHttpInfo
*
* Get all sent emails in paginated form
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageSentEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentEmailsWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0])
{
$request = $this->getSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageSentEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageSentEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageSentEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageSentEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentEmailsAsync
*
* Get all sent emails in paginated form
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailsAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0])
{
return $this->getSentEmailsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentEmailsAsyncWithHttpInfo
*
* Get all sent emails in paginated form
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailsAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0])
{
$returnType = '\MailSlurp\Models\PageSentEmailProjection';
$request = $this->getSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentEmails'
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentEmailsRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentEmails'][0])
{
$resourcePath = '/sent';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentEmailsWithQueueResults
*
* Get results of email sent with queues in paginated form
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageSentEmailWithQueueProjection
*/
public function getSentEmailsWithQueueResults($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0])
{
list($response) = $this->getSentEmailsWithQueueResultsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getSentEmailsWithQueueResultsWithHttpInfo
*
* Get results of email sent with queues in paginated form
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageSentEmailWithQueueProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentEmailsWithQueueResultsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0])
{
$request = $this->getSentEmailsWithQueueResultsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageSentEmailWithQueueProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageSentEmailWithQueueProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailWithQueueProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageSentEmailWithQueueProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageSentEmailWithQueueProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentEmailsWithQueueResultsAsync
*
* Get results of email sent with queues in paginated form
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailsWithQueueResultsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0])
{
return $this->getSentEmailsWithQueueResultsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentEmailsWithQueueResultsAsyncWithHttpInfo
*
* Get results of email sent with queues in paginated form
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentEmailsWithQueueResultsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0])
{
$returnType = '\MailSlurp\Models\PageSentEmailWithQueueProjection';
$request = $this->getSentEmailsWithQueueResultsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentEmailsWithQueueResults'
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentEmailsWithQueueResults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentEmailsWithQueueResultsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getSentEmailsWithQueueResults'][0])
{
$resourcePath = '/sent/queue-results';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSentOrganizationEmails
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in sent email list pagination (optional, default to 0)
* @param int $size Optional page size in sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageSentEmailProjection
*/
public function getSentOrganizationEmails($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0])
{
list($response) = $this->getSentOrganizationEmailsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getSentOrganizationEmailsWithHttpInfo
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in sent email list pagination (optional, default to 0)
* @param int $size Optional page size in sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageSentEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getSentOrganizationEmailsWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0])
{
$request = $this->getSentOrganizationEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageSentEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageSentEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageSentEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageSentEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSentOrganizationEmailsAsync
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in sent email list pagination (optional, default to 0)
* @param int $size Optional page size in sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentOrganizationEmailsAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0])
{
return $this->getSentOrganizationEmailsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSentOrganizationEmailsAsyncWithHttpInfo
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in sent email list pagination (optional, default to 0)
* @param int $size Optional page size in sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSentOrganizationEmailsAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0])
{
$returnType = '\MailSlurp\Models\PageSentEmailProjection';
$request = $this->getSentOrganizationEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSentOrganizationEmails'
*
* @param string $inbox_id Optional inboxId to filter sender of sent emails by (optional)
* @param int $page Optional page index in sent email list pagination (optional, default to 0)
* @param int $size Optional page size in sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSentOrganizationEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSentOrganizationEmailsRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getSentOrganizationEmails'][0])
{
$resourcePath = '/sent/organization';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForDeliveryStatuses
*
* @param string $sent_id Optional sent email ID filter (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DeliveryStatusDto
*/
public function waitForDeliveryStatuses($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0])
{
list($response) = $this->waitForDeliveryStatusesWithHttpInfo($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType);
return $response;
}
/**
* Operation waitForDeliveryStatusesWithHttpInfo
*
* @param string $sent_id Optional sent email ID filter (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DeliveryStatusDto, HTTP status code, HTTP response headers (array of strings)
*/
public function waitForDeliveryStatusesWithHttpInfo($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0])
{
$request = $this->waitForDeliveryStatusesRequest($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DeliveryStatusDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DeliveryStatusDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DeliveryStatusDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DeliveryStatusDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DeliveryStatusDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForDeliveryStatusesAsync
*
* @param string $sent_id Optional sent email ID filter (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForDeliveryStatusesAsync($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0])
{
return $this->waitForDeliveryStatusesAsyncWithHttpInfo($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForDeliveryStatusesAsyncWithHttpInfo
*
* @param string $sent_id Optional sent email ID filter (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForDeliveryStatusesAsyncWithHttpInfo($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0])
{
$returnType = '\MailSlurp\Models\DeliveryStatusDto';
$request = $this->waitForDeliveryStatusesRequest($sent_id, $inbox_id, $timeout, $index, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForDeliveryStatuses'
*
* @param string $sent_id Optional sent email ID filter (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param int $index Zero based index of the delivery status to wait for. If 1 delivery status already and you want to wait for the 2nd pass index=1 (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForDeliveryStatuses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForDeliveryStatusesRequest($sent_id = null, $inbox_id = null, $timeout = null, $index = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForDeliveryStatuses'][0])
{
if ($index !== null && $index > 2147483647) {
throw new \InvalidArgumentException('invalid value for "$index" when calling SentEmailsControllerApi.waitForDeliveryStatuses, must be smaller than or equal to 2147483647.');
}
if ($index !== null && $index < 0) {
throw new \InvalidArgumentException('invalid value for "$index" when calling SentEmailsControllerApi.waitForDeliveryStatuses, must be bigger than or equal to 0.');
}
$resourcePath = '/sent/delivery-status/wait-for';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sent_id,
'sentId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$index,
'index', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* PhoneControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* PhoneControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class PhoneControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createEmergencyAddress' => [
'application/json',
],
'deleteEmergencyAddress' => [
'application/json',
],
'deletePhoneNumber' => [
'application/json',
],
'getEmergencyAddress' => [
'application/json',
],
'getEmergencyAddresses' => [
'application/json',
],
'getPhoneNumber' => [
'application/json',
],
'getPhoneNumbers' => [
'application/json',
],
'getPhonePlans' => [
'application/json',
],
'testPhoneNumberSendSms' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createEmergencyAddress
*
* @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options create_emergency_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmergencyAddress
*/
public function createEmergencyAddress($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0])
{
list($response) = $this->createEmergencyAddressWithHttpInfo($create_emergency_address_options, $contentType);
return $response;
}
/**
* Operation createEmergencyAddressWithHttpInfo
*
* @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmergencyAddress, HTTP status code, HTTP response headers (array of strings)
*/
public function createEmergencyAddressWithHttpInfo($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0])
{
$request = $this->createEmergencyAddressRequest($create_emergency_address_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmergencyAddress' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmergencyAddress' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmergencyAddress', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmergencyAddress';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmergencyAddress',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createEmergencyAddressAsync
*
* @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createEmergencyAddressAsync($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0])
{
return $this->createEmergencyAddressAsyncWithHttpInfo($create_emergency_address_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createEmergencyAddressAsyncWithHttpInfo
*
* @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createEmergencyAddressAsyncWithHttpInfo($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0])
{
$returnType = '\MailSlurp\Models\EmergencyAddress';
$request = $this->createEmergencyAddressRequest($create_emergency_address_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createEmergencyAddress'
*
* @param \MailSlurp\Models\CreateEmergencyAddressOptions $create_emergency_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createEmergencyAddressRequest($create_emergency_address_options, string $contentType = self::contentTypes['createEmergencyAddress'][0])
{
// verify the required parameter 'create_emergency_address_options' is set
if ($create_emergency_address_options === null || (is_array($create_emergency_address_options) && count($create_emergency_address_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_emergency_address_options when calling createEmergencyAddress'
);
}
$resourcePath = '/phone/emergency-addresses';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_emergency_address_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_emergency_address_options));
} else {
$httpBody = $create_emergency_address_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteEmergencyAddress
*
* @param string $address_id address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmptyResponseDto
*/
public function deleteEmergencyAddress($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0])
{
list($response) = $this->deleteEmergencyAddressWithHttpInfo($address_id, $contentType);
return $response;
}
/**
* Operation deleteEmergencyAddressWithHttpInfo
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmptyResponseDto, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteEmergencyAddressWithHttpInfo($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0])
{
$request = $this->deleteEmergencyAddressRequest($address_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmptyResponseDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmptyResponseDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmptyResponseDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmptyResponseDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmptyResponseDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation deleteEmergencyAddressAsync
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteEmergencyAddressAsync($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0])
{
return $this->deleteEmergencyAddressAsyncWithHttpInfo($address_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteEmergencyAddressAsyncWithHttpInfo
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteEmergencyAddressAsyncWithHttpInfo($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0])
{
$returnType = '\MailSlurp\Models\EmptyResponseDto';
$request = $this->deleteEmergencyAddressRequest($address_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteEmergencyAddress'
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteEmergencyAddressRequest($address_id, string $contentType = self::contentTypes['deleteEmergencyAddress'][0])
{
// verify the required parameter 'address_id' is set
if ($address_id === null || (is_array($address_id) && count($address_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $address_id when calling deleteEmergencyAddress'
);
}
$resourcePath = '/phone/emergency-addresses/{addressId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($address_id !== null) {
$resourcePath = str_replace(
'{' . 'addressId' . '}',
ObjectSerializer::toPathValue($address_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deletePhoneNumber
*
* @param string $phone_number_id phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deletePhoneNumber($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0])
{
$this->deletePhoneNumberWithHttpInfo($phone_number_id, $contentType);
}
/**
* Operation deletePhoneNumberWithHttpInfo
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deletePhoneNumberWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0])
{
$request = $this->deletePhoneNumberRequest($phone_number_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deletePhoneNumberAsync
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deletePhoneNumberAsync($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0])
{
return $this->deletePhoneNumberAsyncWithHttpInfo($phone_number_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deletePhoneNumberAsyncWithHttpInfo
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deletePhoneNumberAsyncWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0])
{
$returnType = '';
$request = $this->deletePhoneNumberRequest($phone_number_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deletePhoneNumber'
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deletePhoneNumberRequest($phone_number_id, string $contentType = self::contentTypes['deletePhoneNumber'][0])
{
// verify the required parameter 'phone_number_id' is set
if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $phone_number_id when calling deletePhoneNumber'
);
}
$resourcePath = '/phone/numbers/{phoneNumberId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($phone_number_id !== null) {
$resourcePath = str_replace(
'{' . 'phoneNumberId' . '}',
ObjectSerializer::toPathValue($phone_number_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmergencyAddress
*
* @param string $address_id address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmergencyAddress
*/
public function getEmergencyAddress($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0])
{
list($response) = $this->getEmergencyAddressWithHttpInfo($address_id, $contentType);
return $response;
}
/**
* Operation getEmergencyAddressWithHttpInfo
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmergencyAddress, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmergencyAddressWithHttpInfo($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0])
{
$request = $this->getEmergencyAddressRequest($address_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmergencyAddress' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmergencyAddress' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmergencyAddress', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmergencyAddress';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmergencyAddress',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmergencyAddressAsync
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmergencyAddressAsync($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0])
{
return $this->getEmergencyAddressAsyncWithHttpInfo($address_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmergencyAddressAsyncWithHttpInfo
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmergencyAddressAsyncWithHttpInfo($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0])
{
$returnType = '\MailSlurp\Models\EmergencyAddress';
$request = $this->getEmergencyAddressRequest($address_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmergencyAddress'
*
* @param string $address_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmergencyAddressRequest($address_id, string $contentType = self::contentTypes['getEmergencyAddress'][0])
{
// verify the required parameter 'address_id' is set
if ($address_id === null || (is_array($address_id) && count($address_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $address_id when calling getEmergencyAddress'
);
}
$resourcePath = '/phone/emergency-addresses/{addressId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($address_id !== null) {
$resourcePath = str_replace(
'{' . 'addressId' . '}',
ObjectSerializer::toPathValue($address_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmergencyAddresses
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmergencyAddressDto[]
*/
public function getEmergencyAddresses(string $contentType = self::contentTypes['getEmergencyAddresses'][0])
{
list($response) = $this->getEmergencyAddressesWithHttpInfo($contentType);
return $response;
}
/**
* Operation getEmergencyAddressesWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmergencyAddressDto[], HTTP status code, HTTP response headers (array of strings)
*/
public function getEmergencyAddressesWithHttpInfo(string $contentType = self::contentTypes['getEmergencyAddresses'][0])
{
$request = $this->getEmergencyAddressesRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmergencyAddressDto[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmergencyAddressDto[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmergencyAddressDto[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmergencyAddressDto[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmergencyAddressDto[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmergencyAddressesAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmergencyAddressesAsync(string $contentType = self::contentTypes['getEmergencyAddresses'][0])
{
return $this->getEmergencyAddressesAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmergencyAddressesAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmergencyAddressesAsyncWithHttpInfo(string $contentType = self::contentTypes['getEmergencyAddresses'][0])
{
$returnType = '\MailSlurp\Models\EmergencyAddressDto[]';
$request = $this->getEmergencyAddressesRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmergencyAddresses'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmergencyAddresses'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmergencyAddressesRequest(string $contentType = self::contentTypes['getEmergencyAddresses'][0])
{
$resourcePath = '/phone/emergency-addresses';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getPhoneNumber
*
* @param string $phone_number_id phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PhoneNumberDto
*/
public function getPhoneNumber($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0])
{
list($response) = $this->getPhoneNumberWithHttpInfo($phone_number_id, $contentType);
return $response;
}
/**
* Operation getPhoneNumberWithHttpInfo
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PhoneNumberDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getPhoneNumberWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0])
{
$request = $this->getPhoneNumberRequest($phone_number_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PhoneNumberDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PhoneNumberDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PhoneNumberDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PhoneNumberDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PhoneNumberDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getPhoneNumberAsync
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhoneNumberAsync($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0])
{
return $this->getPhoneNumberAsyncWithHttpInfo($phone_number_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getPhoneNumberAsyncWithHttpInfo
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhoneNumberAsyncWithHttpInfo($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0])
{
$returnType = '\MailSlurp\Models\PhoneNumberDto';
$request = $this->getPhoneNumberRequest($phone_number_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getPhoneNumber'
*
* @param string $phone_number_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumber'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getPhoneNumberRequest($phone_number_id, string $contentType = self::contentTypes['getPhoneNumber'][0])
{
// verify the required parameter 'phone_number_id' is set
if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $phone_number_id when calling getPhoneNumber'
);
}
$resourcePath = '/phone/numbers/{phoneNumberId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($phone_number_id !== null) {
$resourcePath = str_replace(
'{' . 'phoneNumberId' . '}',
ObjectSerializer::toPathValue($phone_number_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getPhoneNumbers
*
* @param string $phone_country Optional phone country (optional)
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PagePhoneNumberProjection
*/
public function getPhoneNumbers($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0])
{
list($response) = $this->getPhoneNumbersWithHttpInfo($phone_country, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getPhoneNumbersWithHttpInfo
*
* @param string $phone_country Optional phone country (optional)
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PagePhoneNumberProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getPhoneNumbersWithHttpInfo($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0])
{
$request = $this->getPhoneNumbersRequest($phone_country, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PagePhoneNumberProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PagePhoneNumberProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PagePhoneNumberProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PagePhoneNumberProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PagePhoneNumberProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getPhoneNumbersAsync
*
* @param string $phone_country Optional phone country (optional)
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhoneNumbersAsync($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0])
{
return $this->getPhoneNumbersAsyncWithHttpInfo($phone_country, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getPhoneNumbersAsyncWithHttpInfo
*
* @param string $phone_country Optional phone country (optional)
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhoneNumbersAsyncWithHttpInfo($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0])
{
$returnType = '\MailSlurp\Models\PagePhoneNumberProjection';
$request = $this->getPhoneNumbersRequest($phone_country, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getPhoneNumbers'
*
* @param string $phone_country Optional phone country (optional)
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhoneNumbers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getPhoneNumbersRequest($phone_country = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getPhoneNumbers'][0])
{
$resourcePath = '/phone/numbers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$phone_country,
'phoneCountry', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getPhonePlans
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PhonePlanDto[]
*/
public function getPhonePlans(string $contentType = self::contentTypes['getPhonePlans'][0])
{
list($response) = $this->getPhonePlansWithHttpInfo($contentType);
return $response;
}
/**
* Operation getPhonePlansWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PhonePlanDto[], HTTP status code, HTTP response headers (array of strings)
*/
public function getPhonePlansWithHttpInfo(string $contentType = self::contentTypes['getPhonePlans'][0])
{
$request = $this->getPhonePlansRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PhonePlanDto[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PhonePlanDto[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PhonePlanDto[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PhonePlanDto[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PhonePlanDto[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getPhonePlansAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhonePlansAsync(string $contentType = self::contentTypes['getPhonePlans'][0])
{
return $this->getPhonePlansAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getPhonePlansAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPhonePlansAsyncWithHttpInfo(string $contentType = self::contentTypes['getPhonePlans'][0])
{
$returnType = '\MailSlurp\Models\PhonePlanDto[]';
$request = $this->getPhonePlansRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getPhonePlans'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPhonePlans'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getPhonePlansRequest(string $contentType = self::contentTypes['getPhonePlans'][0])
{
$resourcePath = '/phone/plans';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testPhoneNumberSendSms
*
* @param string $phone_number_id phone_number_id (required)
* @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options test_phone_number_options (required)
* @param string $x_test_id x_test_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function testPhoneNumberSendSms($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0])
{
$this->testPhoneNumberSendSmsWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id, $contentType);
}
/**
* Operation testPhoneNumberSendSmsWithHttpInfo
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required)
* @param string $x_test_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function testPhoneNumberSendSmsWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0])
{
$request = $this->testPhoneNumberSendSmsRequest($phone_number_id, $test_phone_number_options, $x_test_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation testPhoneNumberSendSmsAsync
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required)
* @param string $x_test_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testPhoneNumberSendSmsAsync($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0])
{
return $this->testPhoneNumberSendSmsAsyncWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testPhoneNumberSendSmsAsyncWithHttpInfo
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required)
* @param string $x_test_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testPhoneNumberSendSmsAsyncWithHttpInfo($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0])
{
$returnType = '';
$request = $this->testPhoneNumberSendSmsRequest($phone_number_id, $test_phone_number_options, $x_test_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testPhoneNumberSendSms'
*
* @param string $phone_number_id (required)
* @param \MailSlurp\Models\TestPhoneNumberOptions $test_phone_number_options (required)
* @param string $x_test_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testPhoneNumberSendSms'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testPhoneNumberSendSmsRequest($phone_number_id, $test_phone_number_options, $x_test_id = null, string $contentType = self::contentTypes['testPhoneNumberSendSms'][0])
{
// verify the required parameter 'phone_number_id' is set
if ($phone_number_id === null || (is_array($phone_number_id) && count($phone_number_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $phone_number_id when calling testPhoneNumberSendSms'
);
}
// verify the required parameter 'test_phone_number_options' is set
if ($test_phone_number_options === null || (is_array($test_phone_number_options) && count($test_phone_number_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $test_phone_number_options when calling testPhoneNumberSendSms'
);
}
$resourcePath = '/phone/numbers/{phoneNumberId}/test';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// header params
if ($x_test_id !== null) {
$headerParams['x-test-id'] = ObjectSerializer::toHeaderValue($x_test_id);
}
// path params
if ($phone_number_id !== null) {
$resourcePath = str_replace(
'{' . 'phoneNumberId' . '}',
ObjectSerializer::toPathValue($phone_number_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($test_phone_number_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_phone_number_options));
} else {
$httpBody = $test_phone_number_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* MissedEmailControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* MissedEmailControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class MissedEmailControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'getAllMissedEmails' => [
'application/json',
],
'getAllUnknownMissedEmails' => [
'application/json',
],
'getMissedEmail' => [
'application/json',
],
'restoreMissedEmails' => [
'application/json',
],
'waitForNthMissedEmail' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getAllMissedEmails
*
* Get all MissedEmails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageMissedEmailProjection
*/
public function getAllMissedEmails($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0])
{
list($response) = $this->getAllMissedEmailsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType);
return $response;
}
/**
* Operation getAllMissedEmailsWithHttpInfo
*
* Get all MissedEmails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageMissedEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllMissedEmailsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0])
{
$request = $this->getAllMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageMissedEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageMissedEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageMissedEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageMissedEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageMissedEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllMissedEmailsAsync
*
* Get all MissedEmails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllMissedEmailsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0])
{
return $this->getAllMissedEmailsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllMissedEmailsAsyncWithHttpInfo
*
* Get all MissedEmails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllMissedEmailsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0])
{
$returnType = '\MailSlurp\Models\PageMissedEmailProjection';
$request = $this->getAllMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllMissedEmails'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllMissedEmailsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllMissedEmails'][0])
{
$resourcePath = '/missed-emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllUnknownMissedEmails
*
* Get all unknown missed emails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageUnknownMissedEmailProjection
*/
public function getAllUnknownMissedEmails($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0])
{
list($response) = $this->getAllUnknownMissedEmailsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType);
return $response;
}
/**
* Operation getAllUnknownMissedEmailsWithHttpInfo
*
* Get all unknown missed emails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageUnknownMissedEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllUnknownMissedEmailsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0])
{
$request = $this->getAllUnknownMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageUnknownMissedEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageUnknownMissedEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageUnknownMissedEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageUnknownMissedEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageUnknownMissedEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllUnknownMissedEmailsAsync
*
* Get all unknown missed emails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllUnknownMissedEmailsAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0])
{
return $this->getAllUnknownMissedEmailsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllUnknownMissedEmailsAsyncWithHttpInfo
*
* Get all unknown missed emails in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllUnknownMissedEmailsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0])
{
$returnType = '\MailSlurp\Models\PageUnknownMissedEmailProjection';
$request = $this->getAllUnknownMissedEmailsRequest($page, $size, $sort, $search_filter, $since, $before, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllUnknownMissedEmails'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUnknownMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllUnknownMissedEmailsRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAllUnknownMissedEmails'][0])
{
$resourcePath = '/missed-emails/unknown';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getMissedEmail
*
* Get MissedEmail
*
* @param string $missed_email_id missed_email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\MissedEmailDto
*/
public function getMissedEmail($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0])
{
list($response) = $this->getMissedEmailWithHttpInfo($missed_email_id, $contentType);
return $response;
}
/**
* Operation getMissedEmailWithHttpInfo
*
* Get MissedEmail
*
* @param string $missed_email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\MissedEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getMissedEmailWithHttpInfo($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0])
{
$request = $this->getMissedEmailRequest($missed_email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\MissedEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\MissedEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\MissedEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\MissedEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\MissedEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getMissedEmailAsync
*
* Get MissedEmail
*
* @param string $missed_email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMissedEmailAsync($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0])
{
return $this->getMissedEmailAsyncWithHttpInfo($missed_email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getMissedEmailAsyncWithHttpInfo
*
* Get MissedEmail
*
* @param string $missed_email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMissedEmailAsyncWithHttpInfo($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0])
{
$returnType = '\MailSlurp\Models\MissedEmailDto';
$request = $this->getMissedEmailRequest($missed_email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getMissedEmail'
*
* @param string $missed_email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMissedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getMissedEmailRequest($missed_email_id, string $contentType = self::contentTypes['getMissedEmail'][0])
{
// verify the required parameter 'missed_email_id' is set
if ($missed_email_id === null || (is_array($missed_email_id) && count($missed_email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $missed_email_id when calling getMissedEmail'
);
}
$resourcePath = '/missed-emails/{missedEmailId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($missed_email_id !== null) {
$resourcePath = str_replace(
'{' . 'missedEmailId' . '}',
ObjectSerializer::toPathValue($missed_email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation restoreMissedEmails
*
* Restore missed emails
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function restoreMissedEmails(string $contentType = self::contentTypes['restoreMissedEmails'][0])
{
$this->restoreMissedEmailsWithHttpInfo($contentType);
}
/**
* Operation restoreMissedEmailsWithHttpInfo
*
* Restore missed emails
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function restoreMissedEmailsWithHttpInfo(string $contentType = self::contentTypes['restoreMissedEmails'][0])
{
$request = $this->restoreMissedEmailsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation restoreMissedEmailsAsync
*
* Restore missed emails
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function restoreMissedEmailsAsync(string $contentType = self::contentTypes['restoreMissedEmails'][0])
{
return $this->restoreMissedEmailsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation restoreMissedEmailsAsyncWithHttpInfo
*
* Restore missed emails
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function restoreMissedEmailsAsyncWithHttpInfo(string $contentType = self::contentTypes['restoreMissedEmails'][0])
{
$returnType = '';
$request = $this->restoreMissedEmailsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'restoreMissedEmails'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['restoreMissedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function restoreMissedEmailsRequest(string $contentType = self::contentTypes['restoreMissedEmails'][0])
{
$resourcePath = '/missed-emails/restore';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation waitForNthMissedEmail
*
* Wait for Nth missed email
*
* @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\MissedEmailDto
*/
public function waitForNthMissedEmail($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0])
{
list($response) = $this->waitForNthMissedEmailWithHttpInfo($index, $inbox_id, $timeout, $since, $before, $contentType);
return $response;
}
/**
* Operation waitForNthMissedEmailWithHttpInfo
*
* Wait for Nth missed email
*
* @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\MissedEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function waitForNthMissedEmailWithHttpInfo($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0])
{
$request = $this->waitForNthMissedEmailRequest($index, $inbox_id, $timeout, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\MissedEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\MissedEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\MissedEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\MissedEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\MissedEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation waitForNthMissedEmailAsync
*
* Wait for Nth missed email
*
* @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForNthMissedEmailAsync($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0])
{
return $this->waitForNthMissedEmailAsyncWithHttpInfo($index, $inbox_id, $timeout, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation waitForNthMissedEmailAsyncWithHttpInfo
*
* Wait for Nth missed email
*
* @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function waitForNthMissedEmailAsyncWithHttpInfo($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0])
{
$returnType = '\MailSlurp\Models\MissedEmailDto';
$request = $this->waitForNthMissedEmailRequest($index, $inbox_id, $timeout, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'waitForNthMissedEmail'
*
* @param int $index Zero based index of the email to wait for. If 1 missed email already and you want to wait for the 2nd email pass index=1 (required)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param int $timeout Optional timeout milliseconds (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['waitForNthMissedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function waitForNthMissedEmailRequest($index, $inbox_id = null, $timeout = null, $since = null, $before = null, string $contentType = self::contentTypes['waitForNthMissedEmail'][0])
{
// verify the required parameter 'index' is set
if ($index === null || (is_array($index) && count($index) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $index when calling waitForNthMissedEmail'
);
}
if ($index > 2147483647) {
throw new \InvalidArgumentException('invalid value for "$index" when calling MissedEmailControllerApi.waitForNthMissedEmail, must be smaller than or equal to 2147483647.');
}
if ($index < 0) {
throw new \InvalidArgumentException('invalid value for "$index" when calling MissedEmailControllerApi.waitForNthMissedEmail, must be bigger than or equal to 0.');
}
$resourcePath = '/missed-emails/waitForNthMissedEmail';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout,
'timeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$index,
'index', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* MailServerControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* MailServerControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class MailServerControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'describeMailServerDomain' => [
'application/json',
],
'getDnsLookup' => [
'application/json',
],
'getDnsLookups' => [
'application/json',
],
'getIpAddress' => [
'application/json',
],
'verifyEmailAddress' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation describeMailServerDomain
*
* Get DNS Mail Server records for a domain
*
* @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options describe_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DescribeMailServerDomainResult
*/
public function describeMailServerDomain($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0])
{
list($response) = $this->describeMailServerDomainWithHttpInfo($describe_domain_options, $contentType);
return $response;
}
/**
* Operation describeMailServerDomainWithHttpInfo
*
* Get DNS Mail Server records for a domain
*
* @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DescribeMailServerDomainResult, HTTP status code, HTTP response headers (array of strings)
*/
public function describeMailServerDomainWithHttpInfo($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0])
{
$request = $this->describeMailServerDomainRequest($describe_domain_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DescribeMailServerDomainResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DescribeMailServerDomainResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DescribeMailServerDomainResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DescribeMailServerDomainResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DescribeMailServerDomainResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation describeMailServerDomainAsync
*
* Get DNS Mail Server records for a domain
*
* @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function describeMailServerDomainAsync($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0])
{
return $this->describeMailServerDomainAsyncWithHttpInfo($describe_domain_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation describeMailServerDomainAsyncWithHttpInfo
*
* Get DNS Mail Server records for a domain
*
* @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function describeMailServerDomainAsyncWithHttpInfo($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0])
{
$returnType = '\MailSlurp\Models\DescribeMailServerDomainResult';
$request = $this->describeMailServerDomainRequest($describe_domain_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'describeMailServerDomain'
*
* @param \MailSlurp\Models\DescribeDomainOptions $describe_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['describeMailServerDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function describeMailServerDomainRequest($describe_domain_options, string $contentType = self::contentTypes['describeMailServerDomain'][0])
{
// verify the required parameter 'describe_domain_options' is set
if ($describe_domain_options === null || (is_array($describe_domain_options) && count($describe_domain_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $describe_domain_options when calling describeMailServerDomain'
);
}
$resourcePath = '/mail-server/describe/domain';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($describe_domain_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($describe_domain_options));
} else {
$httpBody = $describe_domain_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getDnsLookup
*
* Lookup DNS records for a domain
*
* @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options dns_lookup_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DNSLookupResults
*/
public function getDnsLookup($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0])
{
list($response) = $this->getDnsLookupWithHttpInfo($dns_lookup_options, $contentType);
return $response;
}
/**
* Operation getDnsLookupWithHttpInfo
*
* Lookup DNS records for a domain
*
* @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DNSLookupResults, HTTP status code, HTTP response headers (array of strings)
*/
public function getDnsLookupWithHttpInfo($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0])
{
$request = $this->getDnsLookupRequest($dns_lookup_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DNSLookupResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DNSLookupResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DNSLookupResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DNSLookupResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DNSLookupResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getDnsLookupAsync
*
* Lookup DNS records for a domain
*
* @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDnsLookupAsync($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0])
{
return $this->getDnsLookupAsyncWithHttpInfo($dns_lookup_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDnsLookupAsyncWithHttpInfo
*
* Lookup DNS records for a domain
*
* @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDnsLookupAsyncWithHttpInfo($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0])
{
$returnType = '\MailSlurp\Models\DNSLookupResults';
$request = $this->getDnsLookupRequest($dns_lookup_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getDnsLookup'
*
* @param \MailSlurp\Models\DNSLookupOptions $dns_lookup_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getDnsLookupRequest($dns_lookup_options, string $contentType = self::contentTypes['getDnsLookup'][0])
{
// verify the required parameter 'dns_lookup_options' is set
if ($dns_lookup_options === null || (is_array($dns_lookup_options) && count($dns_lookup_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $dns_lookup_options when calling getDnsLookup'
);
}
$resourcePath = '/mail-server/describe/dns-lookup';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($dns_lookup_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($dns_lookup_options));
} else {
$httpBody = $dns_lookup_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getDnsLookups
*
* Lookup DNS records for multiple domains
*
* @param \MailSlurp\Models\DNSLookupsOptions $dns_lookups_options dns_lookups_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookups'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DNSLookupResults
*/
public function getDnsLookups($dns_lookups_options, string $contentType = self::contentTypes['getDnsLookups'][0])
{
list($response) = $this->getDnsLookupsWithHttpInfo($dns_lookups_options, $contentType);
return $response;
}
/**
* Operation getDnsLookupsWithHttpInfo
*
* Lookup DNS records for multiple domains
*
* @param \MailSlurp\Models\DNSLookupsOptions $dns_lookups_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookups'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DNSLookupResults, HTTP status code, HTTP response headers (array of strings)
*/
public function getDnsLookupsWithHttpInfo($dns_lookups_options, string $contentType = self::contentTypes['getDnsLookups'][0])
{
$request = $this->getDnsLookupsRequest($dns_lookups_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DNSLookupResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DNSLookupResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DNSLookupResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DNSLookupResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DNSLookupResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getDnsLookupsAsync
*
* Lookup DNS records for multiple domains
*
* @param \MailSlurp\Models\DNSLookupsOptions $dns_lookups_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDnsLookupsAsync($dns_lookups_options, string $contentType = self::contentTypes['getDnsLookups'][0])
{
return $this->getDnsLookupsAsyncWithHttpInfo($dns_lookups_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDnsLookupsAsyncWithHttpInfo
*
* Lookup DNS records for multiple domains
*
* @param \MailSlurp\Models\DNSLookupsOptions $dns_lookups_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDnsLookupsAsyncWithHttpInfo($dns_lookups_options, string $contentType = self::contentTypes['getDnsLookups'][0])
{
$returnType = '\MailSlurp\Models\DNSLookupResults';
$request = $this->getDnsLookupsRequest($dns_lookups_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getDnsLookups'
*
* @param \MailSlurp\Models\DNSLookupsOptions $dns_lookups_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDnsLookups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getDnsLookupsRequest($dns_lookups_options, string $contentType = self::contentTypes['getDnsLookups'][0])
{
// verify the required parameter 'dns_lookups_options' is set
if ($dns_lookups_options === null || (is_array($dns_lookups_options) && count($dns_lookups_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $dns_lookups_options when calling getDnsLookups'
);
}
$resourcePath = '/mail-server/describe/dns-lookups';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($dns_lookups_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($dns_lookups_options));
} else {
$httpBody = $dns_lookups_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getIpAddress
*
* Get IP address for a domain
*
* @param string $name name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\IPAddressResult
*/
public function getIpAddress($name, string $contentType = self::contentTypes['getIpAddress'][0])
{
list($response) = $this->getIpAddressWithHttpInfo($name, $contentType);
return $response;
}
/**
* Operation getIpAddressWithHttpInfo
*
* Get IP address for a domain
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\IPAddressResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getIpAddressWithHttpInfo($name, string $contentType = self::contentTypes['getIpAddress'][0])
{
$request = $this->getIpAddressRequest($name, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\IPAddressResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\IPAddressResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\IPAddressResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\IPAddressResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\IPAddressResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getIpAddressAsync
*
* Get IP address for a domain
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getIpAddressAsync($name, string $contentType = self::contentTypes['getIpAddress'][0])
{
return $this->getIpAddressAsyncWithHttpInfo($name, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getIpAddressAsyncWithHttpInfo
*
* Get IP address for a domain
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getIpAddressAsyncWithHttpInfo($name, string $contentType = self::contentTypes['getIpAddress'][0])
{
$returnType = '\MailSlurp\Models\IPAddressResult';
$request = $this->getIpAddressRequest($name, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getIpAddress'
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getIpAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getIpAddressRequest($name, string $contentType = self::contentTypes['getIpAddress'][0])
{
// verify the required parameter 'name' is set
if ($name === null || (is_array($name) && count($name) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $name when calling getIpAddress'
);
}
$resourcePath = '/mail-server/describe/ip-address';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$name,
'name', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation verifyEmailAddress
*
* Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server.
*
* @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options verify_email_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailVerificationResult
* @deprecated
*/
public function verifyEmailAddress($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0])
{
list($response) = $this->verifyEmailAddressWithHttpInfo($verify_email_address_options, $contentType);
return $response;
}
/**
* Operation verifyEmailAddressWithHttpInfo
*
* Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server.
*
* @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailVerificationResult, HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function verifyEmailAddressWithHttpInfo($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0])
{
$request = $this->verifyEmailAddressRequest($verify_email_address_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailVerificationResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailVerificationResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailVerificationResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailVerificationResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailVerificationResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation verifyEmailAddressAsync
*
* Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server.
*
* @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function verifyEmailAddressAsync($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0])
{
return $this->verifyEmailAddressAsyncWithHttpInfo($verify_email_address_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation verifyEmailAddressAsyncWithHttpInfo
*
* Deprecated. Use the EmailVerificationController methods for more accurate and reliable functionality. Verify the existence of an email address at a given mail server.
*
* @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function verifyEmailAddressAsyncWithHttpInfo($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0])
{
$returnType = '\MailSlurp\Models\EmailVerificationResult';
$request = $this->verifyEmailAddressRequest($verify_email_address_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'verifyEmailAddress'
*
* @param \MailSlurp\Models\VerifyEmailAddressOptions $verify_email_address_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function verifyEmailAddressRequest($verify_email_address_options, string $contentType = self::contentTypes['verifyEmailAddress'][0])
{
// verify the required parameter 'verify_email_address_options' is set
if ($verify_email_address_options === null || (is_array($verify_email_address_options) && count($verify_email_address_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $verify_email_address_options when calling verifyEmailAddress'
);
}
$resourcePath = '/mail-server/verify/email-address';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($verify_email_address_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($verify_email_address_options));
} else {
$httpBody = $verify_email_address_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* InboxRulesetControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* InboxRulesetControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class InboxRulesetControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createNewInboxRuleset' => [
'application/json',
],
'deleteInboxRuleset' => [
'application/json',
],
'deleteInboxRulesets' => [
'application/json',
],
'getInboxRuleset' => [
'application/json',
],
'getInboxRulesets' => [
'application/json',
],
'testInboxRuleset' => [
'application/json',
],
'testInboxRulesetReceiving' => [
'application/json',
],
'testInboxRulesetSending' => [
'application/json',
],
'testInboxRulesetsForInbox' => [
'application/json',
],
'testNewInboxRuleset' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createNewInboxRuleset
*
* Create an inbox ruleset
*
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options create_inbox_ruleset_options (required)
* @param string $inbox_id Inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxRulesetDto
*/
public function createNewInboxRuleset($create_inbox_ruleset_options, $inbox_id = null, string $contentType = self::contentTypes['createNewInboxRuleset'][0])
{
list($response) = $this->createNewInboxRulesetWithHttpInfo($create_inbox_ruleset_options, $inbox_id, $contentType);
return $response;
}
/**
* Operation createNewInboxRulesetWithHttpInfo
*
* Create an inbox ruleset
*
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $inbox_id Inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxRulesetDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createNewInboxRulesetWithHttpInfo($create_inbox_ruleset_options, $inbox_id = null, string $contentType = self::contentTypes['createNewInboxRuleset'][0])
{
$request = $this->createNewInboxRulesetRequest($create_inbox_ruleset_options, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxRulesetDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxRulesetDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxRulesetDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxRulesetDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createNewInboxRulesetAsync
*
* Create an inbox ruleset
*
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $inbox_id Inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewInboxRulesetAsync($create_inbox_ruleset_options, $inbox_id = null, string $contentType = self::contentTypes['createNewInboxRuleset'][0])
{
return $this->createNewInboxRulesetAsyncWithHttpInfo($create_inbox_ruleset_options, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createNewInboxRulesetAsyncWithHttpInfo
*
* Create an inbox ruleset
*
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $inbox_id Inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewInboxRulesetAsyncWithHttpInfo($create_inbox_ruleset_options, $inbox_id = null, string $contentType = self::contentTypes['createNewInboxRuleset'][0])
{
$returnType = '\MailSlurp\Models\InboxRulesetDto';
$request = $this->createNewInboxRulesetRequest($create_inbox_ruleset_options, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createNewInboxRuleset'
*
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $inbox_id Inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createNewInboxRulesetRequest($create_inbox_ruleset_options, $inbox_id = null, string $contentType = self::contentTypes['createNewInboxRuleset'][0])
{
// verify the required parameter 'create_inbox_ruleset_options' is set
if ($create_inbox_ruleset_options === null || (is_array($create_inbox_ruleset_options) && count($create_inbox_ruleset_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_inbox_ruleset_options when calling createNewInboxRuleset'
);
}
$resourcePath = '/rulesets';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_inbox_ruleset_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_ruleset_options));
} else {
$httpBody = $create_inbox_ruleset_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteInboxRuleset
*
* Delete an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteInboxRuleset($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0])
{
$this->deleteInboxRulesetWithHttpInfo($id, $contentType);
}
/**
* Operation deleteInboxRulesetWithHttpInfo
*
* Delete an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteInboxRulesetWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0])
{
$request = $this->deleteInboxRulesetRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteInboxRulesetAsync
*
* Delete an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxRulesetAsync($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0])
{
return $this->deleteInboxRulesetAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteInboxRulesetAsyncWithHttpInfo
*
* Delete an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxRulesetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0])
{
$returnType = '';
$request = $this->deleteInboxRulesetRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteInboxRuleset'
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteInboxRulesetRequest($id, string $contentType = self::contentTypes['deleteInboxRuleset'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteInboxRuleset'
);
}
$resourcePath = '/rulesets/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteInboxRulesets
*
* Delete inbox rulesets
*
* @param string $inbox_id Optional inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteInboxRulesets($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0])
{
$this->deleteInboxRulesetsWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation deleteInboxRulesetsWithHttpInfo
*
* Delete inbox rulesets
*
* @param string $inbox_id Optional inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteInboxRulesetsWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0])
{
$request = $this->deleteInboxRulesetsRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteInboxRulesetsAsync
*
* Delete inbox rulesets
*
* @param string $inbox_id Optional inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxRulesetsAsync($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0])
{
return $this->deleteInboxRulesetsAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteInboxRulesetsAsyncWithHttpInfo
*
* Delete inbox rulesets
*
* @param string $inbox_id Optional inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxRulesetsAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0])
{
$returnType = '';
$request = $this->deleteInboxRulesetsRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteInboxRulesets'
*
* @param string $inbox_id Optional inbox id to attach ruleset to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteInboxRulesetsRequest($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRulesets'][0])
{
$resourcePath = '/rulesets';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxRuleset
*
* Get an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxRulesetDto
*/
public function getInboxRuleset($id, string $contentType = self::contentTypes['getInboxRuleset'][0])
{
list($response) = $this->getInboxRulesetWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getInboxRulesetWithHttpInfo
*
* Get an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxRulesetDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxRulesetWithHttpInfo($id, string $contentType = self::contentTypes['getInboxRuleset'][0])
{
$request = $this->getInboxRulesetRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxRulesetDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxRulesetDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxRulesetDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxRulesetDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxRulesetAsync
*
* Get an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxRulesetAsync($id, string $contentType = self::contentTypes['getInboxRuleset'][0])
{
return $this->getInboxRulesetAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxRulesetAsyncWithHttpInfo
*
* Get an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxRulesetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getInboxRuleset'][0])
{
$returnType = '\MailSlurp\Models\InboxRulesetDto';
$request = $this->getInboxRulesetRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxRuleset'
*
* @param string $id ID of inbox ruleset (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxRulesetRequest($id, string $contentType = self::contentTypes['getInboxRuleset'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getInboxRuleset'
);
}
$resourcePath = '/rulesets/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxRulesets
*
* List inbox rulesets
*
* @param string $inbox_id Optional inbox id to get rulesets from (optional)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxRulesetDto
*/
public function getInboxRulesets($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0])
{
list($response) = $this->getInboxRulesetsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getInboxRulesetsWithHttpInfo
*
* List inbox rulesets
*
* @param string $inbox_id Optional inbox id to get rulesets from (optional)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxRulesetDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxRulesetsWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0])
{
$request = $this->getInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxRulesetDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxRulesetDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxRulesetDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxRulesetDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxRulesetDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxRulesetsAsync
*
* List inbox rulesets
*
* @param string $inbox_id Optional inbox id to get rulesets from (optional)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxRulesetsAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0])
{
return $this->getInboxRulesetsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxRulesetsAsyncWithHttpInfo
*
* List inbox rulesets
*
* @param string $inbox_id Optional inbox id to get rulesets from (optional)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxRulesetsAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0])
{
$returnType = '\MailSlurp\Models\PageInboxRulesetDto';
$request = $this->getInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxRulesets'
*
* @param string $inbox_id Optional inbox id to get rulesets from (optional)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxRulesetsRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxRulesets'][0])
{
$resourcePath = '/rulesets';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testInboxRuleset
*
* Test an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxRulesetTestResult
*/
public function testInboxRuleset($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0])
{
list($response) = $this->testInboxRulesetWithHttpInfo($id, $inbox_ruleset_test_options, $contentType);
return $response;
}
/**
* Operation testInboxRulesetWithHttpInfo
*
* Test an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxRulesetTestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testInboxRulesetWithHttpInfo($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0])
{
$request = $this->testInboxRulesetRequest($id, $inbox_ruleset_test_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxRulesetTestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxRulesetTestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetTestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxRulesetTestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxRulesetTestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testInboxRulesetAsync
*
* Test an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetAsync($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0])
{
return $this->testInboxRulesetAsyncWithHttpInfo($id, $inbox_ruleset_test_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testInboxRulesetAsyncWithHttpInfo
*
* Test an inbox ruleset
*
* @param string $id ID of inbox ruleset (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetAsyncWithHttpInfo($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0])
{
$returnType = '\MailSlurp\Models\InboxRulesetTestResult';
$request = $this->testInboxRulesetRequest($id, $inbox_ruleset_test_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testInboxRuleset'
*
* @param string $id ID of inbox ruleset (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testInboxRulesetRequest($id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRuleset'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling testInboxRuleset'
);
}
// verify the required parameter 'inbox_ruleset_test_options' is set
if ($inbox_ruleset_test_options === null || (is_array($inbox_ruleset_test_options) && count($inbox_ruleset_test_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_ruleset_test_options when calling testInboxRuleset'
);
}
$resourcePath = '/rulesets/{id}/test';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($inbox_ruleset_test_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_ruleset_test_options));
} else {
$httpBody = $inbox_ruleset_test_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testInboxRulesetReceiving
*
* Test receiving with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetReceivingOptions $test_inbox_ruleset_receiving_options test_inbox_ruleset_receiving_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetReceiving'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TestInboxRulesetReceivingResult
*/
public function testInboxRulesetReceiving($test_inbox_ruleset_receiving_options, string $contentType = self::contentTypes['testInboxRulesetReceiving'][0])
{
list($response) = $this->testInboxRulesetReceivingWithHttpInfo($test_inbox_ruleset_receiving_options, $contentType);
return $response;
}
/**
* Operation testInboxRulesetReceivingWithHttpInfo
*
* Test receiving with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetReceivingOptions $test_inbox_ruleset_receiving_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetReceiving'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TestInboxRulesetReceivingResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testInboxRulesetReceivingWithHttpInfo($test_inbox_ruleset_receiving_options, string $contentType = self::contentTypes['testInboxRulesetReceiving'][0])
{
$request = $this->testInboxRulesetReceivingRequest($test_inbox_ruleset_receiving_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\TestInboxRulesetReceivingResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TestInboxRulesetReceivingResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TestInboxRulesetReceivingResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TestInboxRulesetReceivingResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TestInboxRulesetReceivingResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testInboxRulesetReceivingAsync
*
* Test receiving with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetReceivingOptions $test_inbox_ruleset_receiving_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetReceiving'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetReceivingAsync($test_inbox_ruleset_receiving_options, string $contentType = self::contentTypes['testInboxRulesetReceiving'][0])
{
return $this->testInboxRulesetReceivingAsyncWithHttpInfo($test_inbox_ruleset_receiving_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testInboxRulesetReceivingAsyncWithHttpInfo
*
* Test receiving with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetReceivingOptions $test_inbox_ruleset_receiving_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetReceiving'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetReceivingAsyncWithHttpInfo($test_inbox_ruleset_receiving_options, string $contentType = self::contentTypes['testInboxRulesetReceiving'][0])
{
$returnType = '\MailSlurp\Models\TestInboxRulesetReceivingResult';
$request = $this->testInboxRulesetReceivingRequest($test_inbox_ruleset_receiving_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testInboxRulesetReceiving'
*
* @param \MailSlurp\Models\TestInboxRulesetReceivingOptions $test_inbox_ruleset_receiving_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetReceiving'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testInboxRulesetReceivingRequest($test_inbox_ruleset_receiving_options, string $contentType = self::contentTypes['testInboxRulesetReceiving'][0])
{
// verify the required parameter 'test_inbox_ruleset_receiving_options' is set
if ($test_inbox_ruleset_receiving_options === null || (is_array($test_inbox_ruleset_receiving_options) && count($test_inbox_ruleset_receiving_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $test_inbox_ruleset_receiving_options when calling testInboxRulesetReceiving'
);
}
$resourcePath = '/rulesets/test-receiving';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($test_inbox_ruleset_receiving_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_inbox_ruleset_receiving_options));
} else {
$httpBody = $test_inbox_ruleset_receiving_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testInboxRulesetSending
*
* Test sending with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetSendingOptions $test_inbox_ruleset_sending_options test_inbox_ruleset_sending_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetSending'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\TestInboxRulesetSendingResult
*/
public function testInboxRulesetSending($test_inbox_ruleset_sending_options, string $contentType = self::contentTypes['testInboxRulesetSending'][0])
{
list($response) = $this->testInboxRulesetSendingWithHttpInfo($test_inbox_ruleset_sending_options, $contentType);
return $response;
}
/**
* Operation testInboxRulesetSendingWithHttpInfo
*
* Test sending with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetSendingOptions $test_inbox_ruleset_sending_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetSending'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\TestInboxRulesetSendingResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testInboxRulesetSendingWithHttpInfo($test_inbox_ruleset_sending_options, string $contentType = self::contentTypes['testInboxRulesetSending'][0])
{
$request = $this->testInboxRulesetSendingRequest($test_inbox_ruleset_sending_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\TestInboxRulesetSendingResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\TestInboxRulesetSendingResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\TestInboxRulesetSendingResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\TestInboxRulesetSendingResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\TestInboxRulesetSendingResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testInboxRulesetSendingAsync
*
* Test sending with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetSendingOptions $test_inbox_ruleset_sending_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetSending'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetSendingAsync($test_inbox_ruleset_sending_options, string $contentType = self::contentTypes['testInboxRulesetSending'][0])
{
return $this->testInboxRulesetSendingAsyncWithHttpInfo($test_inbox_ruleset_sending_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testInboxRulesetSendingAsyncWithHttpInfo
*
* Test sending with inbox rulesets
*
* @param \MailSlurp\Models\TestInboxRulesetSendingOptions $test_inbox_ruleset_sending_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetSending'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetSendingAsyncWithHttpInfo($test_inbox_ruleset_sending_options, string $contentType = self::contentTypes['testInboxRulesetSending'][0])
{
$returnType = '\MailSlurp\Models\TestInboxRulesetSendingResult';
$request = $this->testInboxRulesetSendingRequest($test_inbox_ruleset_sending_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testInboxRulesetSending'
*
* @param \MailSlurp\Models\TestInboxRulesetSendingOptions $test_inbox_ruleset_sending_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetSending'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testInboxRulesetSendingRequest($test_inbox_ruleset_sending_options, string $contentType = self::contentTypes['testInboxRulesetSending'][0])
{
// verify the required parameter 'test_inbox_ruleset_sending_options' is set
if ($test_inbox_ruleset_sending_options === null || (is_array($test_inbox_ruleset_sending_options) && count($test_inbox_ruleset_sending_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $test_inbox_ruleset_sending_options when calling testInboxRulesetSending'
);
}
$resourcePath = '/rulesets/test-sending';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($test_inbox_ruleset_sending_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_inbox_ruleset_sending_options));
} else {
$httpBody = $test_inbox_ruleset_sending_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testInboxRulesetsForInbox
*
* Test inbox rulesets for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxRulesetTestResult
*/
public function testInboxRulesetsForInbox($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0])
{
list($response) = $this->testInboxRulesetsForInboxWithHttpInfo($inbox_id, $inbox_ruleset_test_options, $contentType);
return $response;
}
/**
* Operation testInboxRulesetsForInboxWithHttpInfo
*
* Test inbox rulesets for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxRulesetTestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testInboxRulesetsForInboxWithHttpInfo($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0])
{
$request = $this->testInboxRulesetsForInboxRequest($inbox_id, $inbox_ruleset_test_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxRulesetTestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxRulesetTestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetTestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxRulesetTestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxRulesetTestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testInboxRulesetsForInboxAsync
*
* Test inbox rulesets for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetsForInboxAsync($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0])
{
return $this->testInboxRulesetsForInboxAsyncWithHttpInfo($inbox_id, $inbox_ruleset_test_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testInboxRulesetsForInboxAsyncWithHttpInfo
*
* Test inbox rulesets for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxRulesetsForInboxAsyncWithHttpInfo($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0])
{
$returnType = '\MailSlurp\Models\InboxRulesetTestResult';
$request = $this->testInboxRulesetsForInboxRequest($inbox_id, $inbox_ruleset_test_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testInboxRulesetsForInbox'
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxRulesetsForInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testInboxRulesetsForInboxRequest($inbox_id, $inbox_ruleset_test_options, string $contentType = self::contentTypes['testInboxRulesetsForInbox'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling testInboxRulesetsForInbox'
);
}
// verify the required parameter 'inbox_ruleset_test_options' is set
if ($inbox_ruleset_test_options === null || (is_array($inbox_ruleset_test_options) && count($inbox_ruleset_test_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_ruleset_test_options when calling testInboxRulesetsForInbox'
);
}
$resourcePath = '/rulesets';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($inbox_ruleset_test_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_ruleset_test_options));
} else {
$httpBody = $inbox_ruleset_test_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testNewInboxRuleset
*
* Test new inbox ruleset
*
* @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options test_new_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxRulesetTestResult
*/
public function testNewInboxRuleset($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0])
{
list($response) = $this->testNewInboxRulesetWithHttpInfo($test_new_inbox_ruleset_options, $contentType);
return $response;
}
/**
* Operation testNewInboxRulesetWithHttpInfo
*
* Test new inbox ruleset
*
* @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxRulesetTestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testNewInboxRulesetWithHttpInfo($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0])
{
$request = $this->testNewInboxRulesetRequest($test_new_inbox_ruleset_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxRulesetTestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxRulesetTestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetTestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxRulesetTestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxRulesetTestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testNewInboxRulesetAsync
*
* Test new inbox ruleset
*
* @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testNewInboxRulesetAsync($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0])
{
return $this->testNewInboxRulesetAsyncWithHttpInfo($test_new_inbox_ruleset_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testNewInboxRulesetAsyncWithHttpInfo
*
* Test new inbox ruleset
*
* @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testNewInboxRulesetAsyncWithHttpInfo($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0])
{
$returnType = '\MailSlurp\Models\InboxRulesetTestResult';
$request = $this->testNewInboxRulesetRequest($test_new_inbox_ruleset_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testNewInboxRuleset'
*
* @param \MailSlurp\Models\TestNewInboxRulesetOptions $test_new_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testNewInboxRulesetRequest($test_new_inbox_ruleset_options, string $contentType = self::contentTypes['testNewInboxRuleset'][0])
{
// verify the required parameter 'test_new_inbox_ruleset_options' is set
if ($test_new_inbox_ruleset_options === null || (is_array($test_new_inbox_ruleset_options) && count($test_new_inbox_ruleset_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $test_new_inbox_ruleset_options when calling testNewInboxRuleset'
);
}
$resourcePath = '/rulesets';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($test_new_inbox_ruleset_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_new_inbox_ruleset_options));
} else {
$httpBody = $test_new_inbox_ruleset_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* InboxReplierControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* InboxReplierControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class InboxReplierControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createNewInboxReplier' => [
'application/json',
],
'deleteInboxReplier' => [
'application/json',
],
'deleteInboxRepliers' => [
'application/json',
],
'getInboxReplier' => [
'application/json',
],
'getInboxReplierEvents' => [
'application/json',
],
'getInboxRepliers' => [
'application/json',
],
'updateInboxReplier' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createNewInboxReplier
*
* Create an inbox replier
*
* @param \MailSlurp\Models\CreateInboxReplierOptions $create_inbox_replier_options create_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxReplierDto
*/
public function createNewInboxReplier($create_inbox_replier_options, string $contentType = self::contentTypes['createNewInboxReplier'][0])
{
list($response) = $this->createNewInboxReplierWithHttpInfo($create_inbox_replier_options, $contentType);
return $response;
}
/**
* Operation createNewInboxReplierWithHttpInfo
*
* Create an inbox replier
*
* @param \MailSlurp\Models\CreateInboxReplierOptions $create_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxReplierDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createNewInboxReplierWithHttpInfo($create_inbox_replier_options, string $contentType = self::contentTypes['createNewInboxReplier'][0])
{
$request = $this->createNewInboxReplierRequest($create_inbox_replier_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxReplierDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxReplierDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxReplierDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxReplierDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxReplierDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createNewInboxReplierAsync
*
* Create an inbox replier
*
* @param \MailSlurp\Models\CreateInboxReplierOptions $create_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewInboxReplierAsync($create_inbox_replier_options, string $contentType = self::contentTypes['createNewInboxReplier'][0])
{
return $this->createNewInboxReplierAsyncWithHttpInfo($create_inbox_replier_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createNewInboxReplierAsyncWithHttpInfo
*
* Create an inbox replier
*
* @param \MailSlurp\Models\CreateInboxReplierOptions $create_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewInboxReplierAsyncWithHttpInfo($create_inbox_replier_options, string $contentType = self::contentTypes['createNewInboxReplier'][0])
{
$returnType = '\MailSlurp\Models\InboxReplierDto';
$request = $this->createNewInboxReplierRequest($create_inbox_replier_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createNewInboxReplier'
*
* @param \MailSlurp\Models\CreateInboxReplierOptions $create_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createNewInboxReplierRequest($create_inbox_replier_options, string $contentType = self::contentTypes['createNewInboxReplier'][0])
{
// verify the required parameter 'create_inbox_replier_options' is set
if ($create_inbox_replier_options === null || (is_array($create_inbox_replier_options) && count($create_inbox_replier_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_inbox_replier_options when calling createNewInboxReplier'
);
}
$resourcePath = '/repliers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_inbox_replier_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_replier_options));
} else {
$httpBody = $create_inbox_replier_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteInboxReplier
*
* Delete an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteInboxReplier($id, string $contentType = self::contentTypes['deleteInboxReplier'][0])
{
$this->deleteInboxReplierWithHttpInfo($id, $contentType);
}
/**
* Operation deleteInboxReplierWithHttpInfo
*
* Delete an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteInboxReplierWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxReplier'][0])
{
$request = $this->deleteInboxReplierRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteInboxReplierAsync
*
* Delete an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxReplierAsync($id, string $contentType = self::contentTypes['deleteInboxReplier'][0])
{
return $this->deleteInboxReplierAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteInboxReplierAsyncWithHttpInfo
*
* Delete an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxReplierAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxReplier'][0])
{
$returnType = '';
$request = $this->deleteInboxReplierRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteInboxReplier'
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteInboxReplierRequest($id, string $contentType = self::contentTypes['deleteInboxReplier'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteInboxReplier'
);
}
$resourcePath = '/repliers/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteInboxRepliers
*
* Delete inbox repliers
*
* @param string $inbox_id Optional inbox id to attach replier to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRepliers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteInboxRepliers($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRepliers'][0])
{
$this->deleteInboxRepliersWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation deleteInboxRepliersWithHttpInfo
*
* Delete inbox repliers
*
* @param string $inbox_id Optional inbox id to attach replier to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRepliers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteInboxRepliersWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRepliers'][0])
{
$request = $this->deleteInboxRepliersRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteInboxRepliersAsync
*
* Delete inbox repliers
*
* @param string $inbox_id Optional inbox id to attach replier to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRepliers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxRepliersAsync($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRepliers'][0])
{
return $this->deleteInboxRepliersAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteInboxRepliersAsyncWithHttpInfo
*
* Delete inbox repliers
*
* @param string $inbox_id Optional inbox id to attach replier to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRepliers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxRepliersAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRepliers'][0])
{
$returnType = '';
$request = $this->deleteInboxRepliersRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteInboxRepliers'
*
* @param string $inbox_id Optional inbox id to attach replier to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxRepliers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteInboxRepliersRequest($inbox_id = null, string $contentType = self::contentTypes['deleteInboxRepliers'][0])
{
$resourcePath = '/repliers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxReplier
*
* Get an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxReplierDto
*/
public function getInboxReplier($id, string $contentType = self::contentTypes['getInboxReplier'][0])
{
list($response) = $this->getInboxReplierWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getInboxReplierWithHttpInfo
*
* Get an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxReplierDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxReplierWithHttpInfo($id, string $contentType = self::contentTypes['getInboxReplier'][0])
{
$request = $this->getInboxReplierRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxReplierDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxReplierDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxReplierDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxReplierDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxReplierDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxReplierAsync
*
* Get an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxReplierAsync($id, string $contentType = self::contentTypes['getInboxReplier'][0])
{
return $this->getInboxReplierAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxReplierAsyncWithHttpInfo
*
* Get an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxReplierAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getInboxReplier'][0])
{
$returnType = '\MailSlurp\Models\InboxReplierDto';
$request = $this->getInboxReplierRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxReplier'
*
* @param string $id ID of inbox replier (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxReplierRequest($id, string $contentType = self::contentTypes['getInboxReplier'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getInboxReplier'
);
}
$resourcePath = '/repliers/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxReplierEvents
*
* Get an inbox replier event list
*
* @param string $id ID of inbox replier (required)
* @param int $page Optional page index in inbox replier event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplierEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxReplierEvents
*/
public function getInboxReplierEvents($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxReplierEvents'][0])
{
list($response) = $this->getInboxReplierEventsWithHttpInfo($id, $page, $size, $sort, $contentType);
return $response;
}
/**
* Operation getInboxReplierEventsWithHttpInfo
*
* Get an inbox replier event list
*
* @param string $id ID of inbox replier (required)
* @param int $page Optional page index in inbox replier event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplierEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxReplierEvents, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxReplierEventsWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxReplierEvents'][0])
{
$request = $this->getInboxReplierEventsRequest($id, $page, $size, $sort, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxReplierEvents' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxReplierEvents' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxReplierEvents', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxReplierEvents';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxReplierEvents',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxReplierEventsAsync
*
* Get an inbox replier event list
*
* @param string $id ID of inbox replier (required)
* @param int $page Optional page index in inbox replier event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplierEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxReplierEventsAsync($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxReplierEvents'][0])
{
return $this->getInboxReplierEventsAsyncWithHttpInfo($id, $page, $size, $sort, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxReplierEventsAsyncWithHttpInfo
*
* Get an inbox replier event list
*
* @param string $id ID of inbox replier (required)
* @param int $page Optional page index in inbox replier event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplierEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxReplierEventsAsyncWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxReplierEvents'][0])
{
$returnType = '\MailSlurp\Models\PageInboxReplierEvents';
$request = $this->getInboxReplierEventsRequest($id, $page, $size, $sort, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxReplierEvents'
*
* @param string $id ID of inbox replier (required)
* @param int $page Optional page index in inbox replier event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxReplierEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxReplierEventsRequest($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxReplierEvents'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getInboxReplierEvents'
);
}
$resourcePath = '/repliers/{id}/events';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxRepliers
*
* List inbox repliers
*
* @param string $inbox_id Optional inbox id to get repliers from (optional)
* @param int $page Optional page index in inbox replier list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRepliers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxReplierDto
*/
public function getInboxRepliers($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxRepliers'][0])
{
list($response) = $this->getInboxRepliersWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getInboxRepliersWithHttpInfo
*
* List inbox repliers
*
* @param string $inbox_id Optional inbox id to get repliers from (optional)
* @param int $page Optional page index in inbox replier list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRepliers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxReplierDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxRepliersWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxRepliers'][0])
{
$request = $this->getInboxRepliersRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxReplierDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxReplierDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxReplierDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxReplierDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxReplierDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxRepliersAsync
*
* List inbox repliers
*
* @param string $inbox_id Optional inbox id to get repliers from (optional)
* @param int $page Optional page index in inbox replier list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRepliers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxRepliersAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxRepliers'][0])
{
return $this->getInboxRepliersAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxRepliersAsyncWithHttpInfo
*
* List inbox repliers
*
* @param string $inbox_id Optional inbox id to get repliers from (optional)
* @param int $page Optional page index in inbox replier list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRepliers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxRepliersAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxRepliers'][0])
{
$returnType = '\MailSlurp\Models\PageInboxReplierDto';
$request = $this->getInboxRepliersRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxRepliers'
*
* @param string $inbox_id Optional inbox id to get repliers from (optional)
* @param int $page Optional page index in inbox replier list pagination (optional, default to 0)
* @param int $size Optional page size in inbox replier list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxRepliers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxRepliersRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxRepliers'][0])
{
$resourcePath = '/repliers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateInboxReplier
*
* Update an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param \MailSlurp\Models\UpdateInboxReplierOptions $update_inbox_replier_options update_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxReplierDto
*/
public function updateInboxReplier($id, $update_inbox_replier_options, string $contentType = self::contentTypes['updateInboxReplier'][0])
{
list($response) = $this->updateInboxReplierWithHttpInfo($id, $update_inbox_replier_options, $contentType);
return $response;
}
/**
* Operation updateInboxReplierWithHttpInfo
*
* Update an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param \MailSlurp\Models\UpdateInboxReplierOptions $update_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxReplier'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxReplierDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateInboxReplierWithHttpInfo($id, $update_inbox_replier_options, string $contentType = self::contentTypes['updateInboxReplier'][0])
{
$request = $this->updateInboxReplierRequest($id, $update_inbox_replier_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxReplierDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxReplierDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxReplierDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxReplierDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxReplierDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateInboxReplierAsync
*
* Update an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param \MailSlurp\Models\UpdateInboxReplierOptions $update_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateInboxReplierAsync($id, $update_inbox_replier_options, string $contentType = self::contentTypes['updateInboxReplier'][0])
{
return $this->updateInboxReplierAsyncWithHttpInfo($id, $update_inbox_replier_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateInboxReplierAsyncWithHttpInfo
*
* Update an inbox replier
*
* @param string $id ID of inbox replier (required)
* @param \MailSlurp\Models\UpdateInboxReplierOptions $update_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateInboxReplierAsyncWithHttpInfo($id, $update_inbox_replier_options, string $contentType = self::contentTypes['updateInboxReplier'][0])
{
$returnType = '\MailSlurp\Models\InboxReplierDto';
$request = $this->updateInboxReplierRequest($id, $update_inbox_replier_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateInboxReplier'
*
* @param string $id ID of inbox replier (required)
* @param \MailSlurp\Models\UpdateInboxReplierOptions $update_inbox_replier_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxReplier'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateInboxReplierRequest($id, $update_inbox_replier_options, string $contentType = self::contentTypes['updateInboxReplier'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling updateInboxReplier'
);
}
// verify the required parameter 'update_inbox_replier_options' is set
if ($update_inbox_replier_options === null || (is_array($update_inbox_replier_options) && count($update_inbox_replier_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_inbox_replier_options when calling updateInboxReplier'
);
}
$resourcePath = '/repliers/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_inbox_replier_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_inbox_replier_options));
} else {
$httpBody = $update_inbox_replier_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* InboxForwarderControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* InboxForwarderControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class InboxForwarderControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createNewInboxForwarder' => [
'application/json',
],
'deleteInboxForwarder' => [
'application/json',
],
'deleteInboxForwarders' => [
'application/json',
],
'getAllInboxForwarderEvents' => [
'application/json',
],
'getForwarderEvent' => [
'application/json',
],
'getInboxForwarder' => [
'application/json',
],
'getInboxForwarderEvent' => [
'application/json',
],
'getInboxForwarderEvents' => [
'application/json',
],
'getInboxForwarders' => [
'application/json',
],
'testInboxForwarder' => [
'application/json',
],
'testInboxForwardersForInbox' => [
'application/json',
],
'testNewInboxForwarder' => [
'application/json',
],
'updateInboxForwarder' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createNewInboxForwarder
*
* Create an inbox forwarder
*
* @param string $inbox_id Inbox id to attach forwarder to (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderDto
*/
public function createNewInboxForwarder($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0])
{
list($response) = $this->createNewInboxForwarderWithHttpInfo($inbox_id, $create_inbox_forwarder_options, $contentType);
return $response;
}
/**
* Operation createNewInboxForwarderWithHttpInfo
*
* Create an inbox forwarder
*
* @param string $inbox_id Inbox id to attach forwarder to (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createNewInboxForwarderWithHttpInfo($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0])
{
$request = $this->createNewInboxForwarderRequest($inbox_id, $create_inbox_forwarder_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createNewInboxForwarderAsync
*
* Create an inbox forwarder
*
* @param string $inbox_id Inbox id to attach forwarder to (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewInboxForwarderAsync($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0])
{
return $this->createNewInboxForwarderAsyncWithHttpInfo($inbox_id, $create_inbox_forwarder_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createNewInboxForwarderAsyncWithHttpInfo
*
* Create an inbox forwarder
*
* @param string $inbox_id Inbox id to attach forwarder to (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewInboxForwarderAsyncWithHttpInfo($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderDto';
$request = $this->createNewInboxForwarderRequest($inbox_id, $create_inbox_forwarder_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createNewInboxForwarder'
*
* @param string $inbox_id Inbox id to attach forwarder to (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createNewInboxForwarderRequest($inbox_id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['createNewInboxForwarder'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling createNewInboxForwarder'
);
}
// verify the required parameter 'create_inbox_forwarder_options' is set
if ($create_inbox_forwarder_options === null || (is_array($create_inbox_forwarder_options) && count($create_inbox_forwarder_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_inbox_forwarder_options when calling createNewInboxForwarder'
);
}
$resourcePath = '/forwarders';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_inbox_forwarder_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_forwarder_options));
} else {
$httpBody = $create_inbox_forwarder_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteInboxForwarder
*
* Delete an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteInboxForwarder($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0])
{
$this->deleteInboxForwarderWithHttpInfo($id, $contentType);
}
/**
* Operation deleteInboxForwarderWithHttpInfo
*
* Delete an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteInboxForwarderWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0])
{
$request = $this->deleteInboxForwarderRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteInboxForwarderAsync
*
* Delete an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxForwarderAsync($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0])
{
return $this->deleteInboxForwarderAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteInboxForwarderAsyncWithHttpInfo
*
* Delete an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxForwarderAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0])
{
$returnType = '';
$request = $this->deleteInboxForwarderRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteInboxForwarder'
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteInboxForwarderRequest($id, string $contentType = self::contentTypes['deleteInboxForwarder'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteInboxForwarder'
);
}
$resourcePath = '/forwarders/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteInboxForwarders
*
* Delete inbox forwarders
*
* @param string $inbox_id Optional inbox id to attach forwarder to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteInboxForwarders($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0])
{
$this->deleteInboxForwardersWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation deleteInboxForwardersWithHttpInfo
*
* Delete inbox forwarders
*
* @param string $inbox_id Optional inbox id to attach forwarder to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteInboxForwardersWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0])
{
$request = $this->deleteInboxForwardersRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteInboxForwardersAsync
*
* Delete inbox forwarders
*
* @param string $inbox_id Optional inbox id to attach forwarder to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxForwardersAsync($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0])
{
return $this->deleteInboxForwardersAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteInboxForwardersAsyncWithHttpInfo
*
* Delete inbox forwarders
*
* @param string $inbox_id Optional inbox id to attach forwarder to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxForwardersAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0])
{
$returnType = '';
$request = $this->deleteInboxForwardersRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteInboxForwarders'
*
* @param string $inbox_id Optional inbox id to attach forwarder to (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInboxForwarders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteInboxForwardersRequest($inbox_id = null, string $contentType = self::contentTypes['deleteInboxForwarders'][0])
{
$resourcePath = '/forwarders';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllInboxForwarderEvents
*
* Get all inbox forwarder events
*
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $inbox_id Optional inbox ID to filter for (optional)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxForwarderEvents
*/
public function getAllInboxForwarderEvents($page = 0, $size = 20, $inbox_id = null, $sort = 'ASC', string $contentType = self::contentTypes['getAllInboxForwarderEvents'][0])
{
list($response) = $this->getAllInboxForwarderEventsWithHttpInfo($page, $size, $inbox_id, $sort, $contentType);
return $response;
}
/**
* Operation getAllInboxForwarderEventsWithHttpInfo
*
* Get all inbox forwarder events
*
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $inbox_id Optional inbox ID to filter for (optional)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxForwarderEvents, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllInboxForwarderEventsWithHttpInfo($page = 0, $size = 20, $inbox_id = null, $sort = 'ASC', string $contentType = self::contentTypes['getAllInboxForwarderEvents'][0])
{
$request = $this->getAllInboxForwarderEventsRequest($page, $size, $inbox_id, $sort, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxForwarderEvents' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxForwarderEvents' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxForwarderEvents', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxForwarderEvents';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxForwarderEvents',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllInboxForwarderEventsAsync
*
* Get all inbox forwarder events
*
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $inbox_id Optional inbox ID to filter for (optional)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllInboxForwarderEventsAsync($page = 0, $size = 20, $inbox_id = null, $sort = 'ASC', string $contentType = self::contentTypes['getAllInboxForwarderEvents'][0])
{
return $this->getAllInboxForwarderEventsAsyncWithHttpInfo($page, $size, $inbox_id, $sort, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllInboxForwarderEventsAsyncWithHttpInfo
*
* Get all inbox forwarder events
*
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $inbox_id Optional inbox ID to filter for (optional)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllInboxForwarderEventsAsyncWithHttpInfo($page = 0, $size = 20, $inbox_id = null, $sort = 'ASC', string $contentType = self::contentTypes['getAllInboxForwarderEvents'][0])
{
$returnType = '\MailSlurp\Models\PageInboxForwarderEvents';
$request = $this->getAllInboxForwarderEventsRequest($page, $size, $inbox_id, $sort, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllInboxForwarderEvents'
*
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $inbox_id Optional inbox ID to filter for (optional)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllInboxForwarderEventsRequest($page = 0, $size = 20, $inbox_id = null, $sort = 'ASC', string $contentType = self::contentTypes['getAllInboxForwarderEvents'][0])
{
$resourcePath = '/forwarders/events';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getForwarderEvent
*
* Get a forwarder event
*
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getForwarderEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderEventDto
*/
public function getForwarderEvent($event_id, string $contentType = self::contentTypes['getForwarderEvent'][0])
{
list($response) = $this->getForwarderEventWithHttpInfo($event_id, $contentType);
return $response;
}
/**
* Operation getForwarderEventWithHttpInfo
*
* Get a forwarder event
*
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getForwarderEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderEventDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getForwarderEventWithHttpInfo($event_id, string $contentType = self::contentTypes['getForwarderEvent'][0])
{
$request = $this->getForwarderEventRequest($event_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderEventDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderEventDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderEventDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderEventDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderEventDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getForwarderEventAsync
*
* Get a forwarder event
*
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getForwarderEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getForwarderEventAsync($event_id, string $contentType = self::contentTypes['getForwarderEvent'][0])
{
return $this->getForwarderEventAsyncWithHttpInfo($event_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getForwarderEventAsyncWithHttpInfo
*
* Get a forwarder event
*
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getForwarderEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getForwarderEventAsyncWithHttpInfo($event_id, string $contentType = self::contentTypes['getForwarderEvent'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderEventDto';
$request = $this->getForwarderEventRequest($event_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getForwarderEvent'
*
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getForwarderEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getForwarderEventRequest($event_id, string $contentType = self::contentTypes['getForwarderEvent'][0])
{
// verify the required parameter 'event_id' is set
if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $event_id when calling getForwarderEvent'
);
}
$resourcePath = '/forwarders/events/{eventId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($event_id !== null) {
$resourcePath = str_replace(
'{' . 'eventId' . '}',
ObjectSerializer::toPathValue($event_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxForwarder
*
* Get an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderDto
*/
public function getInboxForwarder($id, string $contentType = self::contentTypes['getInboxForwarder'][0])
{
list($response) = $this->getInboxForwarderWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getInboxForwarderWithHttpInfo
*
* Get an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxForwarderWithHttpInfo($id, string $contentType = self::contentTypes['getInboxForwarder'][0])
{
$request = $this->getInboxForwarderRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxForwarderAsync
*
* Get an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwarderAsync($id, string $contentType = self::contentTypes['getInboxForwarder'][0])
{
return $this->getInboxForwarderAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxForwarderAsyncWithHttpInfo
*
* Get an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwarderAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getInboxForwarder'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderDto';
$request = $this->getInboxForwarderRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxForwarder'
*
* @param string $id ID of inbox forwarder (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxForwarderRequest($id, string $contentType = self::contentTypes['getInboxForwarder'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getInboxForwarder'
);
}
$resourcePath = '/forwarders/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxForwarderEvent
*
* Get an inbox forwarder event
*
* @param string $id ID of inbox forwarder (required)
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderEventDto
*/
public function getInboxForwarderEvent($id, $event_id, string $contentType = self::contentTypes['getInboxForwarderEvent'][0])
{
list($response) = $this->getInboxForwarderEventWithHttpInfo($id, $event_id, $contentType);
return $response;
}
/**
* Operation getInboxForwarderEventWithHttpInfo
*
* Get an inbox forwarder event
*
* @param string $id ID of inbox forwarder (required)
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderEventDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxForwarderEventWithHttpInfo($id, $event_id, string $contentType = self::contentTypes['getInboxForwarderEvent'][0])
{
$request = $this->getInboxForwarderEventRequest($id, $event_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderEventDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderEventDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderEventDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderEventDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderEventDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxForwarderEventAsync
*
* Get an inbox forwarder event
*
* @param string $id ID of inbox forwarder (required)
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwarderEventAsync($id, $event_id, string $contentType = self::contentTypes['getInboxForwarderEvent'][0])
{
return $this->getInboxForwarderEventAsyncWithHttpInfo($id, $event_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxForwarderEventAsyncWithHttpInfo
*
* Get an inbox forwarder event
*
* @param string $id ID of inbox forwarder (required)
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwarderEventAsyncWithHttpInfo($id, $event_id, string $contentType = self::contentTypes['getInboxForwarderEvent'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderEventDto';
$request = $this->getInboxForwarderEventRequest($id, $event_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxForwarderEvent'
*
* @param string $id ID of inbox forwarder (required)
* @param string $event_id ID of inbox forwarder event (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxForwarderEventRequest($id, $event_id, string $contentType = self::contentTypes['getInboxForwarderEvent'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getInboxForwarderEvent'
);
}
// verify the required parameter 'event_id' is set
if ($event_id === null || (is_array($event_id) && count($event_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $event_id when calling getInboxForwarderEvent'
);
}
$resourcePath = '/forwarders/{id}/events/{eventId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
// path params
if ($event_id !== null) {
$resourcePath = str_replace(
'{' . 'eventId' . '}',
ObjectSerializer::toPathValue($event_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxForwarderEvents
*
* Get an inbox forwarder event list
*
* @param string $id ID of inbox forwarder (required)
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxForwarderEvents
*/
public function getInboxForwarderEvents($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0])
{
list($response) = $this->getInboxForwarderEventsWithHttpInfo($id, $page, $size, $sort, $contentType);
return $response;
}
/**
* Operation getInboxForwarderEventsWithHttpInfo
*
* Get an inbox forwarder event list
*
* @param string $id ID of inbox forwarder (required)
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxForwarderEvents, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxForwarderEventsWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0])
{
$request = $this->getInboxForwarderEventsRequest($id, $page, $size, $sort, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxForwarderEvents' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxForwarderEvents' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxForwarderEvents', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxForwarderEvents';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxForwarderEvents',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxForwarderEventsAsync
*
* Get an inbox forwarder event list
*
* @param string $id ID of inbox forwarder (required)
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwarderEventsAsync($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0])
{
return $this->getInboxForwarderEventsAsyncWithHttpInfo($id, $page, $size, $sort, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxForwarderEventsAsyncWithHttpInfo
*
* Get an inbox forwarder event list
*
* @param string $id ID of inbox forwarder (required)
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwarderEventsAsyncWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0])
{
$returnType = '\MailSlurp\Models\PageInboxForwarderEvents';
$request = $this->getInboxForwarderEventsRequest($id, $page, $size, $sort, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxForwarderEvents'
*
* @param string $id ID of inbox forwarder (required)
* @param int $page Optional page index in inbox forwarder event list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder event list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarderEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxForwarderEventsRequest($id, $page = 0, $size = 20, $sort = 'ASC', string $contentType = self::contentTypes['getInboxForwarderEvents'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getInboxForwarderEvents'
);
}
$resourcePath = '/forwarders/{id}/events';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxForwarders
*
* List inbox forwarders
*
* @param string $inbox_id Optional inbox id to get forwarders from (optional)
* @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxForwarderDto
*/
public function getInboxForwarders($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0])
{
list($response) = $this->getInboxForwardersWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getInboxForwardersWithHttpInfo
*
* List inbox forwarders
*
* @param string $inbox_id Optional inbox id to get forwarders from (optional)
* @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxForwarderDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxForwardersWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0])
{
$request = $this->getInboxForwardersRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxForwarderDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxForwarderDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxForwarderDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxForwarderDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxForwarderDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxForwardersAsync
*
* List inbox forwarders
*
* @param string $inbox_id Optional inbox id to get forwarders from (optional)
* @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwardersAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0])
{
return $this->getInboxForwardersAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxForwardersAsyncWithHttpInfo
*
* List inbox forwarders
*
* @param string $inbox_id Optional inbox id to get forwarders from (optional)
* @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxForwardersAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0])
{
$returnType = '\MailSlurp\Models\PageInboxForwarderDto';
$request = $this->getInboxForwardersRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxForwarders'
*
* @param string $inbox_id Optional inbox id to get forwarders from (optional)
* @param int $page Optional page index in inbox forwarder list pagination (optional, default to 0)
* @param int $size Optional page size in inbox forwarder list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxForwarders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxForwardersRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxForwarders'][0])
{
$resourcePath = '/forwarders';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testInboxForwarder
*
* Test an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderTestResult
*/
public function testInboxForwarder($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0])
{
list($response) = $this->testInboxForwarderWithHttpInfo($id, $inbox_forwarder_test_options, $contentType);
return $response;
}
/**
* Operation testInboxForwarderWithHttpInfo
*
* Test an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderTestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testInboxForwarderWithHttpInfo($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0])
{
$request = $this->testInboxForwarderRequest($id, $inbox_forwarder_test_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderTestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderTestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderTestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderTestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderTestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testInboxForwarderAsync
*
* Test an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxForwarderAsync($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0])
{
return $this->testInboxForwarderAsyncWithHttpInfo($id, $inbox_forwarder_test_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testInboxForwarderAsyncWithHttpInfo
*
* Test an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxForwarderAsyncWithHttpInfo($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderTestResult';
$request = $this->testInboxForwarderRequest($id, $inbox_forwarder_test_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testInboxForwarder'
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testInboxForwarderRequest($id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwarder'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling testInboxForwarder'
);
}
// verify the required parameter 'inbox_forwarder_test_options' is set
if ($inbox_forwarder_test_options === null || (is_array($inbox_forwarder_test_options) && count($inbox_forwarder_test_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_forwarder_test_options when calling testInboxForwarder'
);
}
$resourcePath = '/forwarders/{id}/test';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($inbox_forwarder_test_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_forwarder_test_options));
} else {
$httpBody = $inbox_forwarder_test_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testInboxForwardersForInbox
*
* Test inbox forwarders for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderTestResult
*/
public function testInboxForwardersForInbox($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0])
{
list($response) = $this->testInboxForwardersForInboxWithHttpInfo($inbox_id, $inbox_forwarder_test_options, $contentType);
return $response;
}
/**
* Operation testInboxForwardersForInboxWithHttpInfo
*
* Test inbox forwarders for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderTestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testInboxForwardersForInboxWithHttpInfo($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0])
{
$request = $this->testInboxForwardersForInboxRequest($inbox_id, $inbox_forwarder_test_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderTestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderTestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderTestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderTestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderTestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testInboxForwardersForInboxAsync
*
* Test inbox forwarders for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxForwardersForInboxAsync($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0])
{
return $this->testInboxForwardersForInboxAsyncWithHttpInfo($inbox_id, $inbox_forwarder_test_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testInboxForwardersForInboxAsyncWithHttpInfo
*
* Test inbox forwarders for inbox
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testInboxForwardersForInboxAsyncWithHttpInfo($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderTestResult';
$request = $this->testInboxForwardersForInboxRequest($inbox_id, $inbox_forwarder_test_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testInboxForwardersForInbox'
*
* @param string $inbox_id ID of inbox (required)
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInboxForwardersForInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testInboxForwardersForInboxRequest($inbox_id, $inbox_forwarder_test_options, string $contentType = self::contentTypes['testInboxForwardersForInbox'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling testInboxForwardersForInbox'
);
}
// verify the required parameter 'inbox_forwarder_test_options' is set
if ($inbox_forwarder_test_options === null || (is_array($inbox_forwarder_test_options) && count($inbox_forwarder_test_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_forwarder_test_options when calling testInboxForwardersForInbox'
);
}
$resourcePath = '/forwarders';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($inbox_forwarder_test_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($inbox_forwarder_test_options));
} else {
$httpBody = $inbox_forwarder_test_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testNewInboxForwarder
*
* Test new inbox forwarder
*
* @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options test_new_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderTestResult
*/
public function testNewInboxForwarder($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0])
{
list($response) = $this->testNewInboxForwarderWithHttpInfo($test_new_inbox_forwarder_options, $contentType);
return $response;
}
/**
* Operation testNewInboxForwarderWithHttpInfo
*
* Test new inbox forwarder
*
* @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderTestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function testNewInboxForwarderWithHttpInfo($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0])
{
$request = $this->testNewInboxForwarderRequest($test_new_inbox_forwarder_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderTestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderTestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderTestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderTestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderTestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testNewInboxForwarderAsync
*
* Test new inbox forwarder
*
* @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testNewInboxForwarderAsync($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0])
{
return $this->testNewInboxForwarderAsyncWithHttpInfo($test_new_inbox_forwarder_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testNewInboxForwarderAsyncWithHttpInfo
*
* Test new inbox forwarder
*
* @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function testNewInboxForwarderAsyncWithHttpInfo($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderTestResult';
$request = $this->testNewInboxForwarderRequest($test_new_inbox_forwarder_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testNewInboxForwarder'
*
* @param \MailSlurp\Models\TestNewInboxForwarderOptions $test_new_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNewInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testNewInboxForwarderRequest($test_new_inbox_forwarder_options, string $contentType = self::contentTypes['testNewInboxForwarder'][0])
{
// verify the required parameter 'test_new_inbox_forwarder_options' is set
if ($test_new_inbox_forwarder_options === null || (is_array($test_new_inbox_forwarder_options) && count($test_new_inbox_forwarder_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $test_new_inbox_forwarder_options when calling testNewInboxForwarder'
);
}
$resourcePath = '/forwarders';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($test_new_inbox_forwarder_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($test_new_inbox_forwarder_options));
} else {
$httpBody = $test_new_inbox_forwarder_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateInboxForwarder
*
* Update an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxForwarderDto
*/
public function updateInboxForwarder($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0])
{
list($response) = $this->updateInboxForwarderWithHttpInfo($id, $create_inbox_forwarder_options, $contentType);
return $response;
}
/**
* Operation updateInboxForwarderWithHttpInfo
*
* Update an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxForwarderDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateInboxForwarderWithHttpInfo($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0])
{
$request = $this->updateInboxForwarderRequest($id, $create_inbox_forwarder_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxForwarderDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxForwarderDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxForwarderDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxForwarderDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxForwarderDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateInboxForwarderAsync
*
* Update an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateInboxForwarderAsync($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0])
{
return $this->updateInboxForwarderAsyncWithHttpInfo($id, $create_inbox_forwarder_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateInboxForwarderAsyncWithHttpInfo
*
* Update an inbox forwarder
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateInboxForwarderAsyncWithHttpInfo($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0])
{
$returnType = '\MailSlurp\Models\InboxForwarderDto';
$request = $this->updateInboxForwarderRequest($id, $create_inbox_forwarder_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateInboxForwarder'
*
* @param string $id ID of inbox forwarder (required)
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInboxForwarder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateInboxForwarderRequest($id, $create_inbox_forwarder_options, string $contentType = self::contentTypes['updateInboxForwarder'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling updateInboxForwarder'
);
}
// verify the required parameter 'create_inbox_forwarder_options' is set
if ($create_inbox_forwarder_options === null || (is_array($create_inbox_forwarder_options) && count($create_inbox_forwarder_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_inbox_forwarder_options when calling updateInboxForwarder'
);
}
$resourcePath = '/forwarders/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_inbox_forwarder_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_forwarder_options));
} else {
$httpBody = $create_inbox_forwarder_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* InboxControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* InboxControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class InboxControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'cancelScheduledJob' => [
'application/json',
],
'createInbox' => [
'application/json',
],
'createInboxRuleset' => [
'application/json',
],
'createInboxWithDefaults' => [
'application/json',
],
'createInboxWithOptions' => [
'application/json',
],
'deleteAllInboxEmails' => [
'application/json',
],
'deleteAllInboxes' => [
'application/json',
],
'deleteAllInboxesByDescription' => [
'application/json',
],
'deleteAllInboxesByName' => [
'application/json',
],
'deleteAllInboxesByTag' => [
'application/json',
],
'deleteInbox' => [
'application/json',
],
'doesInboxExist' => [
'application/json',
],
'flushExpired' => [
'application/json',
],
'getAllInboxes' => [
'application/json',
],
'getAllInboxesOffsetPaginated' => [
'application/json',
],
'getAllScheduledJobs' => [
'application/json',
],
'getDeliveryStatusesByInboxId' => [
'application/json',
],
'getEmails' => [
'application/json',
],
'getImapAccess' => [
'application/json',
],
'getImapSmtpAccess' => [
'application/json',
],
'getImapSmtpAccessEnv' => [
'application/json',
],
'getImapSmtpAccessServers' => [
'application/json',
],
'getInbox' => [
'application/json',
],
'getInboxByEmailAddress' => [
'application/json',
],
'getInboxByName' => [
'application/json',
],
'getInboxCount' => [
'application/json',
],
'getInboxEmailCount' => [
'application/json',
],
'getInboxEmailsPaginated' => [
'application/json',
],
'getInboxIds' => [
'application/json',
],
'getInboxSentEmails' => [
'application/json',
],
'getInboxTags' => [
'application/json',
],
'getInboxes' => [
'application/json',
],
'getLatestEmailInInbox' => [
'application/json',
],
'getOrganizationInboxes' => [
'application/json',
],
'getScheduledJob' => [
'application/json',
],
'getScheduledJobsByInboxId' => [
'application/json',
],
'getSmtpAccess' => [
'application/json',
],
'isEmailAddressAvailable' => [
'application/json',
],
'listInboxRulesets' => [
'application/json',
],
'listInboxTrackingPixels' => [
'application/json',
],
'searchInboxes' => [
'application/json',
],
'sendEmail' => [
'application/json',
],
'sendEmailAndConfirm' => [
'application/json',
],
'sendEmailWithQueue' => [
'application/json',
],
'sendSmtpEnvelope' => [
'application/json',
],
'sendTestEmail' => [
'application/json',
],
'sendWithSchedule' => [
'application/json',
],
'setInboxFavourited' => [
'application/json',
],
'updateImapAccess' => [
'application/json',
],
'updateInbox' => [
'application/json',
],
'updateSmtpAccess' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation cancelScheduledJob
*
* Cancel a scheduled email job
*
* @param string $job_id job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ScheduledJobDto
*/
public function cancelScheduledJob($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0])
{
list($response) = $this->cancelScheduledJobWithHttpInfo($job_id, $contentType);
return $response;
}
/**
* Operation cancelScheduledJobWithHttpInfo
*
* Cancel a scheduled email job
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ScheduledJobDto, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelScheduledJobWithHttpInfo($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0])
{
$request = $this->cancelScheduledJobRequest($job_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ScheduledJobDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ScheduledJobDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ScheduledJobDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ScheduledJobDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ScheduledJobDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation cancelScheduledJobAsync
*
* Cancel a scheduled email job
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelScheduledJobAsync($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0])
{
return $this->cancelScheduledJobAsyncWithHttpInfo($job_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelScheduledJobAsyncWithHttpInfo
*
* Cancel a scheduled email job
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelScheduledJobAsyncWithHttpInfo($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0])
{
$returnType = '\MailSlurp\Models\ScheduledJobDto';
$request = $this->cancelScheduledJobRequest($job_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'cancelScheduledJob'
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledJob'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function cancelScheduledJobRequest($job_id, string $contentType = self::contentTypes['cancelScheduledJob'][0])
{
// verify the required parameter 'job_id' is set
if ($job_id === null || (is_array($job_id) && count($job_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $job_id when calling cancelScheduledJob'
);
}
$resourcePath = '/inboxes/scheduled-jobs/{jobId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($job_id !== null) {
$resourcePath = str_replace(
'{' . 'jobId' . '}',
ObjectSerializer::toPathValue($job_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createInbox
*
* Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
*
* @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional)
* @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional)
* @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional)
* @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional)
* @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional)
* @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional)
* @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional)
* @param int $expires_in Number of milliseconds that inbox should exist for (optional)
* @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional)
* @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mxslurp.click`. (optional)
* @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional)
* @param bool $use_short_address Use a shorter email address under 31 characters (optional)
* @param string $domain_id ID of custom domain to use for email address. (optional)
* @param string $domain_name FQDN domain name for the domain you have verified. Will be appended with a randomly assigned recipient name. Use the `emailAddress` option instead to specify the full custom inbox. (optional)
* @param string $prefix Prefix to add before the email address for easier labelling or identification. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function createInbox($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, $domain_id = null, $domain_name = null, $prefix = null, string $contentType = self::contentTypes['createInbox'][0])
{
list($response) = $this->createInboxWithHttpInfo($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $domain_id, $domain_name, $prefix, $contentType);
return $response;
}
/**
* Operation createInboxWithHttpInfo
*
* Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
*
* @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional)
* @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional)
* @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional)
* @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional)
* @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional)
* @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional)
* @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional)
* @param int $expires_in Number of milliseconds that inbox should exist for (optional)
* @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional)
* @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mxslurp.click`. (optional)
* @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional)
* @param bool $use_short_address Use a shorter email address under 31 characters (optional)
* @param string $domain_id ID of custom domain to use for email address. (optional)
* @param string $domain_name FQDN domain name for the domain you have verified. Will be appended with a randomly assigned recipient name. Use the `emailAddress` option instead to specify the full custom inbox. (optional)
* @param string $prefix Prefix to add before the email address for easier labelling or identification. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createInboxWithHttpInfo($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, $domain_id = null, $domain_name = null, $prefix = null, string $contentType = self::contentTypes['createInbox'][0])
{
$request = $this->createInboxRequest($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $domain_id, $domain_name, $prefix, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createInboxAsync
*
* Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
*
* @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional)
* @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional)
* @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional)
* @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional)
* @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional)
* @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional)
* @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional)
* @param int $expires_in Number of milliseconds that inbox should exist for (optional)
* @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional)
* @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mxslurp.click`. (optional)
* @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional)
* @param bool $use_short_address Use a shorter email address under 31 characters (optional)
* @param string $domain_id ID of custom domain to use for email address. (optional)
* @param string $domain_name FQDN domain name for the domain you have verified. Will be appended with a randomly assigned recipient name. Use the `emailAddress` option instead to specify the full custom inbox. (optional)
* @param string $prefix Prefix to add before the email address for easier labelling or identification. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxAsync($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, $domain_id = null, $domain_name = null, $prefix = null, string $contentType = self::contentTypes['createInbox'][0])
{
return $this->createInboxAsyncWithHttpInfo($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $domain_id, $domain_name, $prefix, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createInboxAsyncWithHttpInfo
*
* Create an inbox email address. An inbox has a real email address and can send and receive emails. Inboxes can be either `SMTP` or `HTTP` inboxes.
*
* @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional)
* @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional)
* @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional)
* @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional)
* @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional)
* @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional)
* @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional)
* @param int $expires_in Number of milliseconds that inbox should exist for (optional)
* @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional)
* @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mxslurp.click`. (optional)
* @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional)
* @param bool $use_short_address Use a shorter email address under 31 characters (optional)
* @param string $domain_id ID of custom domain to use for email address. (optional)
* @param string $domain_name FQDN domain name for the domain you have verified. Will be appended with a randomly assigned recipient name. Use the `emailAddress` option instead to specify the full custom inbox. (optional)
* @param string $prefix Prefix to add before the email address for easier labelling or identification. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxAsyncWithHttpInfo($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, $domain_id = null, $domain_name = null, $prefix = null, string $contentType = self::contentTypes['createInbox'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->createInboxRequest($email_address, $tags, $name, $description, $use_domain_pool, $favourite, $expires_at, $expires_in, $allow_team_access, $inbox_type, $virtual_inbox, $use_short_address, $domain_id, $domain_name, $prefix, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createInbox'
*
* @param string $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID. (optional)
* @param string[] $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI. (optional)
* @param string $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails. (optional)
* @param string $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with (optional)
* @param bool $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types. (optional)
* @param bool $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering (optional)
* @param \DateTime $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX. (optional)
* @param int $expires_in Number of milliseconds that inbox should exist for (optional)
* @param bool $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization. (optional)
* @param string $inbox_type HTTP (default) or SMTP inbox type. HTTP inboxes are default and best solution for most cases. SMTP inboxes are more reliable for public inbound email consumption (but do not support sending emails). When using custom domains the domain type must match the inbox type. HTTP inboxes are processed by AWS SES while SMTP inboxes use a custom mail server running at `mxslurp.click`. (optional)
* @param bool $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending. (optional)
* @param bool $use_short_address Use a shorter email address under 31 characters (optional)
* @param string $domain_id ID of custom domain to use for email address. (optional)
* @param string $domain_name FQDN domain name for the domain you have verified. Will be appended with a randomly assigned recipient name. Use the `emailAddress` option instead to specify the full custom inbox. (optional)
* @param string $prefix Prefix to add before the email address for easier labelling or identification. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createInboxRequest($email_address = null, $tags = null, $name = null, $description = null, $use_domain_pool = null, $favourite = null, $expires_at = null, $expires_in = null, $allow_team_access = null, $inbox_type = null, $virtual_inbox = null, $use_short_address = null, $domain_id = null, $domain_name = null, $prefix = null, string $contentType = self::contentTypes['createInbox'][0])
{
$resourcePath = '/inboxes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$tags,
'tags', // param base name
'array', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$name,
'name', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$description,
'description', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$use_domain_pool,
'useDomainPool', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$favourite,
'favourite', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$expires_at,
'expiresAt', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$expires_in,
'expiresIn', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$allow_team_access,
'allowTeamAccess', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_type,
'inboxType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$virtual_inbox,
'virtualInbox', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$use_short_address,
'useShortAddress', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_id,
'domainId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_name,
'domainName', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$prefix,
'prefix', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createInboxRuleset
*
* Create an inbox ruleset
*
* @param string $inbox_id inboxId (required)
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options create_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxRulesetDto
*/
public function createInboxRuleset($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0])
{
list($response) = $this->createInboxRulesetWithHttpInfo($inbox_id, $create_inbox_ruleset_options, $contentType);
return $response;
}
/**
* Operation createInboxRulesetWithHttpInfo
*
* Create an inbox ruleset
*
* @param string $inbox_id inboxId (required)
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxRulesetDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createInboxRulesetWithHttpInfo($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0])
{
$request = $this->createInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxRulesetDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxRulesetDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxRulesetDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxRulesetDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxRulesetDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createInboxRulesetAsync
*
* Create an inbox ruleset
*
* @param string $inbox_id inboxId (required)
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxRulesetAsync($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0])
{
return $this->createInboxRulesetAsyncWithHttpInfo($inbox_id, $create_inbox_ruleset_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createInboxRulesetAsyncWithHttpInfo
*
* Create an inbox ruleset
*
* @param string $inbox_id inboxId (required)
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxRulesetAsyncWithHttpInfo($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0])
{
$returnType = '\MailSlurp\Models\InboxRulesetDto';
$request = $this->createInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createInboxRuleset'
*
* @param string $inbox_id inboxId (required)
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxRuleset'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createInboxRulesetRequest($inbox_id, $create_inbox_ruleset_options, string $contentType = self::contentTypes['createInboxRuleset'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling createInboxRuleset'
);
}
// verify the required parameter 'create_inbox_ruleset_options' is set
if ($create_inbox_ruleset_options === null || (is_array($create_inbox_ruleset_options) && count($create_inbox_ruleset_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_inbox_ruleset_options when calling createInboxRuleset'
);
}
$resourcePath = '/inboxes/{inboxId}/rulesets';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_inbox_ruleset_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_ruleset_options));
} else {
$httpBody = $create_inbox_ruleset_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createInboxWithDefaults
*
* Create an inbox with default options. Uses MailSlurp domain pool address and is private.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function createInboxWithDefaults(string $contentType = self::contentTypes['createInboxWithDefaults'][0])
{
list($response) = $this->createInboxWithDefaultsWithHttpInfo($contentType);
return $response;
}
/**
* Operation createInboxWithDefaultsWithHttpInfo
*
* Create an inbox with default options. Uses MailSlurp domain pool address and is private.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createInboxWithDefaultsWithHttpInfo(string $contentType = self::contentTypes['createInboxWithDefaults'][0])
{
$request = $this->createInboxWithDefaultsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createInboxWithDefaultsAsync
*
* Create an inbox with default options. Uses MailSlurp domain pool address and is private.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxWithDefaultsAsync(string $contentType = self::contentTypes['createInboxWithDefaults'][0])
{
return $this->createInboxWithDefaultsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createInboxWithDefaultsAsyncWithHttpInfo
*
* Create an inbox with default options. Uses MailSlurp domain pool address and is private.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxWithDefaultsAsyncWithHttpInfo(string $contentType = self::contentTypes['createInboxWithDefaults'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->createInboxWithDefaultsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createInboxWithDefaults'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithDefaults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createInboxWithDefaultsRequest(string $contentType = self::contentTypes['createInboxWithDefaults'][0])
{
$resourcePath = '/inboxes/withDefaults';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createInboxWithOptions
*
* Create an inbox with options. Extended options for inbox creation.
*
* @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto create_inbox_dto (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function createInboxWithOptions($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0])
{
list($response) = $this->createInboxWithOptionsWithHttpInfo($create_inbox_dto, $contentType);
return $response;
}
/**
* Operation createInboxWithOptionsWithHttpInfo
*
* Create an inbox with options. Extended options for inbox creation.
*
* @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createInboxWithOptionsWithHttpInfo($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0])
{
$request = $this->createInboxWithOptionsRequest($create_inbox_dto, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createInboxWithOptionsAsync
*
* Create an inbox with options. Extended options for inbox creation.
*
* @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxWithOptionsAsync($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0])
{
return $this->createInboxWithOptionsAsyncWithHttpInfo($create_inbox_dto, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createInboxWithOptionsAsyncWithHttpInfo
*
* Create an inbox with options. Extended options for inbox creation.
*
* @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboxWithOptionsAsyncWithHttpInfo($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->createInboxWithOptionsRequest($create_inbox_dto, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createInboxWithOptions'
*
* @param \MailSlurp\Models\CreateInboxDto $create_inbox_dto (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInboxWithOptions'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createInboxWithOptionsRequest($create_inbox_dto, string $contentType = self::contentTypes['createInboxWithOptions'][0])
{
// verify the required parameter 'create_inbox_dto' is set
if ($create_inbox_dto === null || (is_array($create_inbox_dto) && count($create_inbox_dto) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_inbox_dto when calling createInboxWithOptions'
);
}
$resourcePath = '/inboxes/withOptions';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_inbox_dto)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_inbox_dto));
} else {
$httpBody = $create_inbox_dto;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllInboxEmails
*
* Delete all emails in a given inboxes.
*
* @param string $inbox_id inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllInboxEmails($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0])
{
$this->deleteAllInboxEmailsWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation deleteAllInboxEmailsWithHttpInfo
*
* Delete all emails in a given inboxes.
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllInboxEmailsWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0])
{
$request = $this->deleteAllInboxEmailsRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllInboxEmailsAsync
*
* Delete all emails in a given inboxes.
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxEmailsAsync($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0])
{
return $this->deleteAllInboxEmailsAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllInboxEmailsAsyncWithHttpInfo
*
* Delete all emails in a given inboxes.
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxEmailsAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0])
{
$returnType = '';
$request = $this->deleteAllInboxEmailsRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllInboxEmails'
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllInboxEmailsRequest($inbox_id, string $contentType = self::contentTypes['deleteAllInboxEmails'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling deleteAllInboxEmails'
);
}
$resourcePath = '/inboxes/{inboxId}/deleteAllInboxEmails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllInboxes
*
* Delete all inboxes
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllInboxes(string $contentType = self::contentTypes['deleteAllInboxes'][0])
{
$this->deleteAllInboxesWithHttpInfo($contentType);
}
/**
* Operation deleteAllInboxesWithHttpInfo
*
* Delete all inboxes
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllInboxesWithHttpInfo(string $contentType = self::contentTypes['deleteAllInboxes'][0])
{
$request = $this->deleteAllInboxesRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllInboxesAsync
*
* Delete all inboxes
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesAsync(string $contentType = self::contentTypes['deleteAllInboxes'][0])
{
return $this->deleteAllInboxesAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllInboxesAsyncWithHttpInfo
*
* Delete all inboxes
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllInboxes'][0])
{
$returnType = '';
$request = $this->deleteAllInboxesRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllInboxes'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllInboxesRequest(string $contentType = self::contentTypes['deleteAllInboxes'][0])
{
$resourcePath = '/inboxes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllInboxesByDescription
*
* Delete inboxes by description
*
* @param string $description description (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByDescription'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllInboxesByDescription($description, string $contentType = self::contentTypes['deleteAllInboxesByDescription'][0])
{
$this->deleteAllInboxesByDescriptionWithHttpInfo($description, $contentType);
}
/**
* Operation deleteAllInboxesByDescriptionWithHttpInfo
*
* Delete inboxes by description
*
* @param string $description (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByDescription'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllInboxesByDescriptionWithHttpInfo($description, string $contentType = self::contentTypes['deleteAllInboxesByDescription'][0])
{
$request = $this->deleteAllInboxesByDescriptionRequest($description, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllInboxesByDescriptionAsync
*
* Delete inboxes by description
*
* @param string $description (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByDescription'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesByDescriptionAsync($description, string $contentType = self::contentTypes['deleteAllInboxesByDescription'][0])
{
return $this->deleteAllInboxesByDescriptionAsyncWithHttpInfo($description, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllInboxesByDescriptionAsyncWithHttpInfo
*
* Delete inboxes by description
*
* @param string $description (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByDescription'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesByDescriptionAsyncWithHttpInfo($description, string $contentType = self::contentTypes['deleteAllInboxesByDescription'][0])
{
$returnType = '';
$request = $this->deleteAllInboxesByDescriptionRequest($description, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllInboxesByDescription'
*
* @param string $description (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByDescription'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllInboxesByDescriptionRequest($description, string $contentType = self::contentTypes['deleteAllInboxesByDescription'][0])
{
// verify the required parameter 'description' is set
if ($description === null || (is_array($description) && count($description) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $description when calling deleteAllInboxesByDescription'
);
}
$resourcePath = '/inboxes/by-description';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$description,
'description', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllInboxesByName
*
* Delete inboxes by name
*
* @param string $name name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByName'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllInboxesByName($name, string $contentType = self::contentTypes['deleteAllInboxesByName'][0])
{
$this->deleteAllInboxesByNameWithHttpInfo($name, $contentType);
}
/**
* Operation deleteAllInboxesByNameWithHttpInfo
*
* Delete inboxes by name
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByName'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllInboxesByNameWithHttpInfo($name, string $contentType = self::contentTypes['deleteAllInboxesByName'][0])
{
$request = $this->deleteAllInboxesByNameRequest($name, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllInboxesByNameAsync
*
* Delete inboxes by name
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesByNameAsync($name, string $contentType = self::contentTypes['deleteAllInboxesByName'][0])
{
return $this->deleteAllInboxesByNameAsyncWithHttpInfo($name, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllInboxesByNameAsyncWithHttpInfo
*
* Delete inboxes by name
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesByNameAsyncWithHttpInfo($name, string $contentType = self::contentTypes['deleteAllInboxesByName'][0])
{
$returnType = '';
$request = $this->deleteAllInboxesByNameRequest($name, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllInboxesByName'
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllInboxesByNameRequest($name, string $contentType = self::contentTypes['deleteAllInboxesByName'][0])
{
// verify the required parameter 'name' is set
if ($name === null || (is_array($name) && count($name) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $name when calling deleteAllInboxesByName'
);
}
$resourcePath = '/inboxes/by-name';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$name,
'name', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllInboxesByTag
*
* Delete inboxes by tag
*
* @param string $tag tag (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByTag'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllInboxesByTag($tag, string $contentType = self::contentTypes['deleteAllInboxesByTag'][0])
{
$this->deleteAllInboxesByTagWithHttpInfo($tag, $contentType);
}
/**
* Operation deleteAllInboxesByTagWithHttpInfo
*
* Delete inboxes by tag
*
* @param string $tag (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByTag'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllInboxesByTagWithHttpInfo($tag, string $contentType = self::contentTypes['deleteAllInboxesByTag'][0])
{
$request = $this->deleteAllInboxesByTagRequest($tag, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllInboxesByTagAsync
*
* Delete inboxes by tag
*
* @param string $tag (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByTag'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesByTagAsync($tag, string $contentType = self::contentTypes['deleteAllInboxesByTag'][0])
{
return $this->deleteAllInboxesByTagAsyncWithHttpInfo($tag, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllInboxesByTagAsyncWithHttpInfo
*
* Delete inboxes by tag
*
* @param string $tag (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByTag'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllInboxesByTagAsyncWithHttpInfo($tag, string $contentType = self::contentTypes['deleteAllInboxesByTag'][0])
{
$returnType = '';
$request = $this->deleteAllInboxesByTagRequest($tag, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllInboxesByTag'
*
* @param string $tag (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllInboxesByTag'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllInboxesByTagRequest($tag, string $contentType = self::contentTypes['deleteAllInboxesByTag'][0])
{
// verify the required parameter 'tag' is set
if ($tag === null || (is_array($tag) && count($tag) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $tag when calling deleteAllInboxesByTag'
);
}
$resourcePath = '/inboxes/by-tag';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$tag,
'tag', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteInbox
*
* Delete inbox
*
* @param string $inbox_id inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteInbox($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0])
{
$this->deleteInboxWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation deleteInboxWithHttpInfo
*
* Delete inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteInboxWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0])
{
$request = $this->deleteInboxRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteInboxAsync
*
* Delete inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxAsync($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0])
{
return $this->deleteInboxAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteInboxAsyncWithHttpInfo
*
* Delete inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteInboxAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0])
{
$returnType = '';
$request = $this->deleteInboxRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteInbox'
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteInboxRequest($inbox_id, string $contentType = self::contentTypes['deleteInbox'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling deleteInbox'
);
}
$resourcePath = '/inboxes/{inboxId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation doesInboxExist
*
* Does inbox exist
*
* @param string $email_address Email address (required)
* @param bool $allow_catch_all allow_catch_all (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxExistsDto
*/
public function doesInboxExist($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0])
{
list($response) = $this->doesInboxExistWithHttpInfo($email_address, $allow_catch_all, $contentType);
return $response;
}
/**
* Operation doesInboxExistWithHttpInfo
*
* Does inbox exist
*
* @param string $email_address Email address (required)
* @param bool $allow_catch_all (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxExistsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function doesInboxExistWithHttpInfo($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0])
{
$request = $this->doesInboxExistRequest($email_address, $allow_catch_all, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxExistsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxExistsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxExistsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxExistsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxExistsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation doesInboxExistAsync
*
* Does inbox exist
*
* @param string $email_address Email address (required)
* @param bool $allow_catch_all (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function doesInboxExistAsync($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0])
{
return $this->doesInboxExistAsyncWithHttpInfo($email_address, $allow_catch_all, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation doesInboxExistAsyncWithHttpInfo
*
* Does inbox exist
*
* @param string $email_address Email address (required)
* @param bool $allow_catch_all (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function doesInboxExistAsyncWithHttpInfo($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0])
{
$returnType = '\MailSlurp\Models\InboxExistsDto';
$request = $this->doesInboxExistRequest($email_address, $allow_catch_all, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'doesInboxExist'
*
* @param string $email_address Email address (required)
* @param bool $allow_catch_all (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['doesInboxExist'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function doesInboxExistRequest($email_address, $allow_catch_all = null, string $contentType = self::contentTypes['doesInboxExist'][0])
{
// verify the required parameter 'email_address' is set
if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_address when calling doesInboxExist'
);
}
$resourcePath = '/inboxes/exists';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$allow_catch_all,
'allowCatchAll', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation flushExpired
*
* Remove expired inboxes
*
* @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\FlushExpiredInboxesResult
*/
public function flushExpired($before = null, string $contentType = self::contentTypes['flushExpired'][0])
{
list($response) = $this->flushExpiredWithHttpInfo($before, $contentType);
return $response;
}
/**
* Operation flushExpiredWithHttpInfo
*
* Remove expired inboxes
*
* @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\FlushExpiredInboxesResult, HTTP status code, HTTP response headers (array of strings)
*/
public function flushExpiredWithHttpInfo($before = null, string $contentType = self::contentTypes['flushExpired'][0])
{
$request = $this->flushExpiredRequest($before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\FlushExpiredInboxesResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\FlushExpiredInboxesResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\FlushExpiredInboxesResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\FlushExpiredInboxesResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\FlushExpiredInboxesResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation flushExpiredAsync
*
* Remove expired inboxes
*
* @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function flushExpiredAsync($before = null, string $contentType = self::contentTypes['flushExpired'][0])
{
return $this->flushExpiredAsyncWithHttpInfo($before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation flushExpiredAsyncWithHttpInfo
*
* Remove expired inboxes
*
* @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function flushExpiredAsyncWithHttpInfo($before = null, string $contentType = self::contentTypes['flushExpired'][0])
{
$returnType = '\MailSlurp\Models\FlushExpiredInboxesResult';
$request = $this->flushExpiredRequest($before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'flushExpired'
*
* @param \DateTime $before Optional expired at before flag to flush expired inboxes that have expired before the given time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['flushExpired'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function flushExpiredRequest($before = null, string $contentType = self::contentTypes['flushExpired'][0])
{
$resourcePath = '/inboxes/expired';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllInboxes
*
* List All Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxProjection
*/
public function getAllInboxes($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0])
{
list($response) = $this->getAllInboxesWithHttpInfo($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType);
return $response;
}
/**
* Operation getAllInboxesWithHttpInfo
*
* List All Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllInboxesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0])
{
$request = $this->getAllInboxesRequest($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllInboxesAsync
*
* List All Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllInboxesAsync($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0])
{
return $this->getAllInboxesAsyncWithHttpInfo($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllInboxesAsyncWithHttpInfo
*
* List All Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllInboxesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0])
{
$returnType = '\MailSlurp\Models\PageInboxProjection';
$request = $this->getAllInboxesRequest($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllInboxes'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllInboxesRequest($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxes'][0])
{
$resourcePath = '/inboxes/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$favourite,
'favourite', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search,
'search', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$tag,
'tag', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$team_access,
'teamAccess', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_type,
'inboxType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_function,
'inboxFunction', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_id,
'domainId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllInboxesOffsetPaginated
*
* List All Inboxes Offset Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxesOffsetPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxProjection
*/
public function getAllInboxesOffsetPaginated($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxesOffsetPaginated'][0])
{
list($response) = $this->getAllInboxesOffsetPaginatedWithHttpInfo($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType);
return $response;
}
/**
* Operation getAllInboxesOffsetPaginatedWithHttpInfo
*
* List All Inboxes Offset Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxesOffsetPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllInboxesOffsetPaginatedWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxesOffsetPaginated'][0])
{
$request = $this->getAllInboxesOffsetPaginatedRequest($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllInboxesOffsetPaginatedAsync
*
* List All Inboxes Offset Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxesOffsetPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllInboxesOffsetPaginatedAsync($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxesOffsetPaginated'][0])
{
return $this->getAllInboxesOffsetPaginatedAsyncWithHttpInfo($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllInboxesOffsetPaginatedAsyncWithHttpInfo
*
* List All Inboxes Offset Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxesOffsetPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllInboxesOffsetPaginatedAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxesOffsetPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageInboxProjection';
$request = $this->getAllInboxesOffsetPaginatedRequest($page, $size, $sort, $favourite, $search, $tag, $team_access, $since, $before, $inbox_type, $inbox_function, $domain_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllInboxesOffsetPaginated'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $favourite Optionally filter results for favourites only (optional, default to false)
* @param string $search Optionally filter by search words partial matching ID, tags, name, and email address (optional)
* @param string $tag Optionally filter by tags. Will return inboxes that include given tags (optional)
* @param bool $team_access DEPRECATED. Optionally filter by team access. (optional) (deprecated)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $inbox_type Optional filter by inbox type (optional)
* @param string $inbox_function Optional filter by inbox function (optional)
* @param string $domain_id Optional domain ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllInboxesOffsetPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllInboxesOffsetPaginatedRequest($page = 0, $size = 20, $sort = 'ASC', $favourite = false, $search = null, $tag = null, $team_access = null, $since = null, $before = null, $inbox_type = null, $inbox_function = null, $domain_id = null, string $contentType = self::contentTypes['getAllInboxesOffsetPaginated'][0])
{
$resourcePath = '/inboxes/offset-paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$favourite,
'favourite', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search,
'search', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$tag,
'tag', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$team_access,
'teamAccess', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_type,
'inboxType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_function,
'inboxFunction', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_id,
'domainId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllScheduledJobs
*
* Get all scheduled email sending jobs for account
*
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageScheduledJobs
*/
public function getAllScheduledJobs($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0])
{
list($response) = $this->getAllScheduledJobsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getAllScheduledJobsWithHttpInfo
*
* Get all scheduled email sending jobs for account
*
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageScheduledJobs, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllScheduledJobsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0])
{
$request = $this->getAllScheduledJobsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageScheduledJobs' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageScheduledJobs' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageScheduledJobs', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageScheduledJobs';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageScheduledJobs',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllScheduledJobsAsync
*
* Get all scheduled email sending jobs for account
*
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllScheduledJobsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0])
{
return $this->getAllScheduledJobsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllScheduledJobsAsyncWithHttpInfo
*
* Get all scheduled email sending jobs for account
*
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllScheduledJobsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0])
{
$returnType = '\MailSlurp\Models\PageScheduledJobs';
$request = $this->getAllScheduledJobsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllScheduledJobs'
*
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllScheduledJobs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllScheduledJobsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllScheduledJobs'][0])
{
$resourcePath = '/inboxes/scheduled-jobs';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getDeliveryStatusesByInboxId
*
* @param string $inbox_id inbox_id (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageDeliveryStatus
* @deprecated
*/
public function getDeliveryStatusesByInboxId($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0])
{
list($response) = $this->getDeliveryStatusesByInboxIdWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getDeliveryStatusesByInboxIdWithHttpInfo
*
* @param string $inbox_id (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageDeliveryStatus, HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getDeliveryStatusesByInboxIdWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0])
{
$request = $this->getDeliveryStatusesByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageDeliveryStatus' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageDeliveryStatus' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageDeliveryStatus', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageDeliveryStatus';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageDeliveryStatus',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getDeliveryStatusesByInboxIdAsync
*
* @param string $inbox_id (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getDeliveryStatusesByInboxIdAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0])
{
return $this->getDeliveryStatusesByInboxIdAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDeliveryStatusesByInboxIdAsyncWithHttpInfo
*
* @param string $inbox_id (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getDeliveryStatusesByInboxIdAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0])
{
$returnType = '\MailSlurp\Models\PageDeliveryStatus';
$request = $this->getDeliveryStatusesByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getDeliveryStatusesByInboxId'
*
* @param string $inbox_id (required)
* @param int $page Optional page index in delivery status list pagination (optional, default to 0)
* @param int $size Optional page size in delivery status list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDeliveryStatusesByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getDeliveryStatusesByInboxIdRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getDeliveryStatusesByInboxId'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getDeliveryStatusesByInboxId'
);
}
$resourcePath = '/inboxes/{inboxId}/delivery-status';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmails
*
* Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional)
* @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional)
* @param string $sort Sort the results by received date and direction ASC or DESC (optional)
* @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional)
* @param int $delay_timeout delay_timeout (optional)
* @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional)
* @param bool $unread_only unread_only (optional)
* @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional)
* @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreview[]
*/
public function getEmails($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0])
{
list($response) = $this->getEmailsWithHttpInfo($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType);
return $response;
}
/**
* Operation getEmailsWithHttpInfo
*
* Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional)
* @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional)
* @param string $sort Sort the results by received date and direction ASC or DESC (optional)
* @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional)
* @param int $delay_timeout (optional)
* @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional)
* @param bool $unread_only (optional)
* @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional)
* @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreview[], HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailsWithHttpInfo($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0])
{
$request = $this->getEmailsRequest($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreview[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreview[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreview[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreview[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailsAsync
*
* Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional)
* @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional)
* @param string $sort Sort the results by received date and direction ASC or DESC (optional)
* @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional)
* @param int $delay_timeout (optional)
* @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional)
* @param bool $unread_only (optional)
* @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional)
* @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailsAsync($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0])
{
return $this->getEmailsAsyncWithHttpInfo($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailsAsyncWithHttpInfo
*
* Get emails in an Inbox. This method is not idempotent as it allows retries and waits if you want certain conditions to be met before returning. For simple listing and sorting of known emails use the email controller instead.
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional)
* @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional)
* @param string $sort Sort the results by received date and direction ASC or DESC (optional)
* @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional)
* @param int $delay_timeout (optional)
* @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional)
* @param bool $unread_only (optional)
* @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional)
* @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailsAsyncWithHttpInfo($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0])
{
$returnType = '\MailSlurp\Models\EmailPreview[]';
$request = $this->getEmailsRequest($inbox_id, $size, $limit, $sort, $retry_timeout, $delay_timeout, $min_count, $unread_only, $before, $since, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmails'
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $size Alias for limit. Assessed first before assessing any passed limit. (optional)
* @param int $limit Limit the result set, ordered by received date time sort direction. Maximum 100. For more listing options see the email controller (optional)
* @param string $sort Sort the results by received date and direction ASC or DESC (optional)
* @param int $retry_timeout Maximum milliseconds to spend retrying inbox database until minCount emails are returned (optional)
* @param int $delay_timeout (optional)
* @param int $min_count Minimum acceptable email count. Will cause request to hang (and retry) until minCount is satisfied or retryTimeout is reached. (optional)
* @param bool $unread_only (optional)
* @param \DateTime $before Exclude emails received after this ISO 8601 date time (optional)
* @param \DateTime $since Exclude emails received before this ISO 8601 date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailsRequest($inbox_id, $size = null, $limit = null, $sort = null, $retry_timeout = null, $delay_timeout = null, $min_count = null, $unread_only = null, $before = null, $since = null, string $contentType = self::contentTypes['getEmails'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getEmails'
);
}
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling InboxControllerApi.getEmails, must be smaller than or equal to 100.');
}
if ($limit !== null && $limit > 100) {
throw new \InvalidArgumentException('invalid value for "$limit" when calling InboxControllerApi.getEmails, must be smaller than or equal to 100.');
}
$resourcePath = '/inboxes/{inboxId}/emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$limit,
'limit', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$retry_timeout,
'retryTimeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$delay_timeout,
'delayTimeout', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$min_count,
'minCount', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getImapAccess
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapAccessDetails
*/
public function getImapAccess($inbox_id = null, string $contentType = self::contentTypes['getImapAccess'][0])
{
list($response) = $this->getImapAccessWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getImapAccessWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapAccessDetails, HTTP status code, HTTP response headers (array of strings)
*/
public function getImapAccessWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapAccess'][0])
{
$request = $this->getImapAccessRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapAccessDetails' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapAccessDetails' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapAccessDetails', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapAccessDetails';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapAccessDetails',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getImapAccessAsync
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapAccessAsync($inbox_id = null, string $contentType = self::contentTypes['getImapAccess'][0])
{
return $this->getImapAccessAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getImapAccessAsyncWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapAccessAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapAccess'][0])
{
$returnType = '\MailSlurp\Models\ImapAccessDetails';
$request = $this->getImapAccessRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getImapAccess'
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getImapAccessRequest($inbox_id = null, string $contentType = self::contentTypes['getImapAccess'][0])
{
$resourcePath = '/inboxes/imap-access';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getImapSmtpAccess
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapSmtpAccessDetails
*/
public function getImapSmtpAccess($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0])
{
list($response) = $this->getImapSmtpAccessWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getImapSmtpAccessWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapSmtpAccessDetails, HTTP status code, HTTP response headers (array of strings)
*/
public function getImapSmtpAccessWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0])
{
$request = $this->getImapSmtpAccessRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapSmtpAccessDetails' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapSmtpAccessDetails' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapSmtpAccessDetails', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapSmtpAccessDetails';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapSmtpAccessDetails',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getImapSmtpAccessAsync
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapSmtpAccessAsync($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0])
{
return $this->getImapSmtpAccessAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getImapSmtpAccessAsyncWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapSmtpAccessAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0])
{
$returnType = '\MailSlurp\Models\ImapSmtpAccessDetails';
$request = $this->getImapSmtpAccessRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getImapSmtpAccess'
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getImapSmtpAccessRequest($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccess'][0])
{
$resourcePath = '/inboxes/imap-smtp-access';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getImapSmtpAccessEnv
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessEnv'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function getImapSmtpAccessEnv($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccessEnv'][0])
{
list($response) = $this->getImapSmtpAccessEnvWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getImapSmtpAccessEnvWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessEnv'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function getImapSmtpAccessEnvWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccessEnv'][0])
{
$request = $this->getImapSmtpAccessEnvRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getImapSmtpAccessEnvAsync
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessEnv'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapSmtpAccessEnvAsync($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccessEnv'][0])
{
return $this->getImapSmtpAccessEnvAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getImapSmtpAccessEnvAsyncWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessEnv'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapSmtpAccessEnvAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccessEnv'][0])
{
$returnType = 'string';
$request = $this->getImapSmtpAccessEnvRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getImapSmtpAccessEnv'
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessEnv'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getImapSmtpAccessEnvRequest($inbox_id = null, string $contentType = self::contentTypes['getImapSmtpAccessEnv'][0])
{
$resourcePath = '/inboxes/imap-smtp-access/env';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getImapSmtpAccessServers
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessServers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapSmtpAccessServers
*/
public function getImapSmtpAccessServers(string $contentType = self::contentTypes['getImapSmtpAccessServers'][0])
{
list($response) = $this->getImapSmtpAccessServersWithHttpInfo($contentType);
return $response;
}
/**
* Operation getImapSmtpAccessServersWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessServers'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapSmtpAccessServers, HTTP status code, HTTP response headers (array of strings)
*/
public function getImapSmtpAccessServersWithHttpInfo(string $contentType = self::contentTypes['getImapSmtpAccessServers'][0])
{
$request = $this->getImapSmtpAccessServersRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapSmtpAccessServers' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapSmtpAccessServers' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapSmtpAccessServers', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapSmtpAccessServers';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapSmtpAccessServers',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getImapSmtpAccessServersAsync
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessServers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapSmtpAccessServersAsync(string $contentType = self::contentTypes['getImapSmtpAccessServers'][0])
{
return $this->getImapSmtpAccessServersAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getImapSmtpAccessServersAsyncWithHttpInfo
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessServers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getImapSmtpAccessServersAsyncWithHttpInfo(string $contentType = self::contentTypes['getImapSmtpAccessServers'][0])
{
$returnType = '\MailSlurp\Models\ImapSmtpAccessServers';
$request = $this->getImapSmtpAccessServersRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getImapSmtpAccessServers'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImapSmtpAccessServers'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getImapSmtpAccessServersRequest(string $contentType = self::contentTypes['getImapSmtpAccessServers'][0])
{
$resourcePath = '/inboxes/imap-smtp-access/servers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInbox
*
* Get Inbox. Returns properties of an inbox.
*
* @param string $inbox_id inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function getInbox($inbox_id, string $contentType = self::contentTypes['getInbox'][0])
{
list($response) = $this->getInboxWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getInboxWithHttpInfo
*
* Get Inbox. Returns properties of an inbox.
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInbox'][0])
{
$request = $this->getInboxRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxAsync
*
* Get Inbox. Returns properties of an inbox.
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxAsync($inbox_id, string $contentType = self::contentTypes['getInbox'][0])
{
return $this->getInboxAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxAsyncWithHttpInfo
*
* Get Inbox. Returns properties of an inbox.
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInbox'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->getInboxRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInbox'
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxRequest($inbox_id, string $contentType = self::contentTypes['getInbox'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getInbox'
);
}
$resourcePath = '/inboxes/{inboxId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxByEmailAddress
*
* Search for an inbox with the provided email address
*
* @param string $email_address email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxByEmailAddressResult
*/
public function getInboxByEmailAddress($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0])
{
list($response) = $this->getInboxByEmailAddressWithHttpInfo($email_address, $contentType);
return $response;
}
/**
* Operation getInboxByEmailAddressWithHttpInfo
*
* Search for an inbox with the provided email address
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxByEmailAddressResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxByEmailAddressWithHttpInfo($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0])
{
$request = $this->getInboxByEmailAddressRequest($email_address, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxByEmailAddressResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxByEmailAddressResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxByEmailAddressResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxByEmailAddressResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxByEmailAddressResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxByEmailAddressAsync
*
* Search for an inbox with the provided email address
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxByEmailAddressAsync($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0])
{
return $this->getInboxByEmailAddressAsyncWithHttpInfo($email_address, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxByEmailAddressAsyncWithHttpInfo
*
* Search for an inbox with the provided email address
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxByEmailAddressAsyncWithHttpInfo($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0])
{
$returnType = '\MailSlurp\Models\InboxByEmailAddressResult';
$request = $this->getInboxByEmailAddressRequest($email_address, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxByEmailAddress'
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxByEmailAddressRequest($email_address, string $contentType = self::contentTypes['getInboxByEmailAddress'][0])
{
// verify the required parameter 'email_address' is set
if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_address when calling getInboxByEmailAddress'
);
}
$resourcePath = '/inboxes/byEmailAddress';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxByName
*
* Search for an inbox with the given name
*
* @param string $name name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxByNameResult
*/
public function getInboxByName($name, string $contentType = self::contentTypes['getInboxByName'][0])
{
list($response) = $this->getInboxByNameWithHttpInfo($name, $contentType);
return $response;
}
/**
* Operation getInboxByNameWithHttpInfo
*
* Search for an inbox with the given name
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxByNameResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxByNameWithHttpInfo($name, string $contentType = self::contentTypes['getInboxByName'][0])
{
$request = $this->getInboxByNameRequest($name, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxByNameResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxByNameResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxByNameResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxByNameResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxByNameResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxByNameAsync
*
* Search for an inbox with the given name
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxByNameAsync($name, string $contentType = self::contentTypes['getInboxByName'][0])
{
return $this->getInboxByNameAsyncWithHttpInfo($name, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxByNameAsyncWithHttpInfo
*
* Search for an inbox with the given name
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxByNameAsyncWithHttpInfo($name, string $contentType = self::contentTypes['getInboxByName'][0])
{
$returnType = '\MailSlurp\Models\InboxByNameResult';
$request = $this->getInboxByNameRequest($name, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxByName'
*
* @param string $name (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxByNameRequest($name, string $contentType = self::contentTypes['getInboxByName'][0])
{
// verify the required parameter 'name' is set
if ($name === null || (is_array($name) && count($name) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $name when calling getInboxByName'
);
}
$resourcePath = '/inboxes/byName';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$name,
'name', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxCount
*
* Get total inbox count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CountDto
*/
public function getInboxCount(string $contentType = self::contentTypes['getInboxCount'][0])
{
list($response) = $this->getInboxCountWithHttpInfo($contentType);
return $response;
}
/**
* Operation getInboxCountWithHttpInfo
*
* Get total inbox count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxCountWithHttpInfo(string $contentType = self::contentTypes['getInboxCount'][0])
{
$request = $this->getInboxCountRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CountDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CountDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CountDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CountDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxCountAsync
*
* Get total inbox count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxCountAsync(string $contentType = self::contentTypes['getInboxCount'][0])
{
return $this->getInboxCountAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxCountAsyncWithHttpInfo
*
* Get total inbox count
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxCountAsyncWithHttpInfo(string $contentType = self::contentTypes['getInboxCount'][0])
{
$returnType = '\MailSlurp\Models\CountDto';
$request = $this->getInboxCountRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxCount'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxCountRequest(string $contentType = self::contentTypes['getInboxCount'][0])
{
$resourcePath = '/inboxes/count';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxEmailCount
*
* Get email count in inbox
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CountDto
*/
public function getInboxEmailCount($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0])
{
list($response) = $this->getInboxEmailCountWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getInboxEmailCountWithHttpInfo
*
* Get email count in inbox
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxEmailCountWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0])
{
$request = $this->getInboxEmailCountRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CountDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CountDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CountDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CountDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxEmailCountAsync
*
* Get email count in inbox
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxEmailCountAsync($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0])
{
return $this->getInboxEmailCountAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxEmailCountAsyncWithHttpInfo
*
* Get email count in inbox
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxEmailCountAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0])
{
$returnType = '\MailSlurp\Models\CountDto';
$request = $this->getInboxEmailCountRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxEmailCount'
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxEmailCountRequest($inbox_id, string $contentType = self::contentTypes['getInboxEmailCount'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getInboxEmailCount'
);
}
$resourcePath = '/inboxes/{inboxId}/emails/count';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxEmailsPaginated
*
* Get inbox emails paginated
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $page Optional page index in inbox emails list pagination (optional, default to 0)
* @param int $size Optional page size in inbox emails list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by received after given date time (optional)
* @param \DateTime $before Optional filter by received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageEmailPreview
*/
public function getInboxEmailsPaginated($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0])
{
list($response) = $this->getInboxEmailsPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getInboxEmailsPaginatedWithHttpInfo
*
* Get inbox emails paginated
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $page Optional page index in inbox emails list pagination (optional, default to 0)
* @param int $size Optional page size in inbox emails list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by received after given date time (optional)
* @param \DateTime $before Optional filter by received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageEmailPreview, HTTP status code, HTTP response headers (array of strings)
*/
public function getInboxEmailsPaginatedWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0])
{
$request = $this->getInboxEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageEmailPreview' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageEmailPreview' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailPreview', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageEmailPreview';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageEmailPreview',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxEmailsPaginatedAsync
*
* Get inbox emails paginated
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $page Optional page index in inbox emails list pagination (optional, default to 0)
* @param int $size Optional page size in inbox emails list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by received after given date time (optional)
* @param \DateTime $before Optional filter by received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxEmailsPaginatedAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0])
{
return $this->getInboxEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxEmailsPaginatedAsyncWithHttpInfo
*
* Get inbox emails paginated
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $page Optional page index in inbox emails list pagination (optional, default to 0)
* @param int $size Optional page size in inbox emails list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by received after given date time (optional)
* @param \DateTime $before Optional filter by received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInboxEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageEmailPreview';
$request = $this->getInboxEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxEmailsPaginated'
*
* @param string $inbox_id Id of inbox that emails belongs to (required)
* @param int $page Optional page index in inbox emails list pagination (optional, default to 0)
* @param int $size Optional page size in inbox emails list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by received after given date time (optional)
* @param \DateTime $before Optional filter by received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInboxEmailsPaginatedRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getInboxEmailsPaginated'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getInboxEmailsPaginated'
);
}
$resourcePath = '/inboxes/{inboxId}/emails/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxIds
*
* Get all inbox IDs
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxIdsResult
* @deprecated
*/
public function getInboxIds(string $contentType = self::contentTypes['getInboxIds'][0])
{
list($response) = $this->getInboxIdsWithHttpInfo($contentType);
return $response;
}
/**
* Operation getInboxIdsWithHttpInfo
*
* Get all inbox IDs
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxIdsResult, HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getInboxIdsWithHttpInfo(string $contentType = self::contentTypes['getInboxIds'][0])
{
$request = $this->getInboxIdsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxIdsResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxIdsResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxIdsResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxIdsResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxIdsResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxIdsAsync
*
* Get all inbox IDs
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxIdsAsync(string $contentType = self::contentTypes['getInboxIds'][0])
{
return $this->getInboxIdsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxIdsAsyncWithHttpInfo
*
* Get all inbox IDs
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxIdsAsyncWithHttpInfo(string $contentType = self::contentTypes['getInboxIds'][0])
{
$returnType = '\MailSlurp\Models\InboxIdsResult';
$request = $this->getInboxIdsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxIds'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxIds'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getInboxIdsRequest(string $contentType = self::contentTypes['getInboxIds'][0])
{
$resourcePath = '/inboxes/ids';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxSentEmails
*
* Get Inbox Sent Emails
*
* @param string $inbox_id inbox_id (required)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional sent email search (optional)
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageSentEmailProjection
* @deprecated
*/
public function getInboxSentEmails($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0])
{
list($response) = $this->getInboxSentEmailsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getInboxSentEmailsWithHttpInfo
*
* Get Inbox Sent Emails
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional sent email search (optional)
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageSentEmailProjection, HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getInboxSentEmailsWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0])
{
$request = $this->getInboxSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageSentEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageSentEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageSentEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageSentEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageSentEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxSentEmailsAsync
*
* Get Inbox Sent Emails
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional sent email search (optional)
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxSentEmailsAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0])
{
return $this->getInboxSentEmailsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxSentEmailsAsyncWithHttpInfo
*
* Get Inbox Sent Emails
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional sent email search (optional)
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxSentEmailsAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0])
{
$returnType = '\MailSlurp\Models\PageSentEmailProjection';
$request = $this->getInboxSentEmailsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxSentEmails'
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional sent email search (optional)
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxSentEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getInboxSentEmailsRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getInboxSentEmails'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getInboxSentEmails'
);
}
$resourcePath = '/inboxes/{inboxId}/sent';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxTags
*
* Get inbox tags
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string[]
* @deprecated
*/
public function getInboxTags(string $contentType = self::contentTypes['getInboxTags'][0])
{
list($response) = $this->getInboxTagsWithHttpInfo($contentType);
return $response;
}
/**
* Operation getInboxTagsWithHttpInfo
*
* Get inbox tags
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string[], HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getInboxTagsWithHttpInfo(string $contentType = self::contentTypes['getInboxTags'][0])
{
$request = $this->getInboxTagsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxTagsAsync
*
* Get inbox tags
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxTagsAsync(string $contentType = self::contentTypes['getInboxTags'][0])
{
return $this->getInboxTagsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxTagsAsyncWithHttpInfo
*
* Get inbox tags
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxTagsAsyncWithHttpInfo(string $contentType = self::contentTypes['getInboxTags'][0])
{
$returnType = 'string[]';
$request = $this->getInboxTagsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxTags'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getInboxTagsRequest(string $contentType = self::contentTypes['getInboxTags'][0])
{
$resourcePath = '/inboxes/tags';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getInboxes
*
* List Inboxes and email addresses
*
* @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param bool $exclude_catch_all_inboxes Optional exclude catch all inboxes (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto[]
* @deprecated
*/
public function getInboxes($size = 100, $sort = 'ASC', $since = null, $exclude_catch_all_inboxes = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0])
{
list($response) = $this->getInboxesWithHttpInfo($size, $sort, $since, $exclude_catch_all_inboxes, $before, $contentType);
return $response;
}
/**
* Operation getInboxesWithHttpInfo
*
* List Inboxes and email addresses
*
* @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param bool $exclude_catch_all_inboxes Optional exclude catch all inboxes (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto[], HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getInboxesWithHttpInfo($size = 100, $sort = 'ASC', $since = null, $exclude_catch_all_inboxes = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0])
{
$request = $this->getInboxesRequest($size, $sort, $since, $exclude_catch_all_inboxes, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxDto[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getInboxesAsync
*
* List Inboxes and email addresses
*
* @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param bool $exclude_catch_all_inboxes Optional exclude catch all inboxes (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxesAsync($size = 100, $sort = 'ASC', $since = null, $exclude_catch_all_inboxes = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0])
{
return $this->getInboxesAsyncWithHttpInfo($size, $sort, $since, $exclude_catch_all_inboxes, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInboxesAsyncWithHttpInfo
*
* List Inboxes and email addresses
*
* @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param bool $exclude_catch_all_inboxes Optional exclude catch all inboxes (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getInboxesAsyncWithHttpInfo($size = 100, $sort = 'ASC', $since = null, $exclude_catch_all_inboxes = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0])
{
$returnType = '\MailSlurp\Models\InboxDto[]';
$request = $this->getInboxesRequest($size, $sort, $since, $exclude_catch_all_inboxes, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getInboxes'
*
* @param int $size Optional result size limit. Note an automatic limit of 100 results is applied. See the paginated `getAllEmails` for larger queries. (optional, default to 100)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param bool $exclude_catch_all_inboxes Optional exclude catch all inboxes (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getInboxesRequest($size = 100, $sort = 'ASC', $since = null, $exclude_catch_all_inboxes = null, $before = null, string $contentType = self::contentTypes['getInboxes'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling InboxControllerApi.getInboxes, must be smaller than or equal to 100.');
}
$resourcePath = '/inboxes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$exclude_catch_all_inboxes,
'excludeCatchAllInboxes', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getLatestEmailInInbox
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param int $timeout_millis Timeout milliseconds to wait for latest email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Email
*/
public function getLatestEmailInInbox($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0])
{
list($response) = $this->getLatestEmailInInboxWithHttpInfo($inbox_id, $timeout_millis, $contentType);
return $response;
}
/**
* Operation getLatestEmailInInboxWithHttpInfo
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param int $timeout_millis Timeout milliseconds to wait for latest email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings)
*/
public function getLatestEmailInInboxWithHttpInfo($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0])
{
$request = $this->getLatestEmailInInboxRequest($inbox_id, $timeout_millis, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Email' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Email' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Email';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Email',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getLatestEmailInInboxAsync
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param int $timeout_millis Timeout milliseconds to wait for latest email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getLatestEmailInInboxAsync($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0])
{
return $this->getLatestEmailInInboxAsyncWithHttpInfo($inbox_id, $timeout_millis, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getLatestEmailInInboxAsyncWithHttpInfo
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param int $timeout_millis Timeout milliseconds to wait for latest email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getLatestEmailInInboxAsyncWithHttpInfo($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0])
{
$returnType = '\MailSlurp\Models\Email';
$request = $this->getLatestEmailInInboxRequest($inbox_id, $timeout_millis, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getLatestEmailInInbox'
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param int $timeout_millis Timeout milliseconds to wait for latest email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getLatestEmailInInboxRequest($inbox_id, $timeout_millis, string $contentType = self::contentTypes['getLatestEmailInInbox'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getLatestEmailInInbox'
);
}
// verify the required parameter 'timeout_millis' is set
if ($timeout_millis === null || (is_array($timeout_millis) && count($timeout_millis) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $timeout_millis when calling getLatestEmailInInbox'
);
}
$resourcePath = '/inboxes/getLatestEmail';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$timeout_millis,
'timeoutMillis', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getOrganizationInboxes
*
* List Organization Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageOrganizationInboxProjection
* @deprecated
*/
public function getOrganizationInboxes($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0])
{
list($response) = $this->getOrganizationInboxesWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getOrganizationInboxesWithHttpInfo
*
* List Organization Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageOrganizationInboxProjection, HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getOrganizationInboxesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0])
{
$request = $this->getOrganizationInboxesRequest($page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageOrganizationInboxProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageOrganizationInboxProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageOrganizationInboxProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageOrganizationInboxProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageOrganizationInboxProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getOrganizationInboxesAsync
*
* List Organization Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getOrganizationInboxesAsync($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0])
{
return $this->getOrganizationInboxesAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrganizationInboxesAsyncWithHttpInfo
*
* List Organization Inboxes Paginated
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getOrganizationInboxesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0])
{
$returnType = '\MailSlurp\Models\PageOrganizationInboxProjection';
$request = $this->getOrganizationInboxesRequest($page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getOrganizationInboxes'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getOrganizationInboxesRequest($page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationInboxes'][0])
{
$resourcePath = '/inboxes/organization';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getScheduledJob
*
* Get a scheduled email job
*
* @param string $job_id job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ScheduledJobDto
*/
public function getScheduledJob($job_id, string $contentType = self::contentTypes['getScheduledJob'][0])
{
list($response) = $this->getScheduledJobWithHttpInfo($job_id, $contentType);
return $response;
}
/**
* Operation getScheduledJobWithHttpInfo
*
* Get a scheduled email job
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ScheduledJobDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getScheduledJobWithHttpInfo($job_id, string $contentType = self::contentTypes['getScheduledJob'][0])
{
$request = $this->getScheduledJobRequest($job_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ScheduledJobDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ScheduledJobDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ScheduledJobDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ScheduledJobDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ScheduledJobDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getScheduledJobAsync
*
* Get a scheduled email job
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getScheduledJobAsync($job_id, string $contentType = self::contentTypes['getScheduledJob'][0])
{
return $this->getScheduledJobAsyncWithHttpInfo($job_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getScheduledJobAsyncWithHttpInfo
*
* Get a scheduled email job
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getScheduledJobAsyncWithHttpInfo($job_id, string $contentType = self::contentTypes['getScheduledJob'][0])
{
$returnType = '\MailSlurp\Models\ScheduledJobDto';
$request = $this->getScheduledJobRequest($job_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getScheduledJob'
*
* @param string $job_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJob'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getScheduledJobRequest($job_id, string $contentType = self::contentTypes['getScheduledJob'][0])
{
// verify the required parameter 'job_id' is set
if ($job_id === null || (is_array($job_id) && count($job_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $job_id when calling getScheduledJob'
);
}
$resourcePath = '/inboxes/scheduled-jobs/{jobId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($job_id !== null) {
$resourcePath = str_replace(
'{' . 'jobId' . '}',
ObjectSerializer::toPathValue($job_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getScheduledJobsByInboxId
*
* Get all scheduled email sending jobs for the inbox
*
* @param string $inbox_id inbox_id (required)
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageScheduledJobs
*/
public function getScheduledJobsByInboxId($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0])
{
list($response) = $this->getScheduledJobsByInboxIdWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getScheduledJobsByInboxIdWithHttpInfo
*
* Get all scheduled email sending jobs for the inbox
*
* @param string $inbox_id (required)
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageScheduledJobs, HTTP status code, HTTP response headers (array of strings)
*/
public function getScheduledJobsByInboxIdWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0])
{
$request = $this->getScheduledJobsByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageScheduledJobs' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageScheduledJobs' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageScheduledJobs', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageScheduledJobs';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageScheduledJobs',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getScheduledJobsByInboxIdAsync
*
* Get all scheduled email sending jobs for the inbox
*
* @param string $inbox_id (required)
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getScheduledJobsByInboxIdAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0])
{
return $this->getScheduledJobsByInboxIdAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getScheduledJobsByInboxIdAsyncWithHttpInfo
*
* Get all scheduled email sending jobs for the inbox
*
* @param string $inbox_id (required)
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getScheduledJobsByInboxIdAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0])
{
$returnType = '\MailSlurp\Models\PageScheduledJobs';
$request = $this->getScheduledJobsByInboxIdRequest($inbox_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getScheduledJobsByInboxId'
*
* @param string $inbox_id (required)
* @param int $page Optional page index in scheduled job list pagination (optional, default to 0)
* @param int $size Optional page size in scheduled job list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getScheduledJobsByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getScheduledJobsByInboxIdRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getScheduledJobsByInboxId'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getScheduledJobsByInboxId'
);
}
$resourcePath = '/inboxes/{inboxId}/scheduled-jobs';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getSmtpAccess
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SmtpAccessDetails
*/
public function getSmtpAccess($inbox_id = null, string $contentType = self::contentTypes['getSmtpAccess'][0])
{
list($response) = $this->getSmtpAccessWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getSmtpAccessWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SmtpAccessDetails, HTTP status code, HTTP response headers (array of strings)
*/
public function getSmtpAccessWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getSmtpAccess'][0])
{
$request = $this->getSmtpAccessRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SmtpAccessDetails' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SmtpAccessDetails' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SmtpAccessDetails', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SmtpAccessDetails';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SmtpAccessDetails',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getSmtpAccessAsync
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmtpAccessAsync($inbox_id = null, string $contentType = self::contentTypes['getSmtpAccess'][0])
{
return $this->getSmtpAccessAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSmtpAccessAsyncWithHttpInfo
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmtpAccessAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getSmtpAccess'][0])
{
$returnType = '\MailSlurp\Models\SmtpAccessDetails';
$request = $this->getSmtpAccessRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getSmtpAccess'
*
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getSmtpAccessRequest($inbox_id = null, string $contentType = self::contentTypes['getSmtpAccess'][0])
{
$resourcePath = '/inboxes/smtp-access';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation isEmailAddressAvailable
*
* Is email address available
*
* @param string $email_address email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['isEmailAddressAvailable'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailAvailableResult
*/
public function isEmailAddressAvailable($email_address, string $contentType = self::contentTypes['isEmailAddressAvailable'][0])
{
list($response) = $this->isEmailAddressAvailableWithHttpInfo($email_address, $contentType);
return $response;
}
/**
* Operation isEmailAddressAvailableWithHttpInfo
*
* Is email address available
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['isEmailAddressAvailable'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailAvailableResult, HTTP status code, HTTP response headers (array of strings)
*/
public function isEmailAddressAvailableWithHttpInfo($email_address, string $contentType = self::contentTypes['isEmailAddressAvailable'][0])
{
$request = $this->isEmailAddressAvailableRequest($email_address, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailAvailableResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailAvailableResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailAvailableResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailAvailableResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailAvailableResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation isEmailAddressAvailableAsync
*
* Is email address available
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['isEmailAddressAvailable'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function isEmailAddressAvailableAsync($email_address, string $contentType = self::contentTypes['isEmailAddressAvailable'][0])
{
return $this->isEmailAddressAvailableAsyncWithHttpInfo($email_address, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation isEmailAddressAvailableAsyncWithHttpInfo
*
* Is email address available
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['isEmailAddressAvailable'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function isEmailAddressAvailableAsyncWithHttpInfo($email_address, string $contentType = self::contentTypes['isEmailAddressAvailable'][0])
{
$returnType = '\MailSlurp\Models\EmailAvailableResult';
$request = $this->isEmailAddressAvailableRequest($email_address, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'isEmailAddressAvailable'
*
* @param string $email_address (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['isEmailAddressAvailable'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function isEmailAddressAvailableRequest($email_address, string $contentType = self::contentTypes['isEmailAddressAvailable'][0])
{
// verify the required parameter 'email_address' is set
if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_address when calling isEmailAddressAvailable'
);
}
$resourcePath = '/inboxes/available';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation listInboxRulesets
*
* List inbox rulesets
*
* @param string $inbox_id inbox_id (required)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxRulesetDto
*/
public function listInboxRulesets($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0])
{
list($response) = $this->listInboxRulesetsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation listInboxRulesetsWithHttpInfo
*
* List inbox rulesets
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxRulesetDto, HTTP status code, HTTP response headers (array of strings)
*/
public function listInboxRulesetsWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0])
{
$request = $this->listInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxRulesetDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxRulesetDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxRulesetDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxRulesetDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxRulesetDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation listInboxRulesetsAsync
*
* List inbox rulesets
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listInboxRulesetsAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0])
{
return $this->listInboxRulesetsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listInboxRulesetsAsyncWithHttpInfo
*
* List inbox rulesets
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listInboxRulesetsAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0])
{
$returnType = '\MailSlurp\Models\PageInboxRulesetDto';
$request = $this->listInboxRulesetsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'listInboxRulesets'
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox ruleset list pagination (optional, default to 0)
* @param int $size Optional page size in inbox ruleset list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxRulesets'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function listInboxRulesetsRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxRulesets'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling listInboxRulesets'
);
}
$resourcePath = '/inboxes/{inboxId}/rulesets';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation listInboxTrackingPixels
*
* List inbox tracking pixels
*
* @param string $inbox_id inbox_id (required)
* @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageTrackingPixelProjection
*/
public function listInboxTrackingPixels($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0])
{
list($response) = $this->listInboxTrackingPixelsWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation listInboxTrackingPixelsWithHttpInfo
*
* List inbox tracking pixels
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageTrackingPixelProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function listInboxTrackingPixelsWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0])
{
$request = $this->listInboxTrackingPixelsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageTrackingPixelProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageTrackingPixelProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageTrackingPixelProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageTrackingPixelProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation listInboxTrackingPixelsAsync
*
* List inbox tracking pixels
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listInboxTrackingPixelsAsync($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0])
{
return $this->listInboxTrackingPixelsAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listInboxTrackingPixelsAsyncWithHttpInfo
*
* List inbox tracking pixels
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listInboxTrackingPixelsAsyncWithHttpInfo($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0])
{
$returnType = '\MailSlurp\Models\PageTrackingPixelProjection';
$request = $this->listInboxTrackingPixelsRequest($inbox_id, $page, $size, $sort, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'listInboxTrackingPixels'
*
* @param string $inbox_id (required)
* @param int $page Optional page index in inbox tracking pixel list pagination (optional, default to 0)
* @param int $size Optional page size in inbox tracking pixel list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Optional filter by created after given date time (optional)
* @param \DateTime $before Optional filter by created before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listInboxTrackingPixels'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function listInboxTrackingPixelsRequest($inbox_id, $page = 0, $size = 20, $sort = 'ASC', $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['listInboxTrackingPixels'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling listInboxTrackingPixels'
);
}
$resourcePath = '/inboxes/{inboxId}/tracking-pixels';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation searchInboxes
*
* Search all inboxes and return matching inboxes
*
* @param \MailSlurp\Models\SearchInboxesOptions $search_inboxes_options search_inboxes_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageInboxProjection
*/
public function searchInboxes($search_inboxes_options, string $contentType = self::contentTypes['searchInboxes'][0])
{
list($response) = $this->searchInboxesWithHttpInfo($search_inboxes_options, $contentType);
return $response;
}
/**
* Operation searchInboxesWithHttpInfo
*
* Search all inboxes and return matching inboxes
*
* @param \MailSlurp\Models\SearchInboxesOptions $search_inboxes_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageInboxProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function searchInboxesWithHttpInfo($search_inboxes_options, string $contentType = self::contentTypes['searchInboxes'][0])
{
$request = $this->searchInboxesRequest($search_inboxes_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageInboxProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageInboxProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageInboxProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageInboxProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageInboxProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation searchInboxesAsync
*
* Search all inboxes and return matching inboxes
*
* @param \MailSlurp\Models\SearchInboxesOptions $search_inboxes_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function searchInboxesAsync($search_inboxes_options, string $contentType = self::contentTypes['searchInboxes'][0])
{
return $this->searchInboxesAsyncWithHttpInfo($search_inboxes_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation searchInboxesAsyncWithHttpInfo
*
* Search all inboxes and return matching inboxes
*
* @param \MailSlurp\Models\SearchInboxesOptions $search_inboxes_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function searchInboxesAsyncWithHttpInfo($search_inboxes_options, string $contentType = self::contentTypes['searchInboxes'][0])
{
$returnType = '\MailSlurp\Models\PageInboxProjection';
$request = $this->searchInboxesRequest($search_inboxes_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'searchInboxes'
*
* @param \MailSlurp\Models\SearchInboxesOptions $search_inboxes_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function searchInboxesRequest($search_inboxes_options, string $contentType = self::contentTypes['searchInboxes'][0])
{
// verify the required parameter 'search_inboxes_options' is set
if ($search_inboxes_options === null || (is_array($search_inboxes_options) && count($search_inboxes_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $search_inboxes_options when calling searchInboxes'
);
}
$resourcePath = '/inboxes/search';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($search_inboxes_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($search_inboxes_options));
} else {
$httpBody = $search_inboxes_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendEmail
*
* Send Email
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function sendEmail($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0])
{
$this->sendEmailWithHttpInfo($inbox_id, $send_email_options, $contentType);
}
/**
* Operation sendEmailWithHttpInfo
*
* Send Email
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function sendEmailWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0])
{
$request = $this->sendEmailRequest($inbox_id, $send_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation sendEmailAsync
*
* Send Email
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailAsync($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0])
{
return $this->sendEmailAsyncWithHttpInfo($inbox_id, $send_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendEmailAsyncWithHttpInfo
*
* Send Email
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailAsyncWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0])
{
$returnType = '';
$request = $this->sendEmailRequest($inbox_id, $send_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendEmail'
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendEmailRequest($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmail'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling sendEmail'
);
}
// verify the required parameter 'send_email_options' is set
if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_email_options when calling sendEmail'
);
}
$resourcePath = '/inboxes/{inboxId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options));
} else {
$httpBody = $send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendEmailAndConfirm
*
* Send email and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentEmailDto
*/
public function sendEmailAndConfirm($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0])
{
list($response) = $this->sendEmailAndConfirmWithHttpInfo($inbox_id, $send_email_options, $contentType);
return $response;
}
/**
* Operation sendEmailAndConfirmWithHttpInfo
*
* Send email and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function sendEmailAndConfirmWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0])
{
$request = $this->sendEmailAndConfirmRequest($inbox_id, $send_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation sendEmailAndConfirmAsync
*
* Send email and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailAndConfirmAsync($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0])
{
return $this->sendEmailAndConfirmAsyncWithHttpInfo($inbox_id, $send_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendEmailAndConfirmAsyncWithHttpInfo
*
* Send email and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailAndConfirmAsyncWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0])
{
$returnType = '\MailSlurp\Models\SentEmailDto';
$request = $this->sendEmailAndConfirmRequest($inbox_id, $send_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendEmailAndConfirm'
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailAndConfirm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendEmailAndConfirmRequest($inbox_id, $send_email_options, string $contentType = self::contentTypes['sendEmailAndConfirm'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling sendEmailAndConfirm'
);
}
// verify the required parameter 'send_email_options' is set
if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_email_options when calling sendEmailAndConfirm'
);
}
$resourcePath = '/inboxes/{inboxId}/confirm';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options));
} else {
$httpBody = $send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendEmailWithQueue
*
* Send email with queue
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param bool $validate_before_enqueue Validate before adding to queue (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function sendEmailWithQueue($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0])
{
$this->sendEmailWithQueueWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, $contentType);
}
/**
* Operation sendEmailWithQueueWithHttpInfo
*
* Send email with queue
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param bool $validate_before_enqueue Validate before adding to queue (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function sendEmailWithQueueWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0])
{
$request = $this->sendEmailWithQueueRequest($inbox_id, $validate_before_enqueue, $send_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation sendEmailWithQueueAsync
*
* Send email with queue
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param bool $validate_before_enqueue Validate before adding to queue (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailWithQueueAsync($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0])
{
return $this->sendEmailWithQueueAsyncWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendEmailWithQueueAsyncWithHttpInfo
*
* Send email with queue
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param bool $validate_before_enqueue Validate before adding to queue (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailWithQueueAsyncWithHttpInfo($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0])
{
$returnType = '';
$request = $this->sendEmailWithQueueRequest($inbox_id, $validate_before_enqueue, $send_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendEmailWithQueue'
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param bool $validate_before_enqueue Validate before adding to queue (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailWithQueue'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendEmailWithQueueRequest($inbox_id, $validate_before_enqueue, $send_email_options, string $contentType = self::contentTypes['sendEmailWithQueue'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling sendEmailWithQueue'
);
}
// verify the required parameter 'validate_before_enqueue' is set
if ($validate_before_enqueue === null || (is_array($validate_before_enqueue) && count($validate_before_enqueue) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $validate_before_enqueue when calling sendEmailWithQueue'
);
}
// verify the required parameter 'send_email_options' is set
if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_email_options when calling sendEmailWithQueue'
);
}
$resourcePath = '/inboxes/{inboxId}/with-queue';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$validate_before_enqueue,
'validateBeforeEnqueue', // param base name
'boolean', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options));
} else {
$httpBody = $send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendSmtpEnvelope
*
* Send email using an SMTP mail envelope and message body and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options send_smtp_envelope_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentEmailDto
*/
public function sendSmtpEnvelope($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0])
{
list($response) = $this->sendSmtpEnvelopeWithHttpInfo($inbox_id, $send_smtp_envelope_options, $contentType);
return $response;
}
/**
* Operation sendSmtpEnvelopeWithHttpInfo
*
* Send email using an SMTP mail envelope and message body and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function sendSmtpEnvelopeWithHttpInfo($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0])
{
$request = $this->sendSmtpEnvelopeRequest($inbox_id, $send_smtp_envelope_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation sendSmtpEnvelopeAsync
*
* Send email using an SMTP mail envelope and message body and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendSmtpEnvelopeAsync($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0])
{
return $this->sendSmtpEnvelopeAsyncWithHttpInfo($inbox_id, $send_smtp_envelope_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendSmtpEnvelopeAsyncWithHttpInfo
*
* Send email using an SMTP mail envelope and message body and return sent confirmation
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendSmtpEnvelopeAsyncWithHttpInfo($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0])
{
$returnType = '\MailSlurp\Models\SentEmailDto';
$request = $this->sendSmtpEnvelopeRequest($inbox_id, $send_smtp_envelope_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendSmtpEnvelope'
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendSMTPEnvelopeOptions $send_smtp_envelope_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendSmtpEnvelope'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendSmtpEnvelopeRequest($inbox_id, $send_smtp_envelope_options, string $contentType = self::contentTypes['sendSmtpEnvelope'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling sendSmtpEnvelope'
);
}
// verify the required parameter 'send_smtp_envelope_options' is set
if ($send_smtp_envelope_options === null || (is_array($send_smtp_envelope_options) && count($send_smtp_envelope_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_smtp_envelope_options when calling sendSmtpEnvelope'
);
}
$resourcePath = '/inboxes/{inboxId}/smtp-envelope';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_smtp_envelope_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_smtp_envelope_options));
} else {
$httpBody = $send_smtp_envelope_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendTestEmail
*
* Send a test email to inbox
*
* @param string $inbox_id inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function sendTestEmail($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0])
{
$this->sendTestEmailWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation sendTestEmailWithHttpInfo
*
* Send a test email to inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function sendTestEmailWithHttpInfo($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0])
{
$request = $this->sendTestEmailRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation sendTestEmailAsync
*
* Send a test email to inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendTestEmailAsync($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0])
{
return $this->sendTestEmailAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendTestEmailAsyncWithHttpInfo
*
* Send a test email to inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendTestEmailAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0])
{
$returnType = '';
$request = $this->sendTestEmailRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendTestEmail'
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendTestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendTestEmailRequest($inbox_id, string $contentType = self::contentTypes['sendTestEmail'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling sendTestEmail'
);
}
$resourcePath = '/inboxes/{inboxId}/send-test-email';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendWithSchedule
*
* Send email with with delay or schedule
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required)
* @param \DateTime $send_at_timestamp Sending timestamp (optional)
* @param int $send_at_now_plus_seconds Send after n seconds (optional)
* @param bool $validate_before_enqueue Validate before adding to queue (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ScheduledJobDto
*/
public function sendWithSchedule($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0])
{
list($response) = $this->sendWithScheduleWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType);
return $response;
}
/**
* Operation sendWithScheduleWithHttpInfo
*
* Send email with with delay or schedule
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param \DateTime $send_at_timestamp Sending timestamp (optional)
* @param int $send_at_now_plus_seconds Send after n seconds (optional)
* @param bool $validate_before_enqueue Validate before adding to queue (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ScheduledJobDto, HTTP status code, HTTP response headers (array of strings)
*/
public function sendWithScheduleWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0])
{
$request = $this->sendWithScheduleRequest($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\ScheduledJobDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ScheduledJobDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ScheduledJobDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ScheduledJobDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ScheduledJobDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation sendWithScheduleAsync
*
* Send email with with delay or schedule
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param \DateTime $send_at_timestamp Sending timestamp (optional)
* @param int $send_at_now_plus_seconds Send after n seconds (optional)
* @param bool $validate_before_enqueue Validate before adding to queue (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendWithScheduleAsync($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0])
{
return $this->sendWithScheduleAsyncWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendWithScheduleAsyncWithHttpInfo
*
* Send email with with delay or schedule
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param \DateTime $send_at_timestamp Sending timestamp (optional)
* @param int $send_at_now_plus_seconds Send after n seconds (optional)
* @param bool $validate_before_enqueue Validate before adding to queue (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendWithScheduleAsyncWithHttpInfo($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0])
{
$returnType = '\MailSlurp\Models\ScheduledJobDto';
$request = $this->sendWithScheduleRequest($inbox_id, $send_email_options, $send_at_timestamp, $send_at_now_plus_seconds, $validate_before_enqueue, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendWithSchedule'
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param \DateTime $send_at_timestamp Sending timestamp (optional)
* @param int $send_at_now_plus_seconds Send after n seconds (optional)
* @param bool $validate_before_enqueue Validate before adding to queue (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendWithSchedule'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendWithScheduleRequest($inbox_id, $send_email_options, $send_at_timestamp = null, $send_at_now_plus_seconds = null, $validate_before_enqueue = null, string $contentType = self::contentTypes['sendWithSchedule'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling sendWithSchedule'
);
}
// verify the required parameter 'send_email_options' is set
if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_email_options when calling sendWithSchedule'
);
}
$resourcePath = '/inboxes/{inboxId}/with-schedule';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$send_at_timestamp,
'sendAtTimestamp', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$send_at_now_plus_seconds,
'sendAtNowPlusSeconds', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$validate_before_enqueue,
'validateBeforeEnqueue', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options));
} else {
$httpBody = $send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation setInboxFavourited
*
* Set inbox favourited state
*
* @param string $inbox_id ID of inbox to set favourite state (required)
* @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options set_inbox_favourited_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function setInboxFavourited($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0])
{
list($response) = $this->setInboxFavouritedWithHttpInfo($inbox_id, $set_inbox_favourited_options, $contentType);
return $response;
}
/**
* Operation setInboxFavouritedWithHttpInfo
*
* Set inbox favourited state
*
* @param string $inbox_id ID of inbox to set favourite state (required)
* @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function setInboxFavouritedWithHttpInfo($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0])
{
$request = $this->setInboxFavouritedRequest($inbox_id, $set_inbox_favourited_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation setInboxFavouritedAsync
*
* Set inbox favourited state
*
* @param string $inbox_id ID of inbox to set favourite state (required)
* @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function setInboxFavouritedAsync($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0])
{
return $this->setInboxFavouritedAsyncWithHttpInfo($inbox_id, $set_inbox_favourited_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation setInboxFavouritedAsyncWithHttpInfo
*
* Set inbox favourited state
*
* @param string $inbox_id ID of inbox to set favourite state (required)
* @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function setInboxFavouritedAsyncWithHttpInfo($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->setInboxFavouritedRequest($inbox_id, $set_inbox_favourited_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'setInboxFavourited'
*
* @param string $inbox_id ID of inbox to set favourite state (required)
* @param \MailSlurp\Models\SetInboxFavouritedOptions $set_inbox_favourited_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['setInboxFavourited'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function setInboxFavouritedRequest($inbox_id, $set_inbox_favourited_options, string $contentType = self::contentTypes['setInboxFavourited'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling setInboxFavourited'
);
}
// verify the required parameter 'set_inbox_favourited_options' is set
if ($set_inbox_favourited_options === null || (is_array($set_inbox_favourited_options) && count($set_inbox_favourited_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $set_inbox_favourited_options when calling setInboxFavourited'
);
}
$resourcePath = '/inboxes/{inboxId}/favourite';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($set_inbox_favourited_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($set_inbox_favourited_options));
} else {
$httpBody = $set_inbox_favourited_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateImapAccess
*
* @param \MailSlurp\Models\UpdateImapAccessOptions $update_imap_access_options update_imap_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImapAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function updateImapAccess($update_imap_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateImapAccess'][0])
{
$this->updateImapAccessWithHttpInfo($update_imap_access_options, $inbox_id, $contentType);
}
/**
* Operation updateImapAccessWithHttpInfo
*
* @param \MailSlurp\Models\UpdateImapAccessOptions $update_imap_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImapAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function updateImapAccessWithHttpInfo($update_imap_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateImapAccess'][0])
{
$request = $this->updateImapAccessRequest($update_imap_access_options, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation updateImapAccessAsync
*
* @param \MailSlurp\Models\UpdateImapAccessOptions $update_imap_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImapAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateImapAccessAsync($update_imap_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateImapAccess'][0])
{
return $this->updateImapAccessAsyncWithHttpInfo($update_imap_access_options, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateImapAccessAsyncWithHttpInfo
*
* @param \MailSlurp\Models\UpdateImapAccessOptions $update_imap_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImapAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateImapAccessAsyncWithHttpInfo($update_imap_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateImapAccess'][0])
{
$returnType = '';
$request = $this->updateImapAccessRequest($update_imap_access_options, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateImapAccess'
*
* @param \MailSlurp\Models\UpdateImapAccessOptions $update_imap_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImapAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateImapAccessRequest($update_imap_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateImapAccess'][0])
{
// verify the required parameter 'update_imap_access_options' is set
if ($update_imap_access_options === null || (is_array($update_imap_access_options) && count($update_imap_access_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_imap_access_options when calling updateImapAccess'
);
}
$resourcePath = '/inboxes/imap-access';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_imap_access_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_imap_access_options));
} else {
$httpBody = $update_imap_access_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateInbox
*
* Update Inbox. Change name and description. Email address is not editable.
*
* @param string $inbox_id inbox_id (required)
* @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options update_inbox_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function updateInbox($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0])
{
list($response) = $this->updateInboxWithHttpInfo($inbox_id, $update_inbox_options, $contentType);
return $response;
}
/**
* Operation updateInboxWithHttpInfo
*
* Update Inbox. Change name and description. Email address is not editable.
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateInboxWithHttpInfo($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0])
{
$request = $this->updateInboxRequest($inbox_id, $update_inbox_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateInboxAsync
*
* Update Inbox. Change name and description. Email address is not editable.
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateInboxAsync($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0])
{
return $this->updateInboxAsyncWithHttpInfo($inbox_id, $update_inbox_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateInboxAsyncWithHttpInfo
*
* Update Inbox. Change name and description. Email address is not editable.
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateInboxAsyncWithHttpInfo($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->updateInboxRequest($inbox_id, $update_inbox_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateInbox'
*
* @param string $inbox_id (required)
* @param \MailSlurp\Models\UpdateInboxOptions $update_inbox_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateInboxRequest($inbox_id, $update_inbox_options, string $contentType = self::contentTypes['updateInbox'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling updateInbox'
);
}
// verify the required parameter 'update_inbox_options' is set
if ($update_inbox_options === null || (is_array($update_inbox_options) && count($update_inbox_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_inbox_options when calling updateInbox'
);
}
$resourcePath = '/inboxes/{inboxId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_inbox_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_inbox_options));
} else {
$httpBody = $update_inbox_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateSmtpAccess
*
* @param \MailSlurp\Models\UpdateSmtpAccessOptions $update_smtp_access_options update_smtp_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function updateSmtpAccess($update_smtp_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateSmtpAccess'][0])
{
$this->updateSmtpAccessWithHttpInfo($update_smtp_access_options, $inbox_id, $contentType);
}
/**
* Operation updateSmtpAccessWithHttpInfo
*
* @param \MailSlurp\Models\UpdateSmtpAccessOptions $update_smtp_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpAccess'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function updateSmtpAccessWithHttpInfo($update_smtp_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateSmtpAccess'][0])
{
$request = $this->updateSmtpAccessRequest($update_smtp_access_options, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation updateSmtpAccessAsync
*
* @param \MailSlurp\Models\UpdateSmtpAccessOptions $update_smtp_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateSmtpAccessAsync($update_smtp_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateSmtpAccess'][0])
{
return $this->updateSmtpAccessAsyncWithHttpInfo($update_smtp_access_options, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateSmtpAccessAsyncWithHttpInfo
*
* @param \MailSlurp\Models\UpdateSmtpAccessOptions $update_smtp_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateSmtpAccessAsyncWithHttpInfo($update_smtp_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateSmtpAccess'][0])
{
$returnType = '';
$request = $this->updateSmtpAccessRequest($update_smtp_access_options, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateSmtpAccess'
*
* @param \MailSlurp\Models\UpdateSmtpAccessOptions $update_smtp_access_options (required)
* @param string $inbox_id Inbox ID (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateSmtpAccess'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateSmtpAccessRequest($update_smtp_access_options, $inbox_id = null, string $contentType = self::contentTypes['updateSmtpAccess'][0])
{
// verify the required parameter 'update_smtp_access_options' is set
if ($update_smtp_access_options === null || (is_array($update_smtp_access_options) && count($update_smtp_access_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_smtp_access_options when calling updateSmtpAccess'
);
}
$resourcePath = '/inboxes/smtp-access';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_smtp_access_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_smtp_access_options));
} else {
$httpBody = $update_smtp_access_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* ImapControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* ImapControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ImapControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'imapServerFetch' => [
'application/json',
],
'imapServerGet' => [
'application/json',
],
'imapServerList' => [
'application/json',
],
'imapServerMailbox' => [
'application/json',
],
'imapServerSearch' => [
'application/json',
],
'imapServerStatus' => [
'application/json',
],
'imapServerUpdateFlags' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation imapServerFetch
*
* Fetch message in an inbox
*
* @param int $seq_num seq_num (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerFetch'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapServerFetchResult
*/
public function imapServerFetch($seq_num, $inbox_id = null, string $contentType = self::contentTypes['imapServerFetch'][0])
{
list($response) = $this->imapServerFetchWithHttpInfo($seq_num, $inbox_id, $contentType);
return $response;
}
/**
* Operation imapServerFetchWithHttpInfo
*
* Fetch message in an inbox
*
* @param int $seq_num (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerFetch'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapServerFetchResult, HTTP status code, HTTP response headers (array of strings)
*/
public function imapServerFetchWithHttpInfo($seq_num, $inbox_id = null, string $contentType = self::contentTypes['imapServerFetch'][0])
{
$request = $this->imapServerFetchRequest($seq_num, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapServerFetchResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapServerFetchResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapServerFetchResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapServerFetchResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapServerFetchResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation imapServerFetchAsync
*
* Fetch message in an inbox
*
* @param int $seq_num (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerFetch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerFetchAsync($seq_num, $inbox_id = null, string $contentType = self::contentTypes['imapServerFetch'][0])
{
return $this->imapServerFetchAsyncWithHttpInfo($seq_num, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation imapServerFetchAsyncWithHttpInfo
*
* Fetch message in an inbox
*
* @param int $seq_num (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerFetch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerFetchAsyncWithHttpInfo($seq_num, $inbox_id = null, string $contentType = self::contentTypes['imapServerFetch'][0])
{
$returnType = '\MailSlurp\Models\ImapServerFetchResult';
$request = $this->imapServerFetchRequest($seq_num, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'imapServerFetch'
*
* @param int $seq_num (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerFetch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function imapServerFetchRequest($seq_num, $inbox_id = null, string $contentType = self::contentTypes['imapServerFetch'][0])
{
// verify the required parameter 'seq_num' is set
if ($seq_num === null || (is_array($seq_num) && count($seq_num) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $seq_num when calling imapServerFetch'
);
}
$resourcePath = '/imap/server/fetch';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$seq_num,
'seqNum', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation imapServerGet
*
* Get a message by email ID
*
* @param string $email_id Email ID to get (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerGet'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapServerGetResult
*/
public function imapServerGet($email_id, $inbox_id = null, string $contentType = self::contentTypes['imapServerGet'][0])
{
list($response) = $this->imapServerGetWithHttpInfo($email_id, $inbox_id, $contentType);
return $response;
}
/**
* Operation imapServerGetWithHttpInfo
*
* Get a message by email ID
*
* @param string $email_id Email ID to get (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerGet'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapServerGetResult, HTTP status code, HTTP response headers (array of strings)
*/
public function imapServerGetWithHttpInfo($email_id, $inbox_id = null, string $contentType = self::contentTypes['imapServerGet'][0])
{
$request = $this->imapServerGetRequest($email_id, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapServerGetResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapServerGetResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapServerGetResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapServerGetResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapServerGetResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation imapServerGetAsync
*
* Get a message by email ID
*
* @param string $email_id Email ID to get (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerGetAsync($email_id, $inbox_id = null, string $contentType = self::contentTypes['imapServerGet'][0])
{
return $this->imapServerGetAsyncWithHttpInfo($email_id, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation imapServerGetAsyncWithHttpInfo
*
* Get a message by email ID
*
* @param string $email_id Email ID to get (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerGetAsyncWithHttpInfo($email_id, $inbox_id = null, string $contentType = self::contentTypes['imapServerGet'][0])
{
$returnType = '\MailSlurp\Models\ImapServerGetResult';
$request = $this->imapServerGetRequest($email_id, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'imapServerGet'
*
* @param string $email_id Email ID to get (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function imapServerGetRequest($email_id, $inbox_id = null, string $contentType = self::contentTypes['imapServerGet'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling imapServerGet'
);
}
$resourcePath = '/imap/server/get';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_id,
'emailId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation imapServerList
*
* List messages in an inbox
*
* @param \MailSlurp\Models\ImapServerListOptions $imap_server_list_options imap_server_list_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerList'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapServerListResult
*/
public function imapServerList($imap_server_list_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerList'][0])
{
list($response) = $this->imapServerListWithHttpInfo($imap_server_list_options, $inbox_id, $contentType);
return $response;
}
/**
* Operation imapServerListWithHttpInfo
*
* List messages in an inbox
*
* @param \MailSlurp\Models\ImapServerListOptions $imap_server_list_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerList'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapServerListResult, HTTP status code, HTTP response headers (array of strings)
*/
public function imapServerListWithHttpInfo($imap_server_list_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerList'][0])
{
$request = $this->imapServerListRequest($imap_server_list_options, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapServerListResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapServerListResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapServerListResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapServerListResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapServerListResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation imapServerListAsync
*
* List messages in an inbox
*
* @param \MailSlurp\Models\ImapServerListOptions $imap_server_list_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerList'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerListAsync($imap_server_list_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerList'][0])
{
return $this->imapServerListAsyncWithHttpInfo($imap_server_list_options, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation imapServerListAsyncWithHttpInfo
*
* List messages in an inbox
*
* @param \MailSlurp\Models\ImapServerListOptions $imap_server_list_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerList'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerListAsyncWithHttpInfo($imap_server_list_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerList'][0])
{
$returnType = '\MailSlurp\Models\ImapServerListResult';
$request = $this->imapServerListRequest($imap_server_list_options, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'imapServerList'
*
* @param \MailSlurp\Models\ImapServerListOptions $imap_server_list_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerList'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function imapServerListRequest($imap_server_list_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerList'][0])
{
// verify the required parameter 'imap_server_list_options' is set
if ($imap_server_list_options === null || (is_array($imap_server_list_options) && count($imap_server_list_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $imap_server_list_options when calling imapServerList'
);
}
$resourcePath = '/imap/server/list';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($imap_server_list_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($imap_server_list_options));
} else {
$httpBody = $imap_server_list_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation imapServerMailbox
*
* Create a new mailbox if possible
*
* @param string $name Inbox email address to create (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerMailbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapServerMailboxResult
*/
public function imapServerMailbox($name, string $contentType = self::contentTypes['imapServerMailbox'][0])
{
list($response) = $this->imapServerMailboxWithHttpInfo($name, $contentType);
return $response;
}
/**
* Operation imapServerMailboxWithHttpInfo
*
* Create a new mailbox if possible
*
* @param string $name Inbox email address to create (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerMailbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapServerMailboxResult, HTTP status code, HTTP response headers (array of strings)
*/
public function imapServerMailboxWithHttpInfo($name, string $contentType = self::contentTypes['imapServerMailbox'][0])
{
$request = $this->imapServerMailboxRequest($name, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapServerMailboxResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapServerMailboxResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapServerMailboxResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapServerMailboxResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapServerMailboxResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation imapServerMailboxAsync
*
* Create a new mailbox if possible
*
* @param string $name Inbox email address to create (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerMailbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerMailboxAsync($name, string $contentType = self::contentTypes['imapServerMailbox'][0])
{
return $this->imapServerMailboxAsyncWithHttpInfo($name, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation imapServerMailboxAsyncWithHttpInfo
*
* Create a new mailbox if possible
*
* @param string $name Inbox email address to create (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerMailbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerMailboxAsyncWithHttpInfo($name, string $contentType = self::contentTypes['imapServerMailbox'][0])
{
$returnType = '\MailSlurp\Models\ImapServerMailboxResult';
$request = $this->imapServerMailboxRequest($name, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'imapServerMailbox'
*
* @param string $name Inbox email address to create (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerMailbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function imapServerMailboxRequest($name, string $contentType = self::contentTypes['imapServerMailbox'][0])
{
// verify the required parameter 'name' is set
if ($name === null || (is_array($name) && count($name) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $name when calling imapServerMailbox'
);
}
$resourcePath = '/imap/server/mailbox';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$name,
'name', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation imapServerSearch
*
* Search messages in an inbox
*
* @param \MailSlurp\Models\ImapServerSearchOptions $imap_server_search_options imap_server_search_options (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerSearch'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapServerSearchResult
*/
public function imapServerSearch($imap_server_search_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerSearch'][0])
{
list($response) = $this->imapServerSearchWithHttpInfo($imap_server_search_options, $inbox_id, $contentType);
return $response;
}
/**
* Operation imapServerSearchWithHttpInfo
*
* Search messages in an inbox
*
* @param \MailSlurp\Models\ImapServerSearchOptions $imap_server_search_options (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerSearch'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapServerSearchResult, HTTP status code, HTTP response headers (array of strings)
*/
public function imapServerSearchWithHttpInfo($imap_server_search_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerSearch'][0])
{
$request = $this->imapServerSearchRequest($imap_server_search_options, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapServerSearchResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapServerSearchResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapServerSearchResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapServerSearchResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapServerSearchResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation imapServerSearchAsync
*
* Search messages in an inbox
*
* @param \MailSlurp\Models\ImapServerSearchOptions $imap_server_search_options (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerSearch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerSearchAsync($imap_server_search_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerSearch'][0])
{
return $this->imapServerSearchAsyncWithHttpInfo($imap_server_search_options, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation imapServerSearchAsyncWithHttpInfo
*
* Search messages in an inbox
*
* @param \MailSlurp\Models\ImapServerSearchOptions $imap_server_search_options (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerSearch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerSearchAsyncWithHttpInfo($imap_server_search_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerSearch'][0])
{
$returnType = '\MailSlurp\Models\ImapServerSearchResult';
$request = $this->imapServerSearchRequest($imap_server_search_options, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'imapServerSearch'
*
* @param \MailSlurp\Models\ImapServerSearchOptions $imap_server_search_options (required)
* @param string $inbox_id Inbox ID to search (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerSearch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function imapServerSearchRequest($imap_server_search_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerSearch'][0])
{
// verify the required parameter 'imap_server_search_options' is set
if ($imap_server_search_options === null || (is_array($imap_server_search_options) && count($imap_server_search_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $imap_server_search_options when calling imapServerSearch'
);
}
$resourcePath = '/imap/server/search';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($imap_server_search_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($imap_server_search_options));
} else {
$httpBody = $imap_server_search_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation imapServerStatus
*
* Get status for mailbox
*
* @param \MailSlurp\Models\ImapServerStatusOptions $imap_server_status_options imap_server_status_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ImapServerStatusResult
*/
public function imapServerStatus($imap_server_status_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerStatus'][0])
{
list($response) = $this->imapServerStatusWithHttpInfo($imap_server_status_options, $inbox_id, $contentType);
return $response;
}
/**
* Operation imapServerStatusWithHttpInfo
*
* Get status for mailbox
*
* @param \MailSlurp\Models\ImapServerStatusOptions $imap_server_status_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ImapServerStatusResult, HTTP status code, HTTP response headers (array of strings)
*/
public function imapServerStatusWithHttpInfo($imap_server_status_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerStatus'][0])
{
$request = $this->imapServerStatusRequest($imap_server_status_options, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ImapServerStatusResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ImapServerStatusResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ImapServerStatusResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ImapServerStatusResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ImapServerStatusResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation imapServerStatusAsync
*
* Get status for mailbox
*
* @param \MailSlurp\Models\ImapServerStatusOptions $imap_server_status_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerStatusAsync($imap_server_status_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerStatus'][0])
{
return $this->imapServerStatusAsyncWithHttpInfo($imap_server_status_options, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation imapServerStatusAsyncWithHttpInfo
*
* Get status for mailbox
*
* @param \MailSlurp\Models\ImapServerStatusOptions $imap_server_status_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerStatusAsyncWithHttpInfo($imap_server_status_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerStatus'][0])
{
$returnType = '\MailSlurp\Models\ImapServerStatusResult';
$request = $this->imapServerStatusRequest($imap_server_status_options, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'imapServerStatus'
*
* @param \MailSlurp\Models\ImapServerStatusOptions $imap_server_status_options (required)
* @param string $inbox_id Inbox ID to list (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function imapServerStatusRequest($imap_server_status_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerStatus'][0])
{
// verify the required parameter 'imap_server_status_options' is set
if ($imap_server_status_options === null || (is_array($imap_server_status_options) && count($imap_server_status_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $imap_server_status_options when calling imapServerStatus'
);
}
$resourcePath = '/imap/server/status';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($imap_server_status_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($imap_server_status_options));
} else {
$httpBody = $imap_server_status_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation imapServerUpdateFlags
*
* @param \MailSlurp\Models\ImapUpdateFlagsOptions $imap_update_flags_options imap_update_flags_options (required)
* @param string $inbox_id inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerUpdateFlags'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function imapServerUpdateFlags($imap_update_flags_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerUpdateFlags'][0])
{
$this->imapServerUpdateFlagsWithHttpInfo($imap_update_flags_options, $inbox_id, $contentType);
}
/**
* Operation imapServerUpdateFlagsWithHttpInfo
*
* @param \MailSlurp\Models\ImapUpdateFlagsOptions $imap_update_flags_options (required)
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerUpdateFlags'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function imapServerUpdateFlagsWithHttpInfo($imap_update_flags_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerUpdateFlags'][0])
{
$request = $this->imapServerUpdateFlagsRequest($imap_update_flags_options, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation imapServerUpdateFlagsAsync
*
* @param \MailSlurp\Models\ImapUpdateFlagsOptions $imap_update_flags_options (required)
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerUpdateFlags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerUpdateFlagsAsync($imap_update_flags_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerUpdateFlags'][0])
{
return $this->imapServerUpdateFlagsAsyncWithHttpInfo($imap_update_flags_options, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation imapServerUpdateFlagsAsyncWithHttpInfo
*
* @param \MailSlurp\Models\ImapUpdateFlagsOptions $imap_update_flags_options (required)
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerUpdateFlags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function imapServerUpdateFlagsAsyncWithHttpInfo($imap_update_flags_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerUpdateFlags'][0])
{
$returnType = '';
$request = $this->imapServerUpdateFlagsRequest($imap_update_flags_options, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'imapServerUpdateFlags'
*
* @param \MailSlurp\Models\ImapUpdateFlagsOptions $imap_update_flags_options (required)
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['imapServerUpdateFlags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function imapServerUpdateFlagsRequest($imap_update_flags_options, $inbox_id = null, string $contentType = self::contentTypes['imapServerUpdateFlags'][0])
{
// verify the required parameter 'imap_update_flags_options' is set
if ($imap_update_flags_options === null || (is_array($imap_update_flags_options) && count($imap_update_flags_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $imap_update_flags_options when calling imapServerUpdateFlags'
);
}
$resourcePath = '/imap/server/update-flags';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($imap_update_flags_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($imap_update_flags_options));
} else {
$httpBody = $imap_update_flags_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* GroupControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* GroupControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class GroupControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'addContactsToGroup' => [
'application/json',
],
'createGroup' => [
'application/json',
],
'deleteGroup' => [
'application/json',
],
'getAllGroups' => [
'application/json',
],
'getGroup' => [
'application/json',
],
'getGroupWithContacts' => [
'application/json',
],
'getGroupWithContactsPaginated' => [
'application/json',
],
'getGroups' => [
'application/json',
],
'removeContactsFromGroup' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation addContactsToGroup
*
* Add contacts to a group
*
* @param string $group_id group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GroupContactsDto
*/
public function addContactsToGroup($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0])
{
list($response) = $this->addContactsToGroupWithHttpInfo($group_id, $update_group_contacts, $contentType);
return $response;
}
/**
* Operation addContactsToGroupWithHttpInfo
*
* Add contacts to a group
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GroupContactsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function addContactsToGroupWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0])
{
$request = $this->addContactsToGroupRequest($group_id, $update_group_contacts, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GroupContactsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GroupContactsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupContactsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GroupContactsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GroupContactsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation addContactsToGroupAsync
*
* Add contacts to a group
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function addContactsToGroupAsync($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0])
{
return $this->addContactsToGroupAsyncWithHttpInfo($group_id, $update_group_contacts, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation addContactsToGroupAsyncWithHttpInfo
*
* Add contacts to a group
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function addContactsToGroupAsyncWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0])
{
$returnType = '\MailSlurp\Models\GroupContactsDto';
$request = $this->addContactsToGroupRequest($group_id, $update_group_contacts, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'addContactsToGroup'
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactsToGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function addContactsToGroupRequest($group_id, $update_group_contacts, string $contentType = self::contentTypes['addContactsToGroup'][0])
{
// verify the required parameter 'group_id' is set
if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $group_id when calling addContactsToGroup'
);
}
// verify the required parameter 'update_group_contacts' is set
if ($update_group_contacts === null || (is_array($update_group_contacts) && count($update_group_contacts) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_group_contacts when calling addContactsToGroup'
);
}
$resourcePath = '/groups/{groupId}/contacts';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($group_id !== null) {
$resourcePath = str_replace(
'{' . 'groupId' . '}',
ObjectSerializer::toPathValue($group_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_group_contacts)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_group_contacts));
} else {
$httpBody = $update_group_contacts;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createGroup
*
* Create a group
*
* @param \MailSlurp\Models\CreateGroupOptions $create_group_options create_group_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GroupDto
*/
public function createGroup($create_group_options, string $contentType = self::contentTypes['createGroup'][0])
{
list($response) = $this->createGroupWithHttpInfo($create_group_options, $contentType);
return $response;
}
/**
* Operation createGroupWithHttpInfo
*
* Create a group
*
* @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GroupDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createGroupWithHttpInfo($create_group_options, string $contentType = self::contentTypes['createGroup'][0])
{
$request = $this->createGroupRequest($create_group_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\GroupDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GroupDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GroupDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GroupDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createGroupAsync
*
* Create a group
*
* @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createGroupAsync($create_group_options, string $contentType = self::contentTypes['createGroup'][0])
{
return $this->createGroupAsyncWithHttpInfo($create_group_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createGroupAsyncWithHttpInfo
*
* Create a group
*
* @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createGroupAsyncWithHttpInfo($create_group_options, string $contentType = self::contentTypes['createGroup'][0])
{
$returnType = '\MailSlurp\Models\GroupDto';
$request = $this->createGroupRequest($create_group_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createGroup'
*
* @param \MailSlurp\Models\CreateGroupOptions $create_group_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createGroupRequest($create_group_options, string $contentType = self::contentTypes['createGroup'][0])
{
// verify the required parameter 'create_group_options' is set
if ($create_group_options === null || (is_array($create_group_options) && count($create_group_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_group_options when calling createGroup'
);
}
$resourcePath = '/groups';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_group_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_group_options));
} else {
$httpBody = $create_group_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteGroup
*
* Delete group
*
* @param string $group_id group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteGroup($group_id, string $contentType = self::contentTypes['deleteGroup'][0])
{
$this->deleteGroupWithHttpInfo($group_id, $contentType);
}
/**
* Operation deleteGroupWithHttpInfo
*
* Delete group
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteGroupWithHttpInfo($group_id, string $contentType = self::contentTypes['deleteGroup'][0])
{
$request = $this->deleteGroupRequest($group_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteGroupAsync
*
* Delete group
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteGroupAsync($group_id, string $contentType = self::contentTypes['deleteGroup'][0])
{
return $this->deleteGroupAsyncWithHttpInfo($group_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteGroupAsyncWithHttpInfo
*
* Delete group
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteGroupAsyncWithHttpInfo($group_id, string $contentType = self::contentTypes['deleteGroup'][0])
{
$returnType = '';
$request = $this->deleteGroupRequest($group_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteGroup'
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteGroupRequest($group_id, string $contentType = self::contentTypes['deleteGroup'][0])
{
// verify the required parameter 'group_id' is set
if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $group_id when calling deleteGroup'
);
}
$resourcePath = '/groups/{groupId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($group_id !== null) {
$resourcePath = str_replace(
'{' . 'groupId' . '}',
ObjectSerializer::toPathValue($group_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllGroups
*
* Get all Contact Groups in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageGroupProjection
*/
public function getAllGroups($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0])
{
list($response) = $this->getAllGroupsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getAllGroupsWithHttpInfo
*
* Get all Contact Groups in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageGroupProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllGroupsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0])
{
$request = $this->getAllGroupsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageGroupProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageGroupProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageGroupProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageGroupProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageGroupProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllGroupsAsync
*
* Get all Contact Groups in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllGroupsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0])
{
return $this->getAllGroupsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllGroupsAsyncWithHttpInfo
*
* Get all Contact Groups in paginated format
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllGroupsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0])
{
$returnType = '\MailSlurp\Models\PageGroupProjection';
$request = $this->getAllGroupsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllGroups'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllGroups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllGroupsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllGroups'][0])
{
$resourcePath = '/groups/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getGroup
*
* Get group
*
* @param string $group_id group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GroupDto
*/
public function getGroup($group_id, string $contentType = self::contentTypes['getGroup'][0])
{
list($response) = $this->getGroupWithHttpInfo($group_id, $contentType);
return $response;
}
/**
* Operation getGroupWithHttpInfo
*
* Get group
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GroupDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getGroupWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroup'][0])
{
$request = $this->getGroupRequest($group_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GroupDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GroupDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GroupDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GroupDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getGroupAsync
*
* Get group
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupAsync($group_id, string $contentType = self::contentTypes['getGroup'][0])
{
return $this->getGroupAsyncWithHttpInfo($group_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getGroupAsyncWithHttpInfo
*
* Get group
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupAsyncWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroup'][0])
{
$returnType = '\MailSlurp\Models\GroupDto';
$request = $this->getGroupRequest($group_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getGroup'
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getGroupRequest($group_id, string $contentType = self::contentTypes['getGroup'][0])
{
// verify the required parameter 'group_id' is set
if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $group_id when calling getGroup'
);
}
$resourcePath = '/groups/{groupId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($group_id !== null) {
$resourcePath = str_replace(
'{' . 'groupId' . '}',
ObjectSerializer::toPathValue($group_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getGroupWithContacts
*
* Get group and contacts belonging to it
*
* @param string $group_id group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GroupContactsDto
*/
public function getGroupWithContacts($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0])
{
list($response) = $this->getGroupWithContactsWithHttpInfo($group_id, $contentType);
return $response;
}
/**
* Operation getGroupWithContactsWithHttpInfo
*
* Get group and contacts belonging to it
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GroupContactsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getGroupWithContactsWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0])
{
$request = $this->getGroupWithContactsRequest($group_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GroupContactsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GroupContactsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupContactsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GroupContactsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GroupContactsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getGroupWithContactsAsync
*
* Get group and contacts belonging to it
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupWithContactsAsync($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0])
{
return $this->getGroupWithContactsAsyncWithHttpInfo($group_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getGroupWithContactsAsyncWithHttpInfo
*
* Get group and contacts belonging to it
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupWithContactsAsyncWithHttpInfo($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0])
{
$returnType = '\MailSlurp\Models\GroupContactsDto';
$request = $this->getGroupWithContactsRequest($group_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getGroupWithContacts'
*
* @param string $group_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getGroupWithContactsRequest($group_id, string $contentType = self::contentTypes['getGroupWithContacts'][0])
{
// verify the required parameter 'group_id' is set
if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $group_id when calling getGroupWithContacts'
);
}
$resourcePath = '/groups/{groupId}/contacts';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($group_id !== null) {
$resourcePath = str_replace(
'{' . 'groupId' . '}',
ObjectSerializer::toPathValue($group_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getGroupWithContactsPaginated
*
* @param string $group_id group_id (required)
* @param int $page Optional page index in group contact pagination (optional, default to 0)
* @param int $size Optional page size in group contact pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageContactProjection
*/
public function getGroupWithContactsPaginated($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0])
{
list($response) = $this->getGroupWithContactsPaginatedWithHttpInfo($group_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getGroupWithContactsPaginatedWithHttpInfo
*
* @param string $group_id (required)
* @param int $page Optional page index in group contact pagination (optional, default to 0)
* @param int $size Optional page size in group contact pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageContactProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getGroupWithContactsPaginatedWithHttpInfo($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0])
{
$request = $this->getGroupWithContactsPaginatedRequest($group_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageContactProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageContactProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageContactProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageContactProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageContactProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getGroupWithContactsPaginatedAsync
*
* @param string $group_id (required)
* @param int $page Optional page index in group contact pagination (optional, default to 0)
* @param int $size Optional page size in group contact pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupWithContactsPaginatedAsync($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0])
{
return $this->getGroupWithContactsPaginatedAsyncWithHttpInfo($group_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getGroupWithContactsPaginatedAsyncWithHttpInfo
*
* @param string $group_id (required)
* @param int $page Optional page index in group contact pagination (optional, default to 0)
* @param int $size Optional page size in group contact pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupWithContactsPaginatedAsyncWithHttpInfo($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageContactProjection';
$request = $this->getGroupWithContactsPaginatedRequest($group_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getGroupWithContactsPaginated'
*
* @param string $group_id (required)
* @param int $page Optional page index in group contact pagination (optional, default to 0)
* @param int $size Optional page size in group contact pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroupWithContactsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getGroupWithContactsPaginatedRequest($group_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getGroupWithContactsPaginated'][0])
{
// verify the required parameter 'group_id' is set
if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $group_id when calling getGroupWithContactsPaginated'
);
}
$resourcePath = '/groups/{groupId}/contacts-paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($group_id !== null) {
$resourcePath = str_replace(
'{' . 'groupId' . '}',
ObjectSerializer::toPathValue($group_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getGroups
*
* Get all groups
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GroupProjection[]
*/
public function getGroups(string $contentType = self::contentTypes['getGroups'][0])
{
list($response) = $this->getGroupsWithHttpInfo($contentType);
return $response;
}
/**
* Operation getGroupsWithHttpInfo
*
* Get all groups
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GroupProjection[], HTTP status code, HTTP response headers (array of strings)
*/
public function getGroupsWithHttpInfo(string $contentType = self::contentTypes['getGroups'][0])
{
$request = $this->getGroupsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GroupProjection[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GroupProjection[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupProjection[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GroupProjection[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GroupProjection[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getGroupsAsync
*
* Get all groups
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupsAsync(string $contentType = self::contentTypes['getGroups'][0])
{
return $this->getGroupsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getGroupsAsyncWithHttpInfo
*
* Get all groups
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGroupsAsyncWithHttpInfo(string $contentType = self::contentTypes['getGroups'][0])
{
$returnType = '\MailSlurp\Models\GroupProjection[]';
$request = $this->getGroupsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getGroups'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGroups'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getGroupsRequest(string $contentType = self::contentTypes['getGroups'][0])
{
$resourcePath = '/groups';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation removeContactsFromGroup
*
* Remove contacts from a group
*
* @param string $group_id group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GroupContactsDto
*/
public function removeContactsFromGroup($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0])
{
list($response) = $this->removeContactsFromGroupWithHttpInfo($group_id, $update_group_contacts, $contentType);
return $response;
}
/**
* Operation removeContactsFromGroupWithHttpInfo
*
* Remove contacts from a group
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GroupContactsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function removeContactsFromGroupWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0])
{
$request = $this->removeContactsFromGroupRequest($group_id, $update_group_contacts, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GroupContactsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GroupContactsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GroupContactsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GroupContactsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GroupContactsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation removeContactsFromGroupAsync
*
* Remove contacts from a group
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function removeContactsFromGroupAsync($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0])
{
return $this->removeContactsFromGroupAsyncWithHttpInfo($group_id, $update_group_contacts, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation removeContactsFromGroupAsyncWithHttpInfo
*
* Remove contacts from a group
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function removeContactsFromGroupAsyncWithHttpInfo($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0])
{
$returnType = '\MailSlurp\Models\GroupContactsDto';
$request = $this->removeContactsFromGroupRequest($group_id, $update_group_contacts, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'removeContactsFromGroup'
*
* @param string $group_id (required)
* @param \MailSlurp\Models\UpdateGroupContacts $update_group_contacts (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactsFromGroup'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function removeContactsFromGroupRequest($group_id, $update_group_contacts, string $contentType = self::contentTypes['removeContactsFromGroup'][0])
{
// verify the required parameter 'group_id' is set
if ($group_id === null || (is_array($group_id) && count($group_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $group_id when calling removeContactsFromGroup'
);
}
// verify the required parameter 'update_group_contacts' is set
if ($update_group_contacts === null || (is_array($update_group_contacts) && count($update_group_contacts) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_group_contacts when calling removeContactsFromGroup'
);
}
$resourcePath = '/groups/{groupId}/contacts';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($group_id !== null) {
$resourcePath = str_replace(
'{' . 'groupId' . '}',
ObjectSerializer::toPathValue($group_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_group_contacts)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_group_contacts));
} else {
$httpBody = $update_group_contacts;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* FormControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* FormControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class FormControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'submitForm' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation submitForm
*
* Submit a form to be parsed and sent as an email to an address determined by the form fields
*
* @param string $_to The email address that submitted form should be sent to. (optional)
* @param string $_subject Optional subject of the email that will be sent. (optional)
* @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional)
* @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional)
* @param string $_success_message Optional success message to display if no _redirectTo present. (optional)
* @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional)
* @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function submitForm($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0])
{
list($response) = $this->submitFormWithHttpInfo($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType);
return $response;
}
/**
* Operation submitFormWithHttpInfo
*
* Submit a form to be parsed and sent as an email to an address determined by the form fields
*
* @param string $_to The email address that submitted form should be sent to. (optional)
* @param string $_subject Optional subject of the email that will be sent. (optional)
* @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional)
* @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional)
* @param string $_success_message Optional success message to display if no _redirectTo present. (optional)
* @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional)
* @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function submitFormWithHttpInfo($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0])
{
$request = $this->submitFormRequest($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation submitFormAsync
*
* Submit a form to be parsed and sent as an email to an address determined by the form fields
*
* @param string $_to The email address that submitted form should be sent to. (optional)
* @param string $_subject Optional subject of the email that will be sent. (optional)
* @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional)
* @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional)
* @param string $_success_message Optional success message to display if no _redirectTo present. (optional)
* @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional)
* @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function submitFormAsync($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0])
{
return $this->submitFormAsyncWithHttpInfo($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation submitFormAsyncWithHttpInfo
*
* Submit a form to be parsed and sent as an email to an address determined by the form fields
*
* @param string $_to The email address that submitted form should be sent to. (optional)
* @param string $_subject Optional subject of the email that will be sent. (optional)
* @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional)
* @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional)
* @param string $_success_message Optional success message to display if no _redirectTo present. (optional)
* @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional)
* @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function submitFormAsyncWithHttpInfo($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0])
{
$returnType = 'string';
$request = $this->submitFormRequest($_to, $_subject, $_redirect_to, $_email_address, $_success_message, $_spam_check, $other_parameters, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'submitForm'
*
* @param string $_to The email address that submitted form should be sent to. (optional)
* @param string $_subject Optional subject of the email that will be sent. (optional)
* @param string $_redirect_to Optional URL to redirect form submitter to after submission. If not present user will see a success message. (optional)
* @param string $_email_address Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later. (optional)
* @param string $_success_message Optional success message to display if no _redirectTo present. (optional)
* @param string $_spam_check Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored. (optional)
* @param string $other_parameters All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['submitForm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function submitFormRequest($_to = null, $_subject = null, $_redirect_to = null, $_email_address = null, $_success_message = null, $_spam_check = null, $other_parameters = null, string $contentType = self::contentTypes['submitForm'][0])
{
$resourcePath = '/forms';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$_to,
'_to', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$_subject,
'_subject', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$_redirect_to,
'_redirectTo', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$_email_address,
'_emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$_success_message,
'_successMessage', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$_spam_check,
'_spamCheck', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$other_parameters,
'otherParameters', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* ExportControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* ExportControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ExportControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'exportEntities' => [
'application/json',
],
'getExportLink' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation exportEntities
*
* Export inboxes link callable via browser
*
* @param string $export_type export_type (required)
* @param string $api_key api_key (required)
* @param string $output_format output_format (required)
* @param string $filter filter (optional)
* @param string $list_separator_token list_separator_token (optional)
* @param bool $exclude_previously_exported exclude_previously_exported (optional)
* @param \DateTime $created_earliest_time created_earliest_time (optional)
* @param \DateTime $created_oldest_time created_oldest_time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function exportEntities($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0])
{
list($response) = $this->exportEntitiesWithHttpInfo($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType);
return $response;
}
/**
* Operation exportEntitiesWithHttpInfo
*
* Export inboxes link callable via browser
*
* @param string $export_type (required)
* @param string $api_key (required)
* @param string $output_format (required)
* @param string $filter (optional)
* @param string $list_separator_token (optional)
* @param bool $exclude_previously_exported (optional)
* @param \DateTime $created_earliest_time (optional)
* @param \DateTime $created_oldest_time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function exportEntitiesWithHttpInfo($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0])
{
$request = $this->exportEntitiesRequest($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation exportEntitiesAsync
*
* Export inboxes link callable via browser
*
* @param string $export_type (required)
* @param string $api_key (required)
* @param string $output_format (required)
* @param string $filter (optional)
* @param string $list_separator_token (optional)
* @param bool $exclude_previously_exported (optional)
* @param \DateTime $created_earliest_time (optional)
* @param \DateTime $created_oldest_time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function exportEntitiesAsync($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0])
{
return $this->exportEntitiesAsyncWithHttpInfo($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation exportEntitiesAsyncWithHttpInfo
*
* Export inboxes link callable via browser
*
* @param string $export_type (required)
* @param string $api_key (required)
* @param string $output_format (required)
* @param string $filter (optional)
* @param string $list_separator_token (optional)
* @param bool $exclude_previously_exported (optional)
* @param \DateTime $created_earliest_time (optional)
* @param \DateTime $created_oldest_time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function exportEntitiesAsyncWithHttpInfo($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0])
{
$returnType = 'string';
$request = $this->exportEntitiesRequest($export_type, $api_key, $output_format, $filter, $list_separator_token, $exclude_previously_exported, $created_earliest_time, $created_oldest_time, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'exportEntities'
*
* @param string $export_type (required)
* @param string $api_key (required)
* @param string $output_format (required)
* @param string $filter (optional)
* @param string $list_separator_token (optional)
* @param bool $exclude_previously_exported (optional)
* @param \DateTime $created_earliest_time (optional)
* @param \DateTime $created_oldest_time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['exportEntities'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function exportEntitiesRequest($export_type, $api_key, $output_format, $filter = null, $list_separator_token = null, $exclude_previously_exported = null, $created_earliest_time = null, $created_oldest_time = null, string $contentType = self::contentTypes['exportEntities'][0])
{
// verify the required parameter 'export_type' is set
if ($export_type === null || (is_array($export_type) && count($export_type) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $export_type when calling exportEntities'
);
}
// verify the required parameter 'api_key' is set
if ($api_key === null || (is_array($api_key) && count($api_key) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $api_key when calling exportEntities'
);
}
// verify the required parameter 'output_format' is set
if ($output_format === null || (is_array($output_format) && count($output_format) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $output_format when calling exportEntities'
);
}
$resourcePath = '/export';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$export_type,
'exportType', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$api_key,
'apiKey', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$output_format,
'outputFormat', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$filter,
'filter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$list_separator_token,
'listSeparatorToken', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$exclude_previously_exported,
'excludePreviouslyExported', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$created_earliest_time,
'createdEarliestTime', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$created_oldest_time,
'createdOldestTime', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getExportLink
*
* Get export link
*
* @param string $export_type export_type (required)
* @param \MailSlurp\Models\ExportOptions $export_options export_options (required)
* @param string $api_key api_key (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ExportLink
*/
public function getExportLink($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0])
{
list($response) = $this->getExportLinkWithHttpInfo($export_type, $export_options, $api_key, $contentType);
return $response;
}
/**
* Operation getExportLinkWithHttpInfo
*
* Get export link
*
* @param string $export_type (required)
* @param \MailSlurp\Models\ExportOptions $export_options (required)
* @param string $api_key (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ExportLink, HTTP status code, HTTP response headers (array of strings)
*/
public function getExportLinkWithHttpInfo($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0])
{
$request = $this->getExportLinkRequest($export_type, $export_options, $api_key, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ExportLink' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ExportLink' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExportLink', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ExportLink';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ExportLink',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getExportLinkAsync
*
* Get export link
*
* @param string $export_type (required)
* @param \MailSlurp\Models\ExportOptions $export_options (required)
* @param string $api_key (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExportLinkAsync($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0])
{
return $this->getExportLinkAsyncWithHttpInfo($export_type, $export_options, $api_key, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getExportLinkAsyncWithHttpInfo
*
* Get export link
*
* @param string $export_type (required)
* @param \MailSlurp\Models\ExportOptions $export_options (required)
* @param string $api_key (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExportLinkAsyncWithHttpInfo($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0])
{
$returnType = '\MailSlurp\Models\ExportLink';
$request = $this->getExportLinkRequest($export_type, $export_options, $api_key, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getExportLink'
*
* @param string $export_type (required)
* @param \MailSlurp\Models\ExportOptions $export_options (required)
* @param string $api_key (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExportLink'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getExportLinkRequest($export_type, $export_options, $api_key = null, string $contentType = self::contentTypes['getExportLink'][0])
{
// verify the required parameter 'export_type' is set
if ($export_type === null || (is_array($export_type) && count($export_type) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $export_type when calling getExportLink'
);
}
// verify the required parameter 'export_options' is set
if ($export_options === null || (is_array($export_options) && count($export_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $export_options when calling getExportLink'
);
}
$resourcePath = '/export';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$export_type,
'exportType', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$api_key,
'apiKey', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($export_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($export_options));
} else {
$httpBody = $export_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* ExpiredControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* ExpiredControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ExpiredControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'getExpirationDefaults' => [
'application/json',
],
'getExpiredInboxByInboxId' => [
'application/json',
],
'getExpiredInboxRecord' => [
'application/json',
],
'getExpiredInboxes' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getExpirationDefaults
*
* Get default expiration settings
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ExpirationDefaults
*/
public function getExpirationDefaults(string $contentType = self::contentTypes['getExpirationDefaults'][0])
{
list($response) = $this->getExpirationDefaultsWithHttpInfo($contentType);
return $response;
}
/**
* Operation getExpirationDefaultsWithHttpInfo
*
* Get default expiration settings
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ExpirationDefaults, HTTP status code, HTTP response headers (array of strings)
*/
public function getExpirationDefaultsWithHttpInfo(string $contentType = self::contentTypes['getExpirationDefaults'][0])
{
$request = $this->getExpirationDefaultsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ExpirationDefaults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ExpirationDefaults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExpirationDefaults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ExpirationDefaults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ExpirationDefaults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getExpirationDefaultsAsync
*
* Get default expiration settings
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpirationDefaultsAsync(string $contentType = self::contentTypes['getExpirationDefaults'][0])
{
return $this->getExpirationDefaultsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getExpirationDefaultsAsyncWithHttpInfo
*
* Get default expiration settings
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpirationDefaultsAsyncWithHttpInfo(string $contentType = self::contentTypes['getExpirationDefaults'][0])
{
$returnType = '\MailSlurp\Models\ExpirationDefaults';
$request = $this->getExpirationDefaultsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getExpirationDefaults'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpirationDefaults'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getExpirationDefaultsRequest(string $contentType = self::contentTypes['getExpirationDefaults'][0])
{
$resourcePath = '/expired/defaults';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getExpiredInboxByInboxId
*
* Get expired inbox record for a previously existing inbox
*
* @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ExpiredInboxDto
*/
public function getExpiredInboxByInboxId($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0])
{
list($response) = $this->getExpiredInboxByInboxIdWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getExpiredInboxByInboxIdWithHttpInfo
*
* Get expired inbox record for a previously existing inbox
*
* @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ExpiredInboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getExpiredInboxByInboxIdWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0])
{
$request = $this->getExpiredInboxByInboxIdRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ExpiredInboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ExpiredInboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExpiredInboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ExpiredInboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ExpiredInboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getExpiredInboxByInboxIdAsync
*
* Get expired inbox record for a previously existing inbox
*
* @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpiredInboxByInboxIdAsync($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0])
{
return $this->getExpiredInboxByInboxIdAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getExpiredInboxByInboxIdAsyncWithHttpInfo
*
* Get expired inbox record for a previously existing inbox
*
* @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpiredInboxByInboxIdAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0])
{
$returnType = '\MailSlurp\Models\ExpiredInboxDto';
$request = $this->getExpiredInboxByInboxIdRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getExpiredInboxByInboxId'
*
* @param string $inbox_id ID of inbox you want to retrieve (not the inbox ID) (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxByInboxId'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getExpiredInboxByInboxIdRequest($inbox_id, string $contentType = self::contentTypes['getExpiredInboxByInboxId'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getExpiredInboxByInboxId'
);
}
$resourcePath = '/expired/inbox/{inboxId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($inbox_id !== null) {
$resourcePath = str_replace(
'{' . 'inboxId' . '}',
ObjectSerializer::toPathValue($inbox_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getExpiredInboxRecord
*
* Get an expired inbox record
*
* @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ExpiredInboxDto
*/
public function getExpiredInboxRecord($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0])
{
list($response) = $this->getExpiredInboxRecordWithHttpInfo($expired_id, $contentType);
return $response;
}
/**
* Operation getExpiredInboxRecordWithHttpInfo
*
* Get an expired inbox record
*
* @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ExpiredInboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getExpiredInboxRecordWithHttpInfo($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0])
{
$request = $this->getExpiredInboxRecordRequest($expired_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ExpiredInboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ExpiredInboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ExpiredInboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ExpiredInboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ExpiredInboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getExpiredInboxRecordAsync
*
* Get an expired inbox record
*
* @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpiredInboxRecordAsync($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0])
{
return $this->getExpiredInboxRecordAsyncWithHttpInfo($expired_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getExpiredInboxRecordAsyncWithHttpInfo
*
* Get an expired inbox record
*
* @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpiredInboxRecordAsyncWithHttpInfo($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0])
{
$returnType = '\MailSlurp\Models\ExpiredInboxDto';
$request = $this->getExpiredInboxRecordRequest($expired_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getExpiredInboxRecord'
*
* @param string $expired_id ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxRecord'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getExpiredInboxRecordRequest($expired_id, string $contentType = self::contentTypes['getExpiredInboxRecord'][0])
{
// verify the required parameter 'expired_id' is set
if ($expired_id === null || (is_array($expired_id) && count($expired_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $expired_id when calling getExpiredInboxRecord'
);
}
$resourcePath = '/expired/{expiredId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($expired_id !== null) {
$resourcePath = str_replace(
'{' . 'expiredId' . '}',
ObjectSerializer::toPathValue($expired_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getExpiredInboxes
*
* List records of expired inboxes
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageExpiredInboxRecordProjection
*/
public function getExpiredInboxes($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0])
{
list($response) = $this->getExpiredInboxesWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getExpiredInboxesWithHttpInfo
*
* List records of expired inboxes
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageExpiredInboxRecordProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getExpiredInboxesWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0])
{
$request = $this->getExpiredInboxesRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageExpiredInboxRecordProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageExpiredInboxRecordProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageExpiredInboxRecordProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageExpiredInboxRecordProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageExpiredInboxRecordProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getExpiredInboxesAsync
*
* List records of expired inboxes
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpiredInboxesAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0])
{
return $this->getExpiredInboxesAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getExpiredInboxesAsyncWithHttpInfo
*
* List records of expired inboxes
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getExpiredInboxesAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0])
{
$returnType = '\MailSlurp\Models\PageExpiredInboxRecordProjection';
$request = $this->getExpiredInboxesRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getExpiredInboxes'
*
* @param int $page Optional page index in inbox sent email list pagination (optional, default to 0)
* @param int $size Optional page size in inbox sent email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getExpiredInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getExpiredInboxesRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getExpiredInboxes'][0])
{
$resourcePath = '/expired';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* EmailVerificationControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* EmailVerificationControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class EmailVerificationControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'deleteAllValidationRequests' => [
'application/json',
],
'deleteValidationRequest' => [
'application/json',
],
'getValidationRequests' => [
'application/json',
],
'validateEmailAddressList' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation deleteAllValidationRequests
*
* Delete all validation requests
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllValidationRequests'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllValidationRequests(string $contentType = self::contentTypes['deleteAllValidationRequests'][0])
{
$this->deleteAllValidationRequestsWithHttpInfo($contentType);
}
/**
* Operation deleteAllValidationRequestsWithHttpInfo
*
* Delete all validation requests
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllValidationRequests'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllValidationRequestsWithHttpInfo(string $contentType = self::contentTypes['deleteAllValidationRequests'][0])
{
$request = $this->deleteAllValidationRequestsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllValidationRequestsAsync
*
* Delete all validation requests
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllValidationRequests'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllValidationRequestsAsync(string $contentType = self::contentTypes['deleteAllValidationRequests'][0])
{
return $this->deleteAllValidationRequestsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllValidationRequestsAsyncWithHttpInfo
*
* Delete all validation requests
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllValidationRequests'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllValidationRequestsAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllValidationRequests'][0])
{
$returnType = '';
$request = $this->deleteAllValidationRequestsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllValidationRequests'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllValidationRequests'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllValidationRequestsRequest(string $contentType = self::contentTypes['deleteAllValidationRequests'][0])
{
$resourcePath = '/email-verification';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteValidationRequest
*
* Delete a validation record
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRequest'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteValidationRequest($id, string $contentType = self::contentTypes['deleteValidationRequest'][0])
{
$this->deleteValidationRequestWithHttpInfo($id, $contentType);
}
/**
* Operation deleteValidationRequestWithHttpInfo
*
* Delete a validation record
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRequest'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteValidationRequestWithHttpInfo($id, string $contentType = self::contentTypes['deleteValidationRequest'][0])
{
$request = $this->deleteValidationRequestRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteValidationRequestAsync
*
* Delete a validation record
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRequest'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteValidationRequestAsync($id, string $contentType = self::contentTypes['deleteValidationRequest'][0])
{
return $this->deleteValidationRequestAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteValidationRequestAsyncWithHttpInfo
*
* Delete a validation record
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRequest'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteValidationRequestAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteValidationRequest'][0])
{
$returnType = '';
$request = $this->deleteValidationRequestRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteValidationRequest'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteValidationRequest'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteValidationRequestRequest($id, string $contentType = self::contentTypes['deleteValidationRequest'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteValidationRequest'
);
}
$resourcePath = '/email-verification/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getValidationRequests
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $is_valid Filter where email is valid is true or false (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageEmailValidationRequest
*/
public function getValidationRequests($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0])
{
list($response) = $this->getValidationRequestsWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType);
return $response;
}
/**
* Operation getValidationRequestsWithHttpInfo
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $is_valid Filter where email is valid is true or false (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageEmailValidationRequest, HTTP status code, HTTP response headers (array of strings)
*/
public function getValidationRequestsWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0])
{
$request = $this->getValidationRequestsRequest($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageEmailValidationRequest' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageEmailValidationRequest' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailValidationRequest', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageEmailValidationRequest';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageEmailValidationRequest',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getValidationRequestsAsync
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $is_valid Filter where email is valid is true or false (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getValidationRequestsAsync($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0])
{
return $this->getValidationRequestsAsyncWithHttpInfo($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getValidationRequestsAsyncWithHttpInfo
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $is_valid Filter where email is valid is true or false (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getValidationRequestsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0])
{
$returnType = '\MailSlurp\Models\PageEmailValidationRequest';
$request = $this->getValidationRequestsRequest($page, $size, $sort, $search_filter, $since, $before, $is_valid, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getValidationRequests'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size for paginated result list. (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'DESC')
* @param string $search_filter Optional search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param bool $is_valid Filter where email is valid is true or false (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getValidationRequests'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getValidationRequestsRequest($page = 0, $size = 20, $sort = 'DESC', $search_filter = null, $since = null, $before = null, $is_valid = null, string $contentType = self::contentTypes['getValidationRequests'][0])
{
if ($page !== null && $page > 9223372036854775807) {
throw new \InvalidArgumentException('invalid value for "$page" when calling EmailVerificationControllerApi.getValidationRequests, must be smaller than or equal to 9223372036854775807.');
}
if ($page !== null && $page < 0) {
throw new \InvalidArgumentException('invalid value for "$page" when calling EmailVerificationControllerApi.getValidationRequests, must be bigger than or equal to 0.');
}
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling EmailVerificationControllerApi.getValidationRequests, must be smaller than or equal to 100.');
}
if ($size !== null && $size < 1) {
throw new \InvalidArgumentException('invalid value for "$size" when calling EmailVerificationControllerApi.getValidationRequests, must be bigger than or equal to 1.');
}
$resourcePath = '/email-verification/validation-requests';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$is_valid,
'isValid', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation validateEmailAddressList
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options validate_email_address_list_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ValidateEmailAddressListResult
*/
public function validateEmailAddressList($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0])
{
list($response) = $this->validateEmailAddressListWithHttpInfo($validate_email_address_list_options, $contentType);
return $response;
}
/**
* Operation validateEmailAddressListWithHttpInfo
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ValidateEmailAddressListResult, HTTP status code, HTTP response headers (array of strings)
*/
public function validateEmailAddressListWithHttpInfo($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0])
{
$request = $this->validateEmailAddressListRequest($validate_email_address_list_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ValidateEmailAddressListResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ValidateEmailAddressListResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ValidateEmailAddressListResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ValidateEmailAddressListResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ValidateEmailAddressListResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation validateEmailAddressListAsync
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function validateEmailAddressListAsync($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0])
{
return $this->validateEmailAddressListAsyncWithHttpInfo($validate_email_address_list_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation validateEmailAddressListAsyncWithHttpInfo
*
* Validate a list of email addresses. Per unit billing. See your plan for pricing.
*
* @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function validateEmailAddressListAsyncWithHttpInfo($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0])
{
$returnType = '\MailSlurp\Models\ValidateEmailAddressListResult';
$request = $this->validateEmailAddressListRequest($validate_email_address_list_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'validateEmailAddressList'
*
* @param \MailSlurp\Models\ValidateEmailAddressListOptions $validate_email_address_list_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmailAddressList'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function validateEmailAddressListRequest($validate_email_address_list_options, string $contentType = self::contentTypes['validateEmailAddressList'][0])
{
// verify the required parameter 'validate_email_address_list_options' is set
if ($validate_email_address_list_options === null || (is_array($validate_email_address_list_options) && count($validate_email_address_list_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $validate_email_address_list_options when calling validateEmailAddressList'
);
}
$resourcePath = '/email-verification/email-address-list';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($validate_email_address_list_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($validate_email_address_list_options));
} else {
$httpBody = $validate_email_address_list_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* EmailControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* EmailControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class EmailControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'applyImapFlagOperation' => [
'application/json',
],
'canSend' => [
'application/json',
],
'checkEmailBody' => [
'application/json',
],
'checkEmailBodyFeatureSupport' => [
'application/json',
],
'checkEmailClientSupport' => [
'application/json',
],
'deleteAllEmails' => [
'application/json',
],
'deleteEmail' => [
'application/json',
],
'downloadAttachment' => [
'application/json',
],
'downloadAttachmentBase64' => [
'application/json',
],
'downloadBody' => [
'application/json',
],
'downloadBodyBytes' => [
'application/json',
],
'forwardEmail' => [
'application/json',
],
'getAttachmentMetaData' => [
'application/json',
],
'getEmail' => [
'application/json',
],
'getEmailAttachments' => [
'application/json',
],
'getEmailContentMatch' => [
'application/json',
],
'getEmailContentPart' => [
'application/json',
],
'getEmailCount' => [
'application/json',
],
'getEmailHTML' => [
'application/json',
],
'getEmailHTMLJson' => [
'application/json',
],
'getEmailHTMLQuery' => [
'application/json',
],
'getEmailLinks' => [
'application/json',
],
'getEmailPreviewURLs' => [
'application/json',
],
'getEmailScreenshotAsBase64' => [
'application/json',
],
'getEmailScreenshotAsBinary' => [
'application/json',
],
'getEmailTextLines' => [
'application/json',
],
'getEmailsOffsetPaginated' => [
'application/json',
],
'getEmailsPaginated' => [
'application/json',
],
'getGravatarUrlForEmailAddress' => [
'application/json',
],
'getLatestEmail' => [
'application/json',
],
'getLatestEmailInInbox1' => [
'application/json',
],
'getOrganizationEmailsPaginated' => [
'application/json',
],
'getRawEmailContents' => [
'application/json',
],
'getRawEmailJson' => [
'application/json',
],
'getUnreadEmailCount' => [
'application/json',
],
'markAllAsRead' => [
'application/json',
],
'markAsRead' => [
'application/json',
],
'replyToEmail' => [
'application/json',
],
'searchEmails' => [
'application/json',
],
'sendEmailSourceOptional' => [
'application/json',
],
'validateEmail' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation applyImapFlagOperation
*
* Set IMAP flags associated with a message. Only supports '\\Seen' flag.
*
* @param string $email_id email_id (required)
* @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options imap_flag_operation_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreview
*/
public function applyImapFlagOperation($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0])
{
list($response) = $this->applyImapFlagOperationWithHttpInfo($email_id, $imap_flag_operation_options, $contentType);
return $response;
}
/**
* Operation applyImapFlagOperationWithHttpInfo
*
* Set IMAP flags associated with a message. Only supports '\\Seen' flag.
*
* @param string $email_id (required)
* @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreview, HTTP status code, HTTP response headers (array of strings)
*/
public function applyImapFlagOperationWithHttpInfo($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0])
{
$request = $this->applyImapFlagOperationRequest($email_id, $imap_flag_operation_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreview' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreview' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreview';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreview',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation applyImapFlagOperationAsync
*
* Set IMAP flags associated with a message. Only supports '\\Seen' flag.
*
* @param string $email_id (required)
* @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function applyImapFlagOperationAsync($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0])
{
return $this->applyImapFlagOperationAsyncWithHttpInfo($email_id, $imap_flag_operation_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation applyImapFlagOperationAsyncWithHttpInfo
*
* Set IMAP flags associated with a message. Only supports '\\Seen' flag.
*
* @param string $email_id (required)
* @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function applyImapFlagOperationAsyncWithHttpInfo($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0])
{
$returnType = '\MailSlurp\Models\EmailPreview';
$request = $this->applyImapFlagOperationRequest($email_id, $imap_flag_operation_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'applyImapFlagOperation'
*
* @param string $email_id (required)
* @param \MailSlurp\Models\ImapFlagOperationOptions $imap_flag_operation_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['applyImapFlagOperation'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function applyImapFlagOperationRequest($email_id, $imap_flag_operation_options, string $contentType = self::contentTypes['applyImapFlagOperation'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling applyImapFlagOperation'
);
}
// verify the required parameter 'imap_flag_operation_options' is set
if ($imap_flag_operation_options === null || (is_array($imap_flag_operation_options) && count($imap_flag_operation_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $imap_flag_operation_options when calling applyImapFlagOperation'
);
}
$resourcePath = '/emails/{emailId}/imap-flag-operation';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($imap_flag_operation_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($imap_flag_operation_options));
} else {
$httpBody = $imap_flag_operation_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation canSend
*
* Check if email can be sent and options are valid.
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['canSend'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CanSendEmailResults
*/
public function canSend($inbox_id, $send_email_options, string $contentType = self::contentTypes['canSend'][0])
{
list($response) = $this->canSendWithHttpInfo($inbox_id, $send_email_options, $contentType);
return $response;
}
/**
* Operation canSendWithHttpInfo
*
* Check if email can be sent and options are valid.
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['canSend'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CanSendEmailResults, HTTP status code, HTTP response headers (array of strings)
*/
public function canSendWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['canSend'][0])
{
$request = $this->canSendRequest($inbox_id, $send_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CanSendEmailResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CanSendEmailResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CanSendEmailResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CanSendEmailResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CanSendEmailResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation canSendAsync
*
* Check if email can be sent and options are valid.
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['canSend'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function canSendAsync($inbox_id, $send_email_options, string $contentType = self::contentTypes['canSend'][0])
{
return $this->canSendAsyncWithHttpInfo($inbox_id, $send_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation canSendAsyncWithHttpInfo
*
* Check if email can be sent and options are valid.
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['canSend'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function canSendAsyncWithHttpInfo($inbox_id, $send_email_options, string $contentType = self::contentTypes['canSend'][0])
{
$returnType = '\MailSlurp\Models\CanSendEmailResults';
$request = $this->canSendRequest($inbox_id, $send_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'canSend'
*
* @param string $inbox_id ID of the inbox you want to send the email from (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['canSend'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function canSendRequest($inbox_id, $send_email_options, string $contentType = self::contentTypes['canSend'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling canSend'
);
}
// verify the required parameter 'send_email_options' is set
if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_email_options when calling canSend'
);
}
$resourcePath = '/emails/can-send';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options));
} else {
$httpBody = $send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation checkEmailBody
*
* Detect broken links, spelling, and images in email content
*
* @param string $email_id email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBody'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CheckEmailBodyResults
*/
public function checkEmailBody($email_id, string $contentType = self::contentTypes['checkEmailBody'][0])
{
list($response) = $this->checkEmailBodyWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation checkEmailBodyWithHttpInfo
*
* Detect broken links, spelling, and images in email content
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBody'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CheckEmailBodyResults, HTTP status code, HTTP response headers (array of strings)
*/
public function checkEmailBodyWithHttpInfo($email_id, string $contentType = self::contentTypes['checkEmailBody'][0])
{
$request = $this->checkEmailBodyRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CheckEmailBodyResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CheckEmailBodyResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CheckEmailBodyResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CheckEmailBodyResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CheckEmailBodyResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation checkEmailBodyAsync
*
* Detect broken links, spelling, and images in email content
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBody'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailBodyAsync($email_id, string $contentType = self::contentTypes['checkEmailBody'][0])
{
return $this->checkEmailBodyAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation checkEmailBodyAsyncWithHttpInfo
*
* Detect broken links, spelling, and images in email content
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBody'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailBodyAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['checkEmailBody'][0])
{
$returnType = '\MailSlurp\Models\CheckEmailBodyResults';
$request = $this->checkEmailBodyRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'checkEmailBody'
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBody'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function checkEmailBodyRequest($email_id, string $contentType = self::contentTypes['checkEmailBody'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling checkEmailBody'
);
}
$resourcePath = '/emails/{emailId}/check-email-body';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation checkEmailBodyFeatureSupport
*
* Show which mail clients support the HTML and CSS features used in an email body.
*
* @param string $email_id email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBodyFeatureSupport'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CheckEmailBodyFeatureSupportResults
*/
public function checkEmailBodyFeatureSupport($email_id, string $contentType = self::contentTypes['checkEmailBodyFeatureSupport'][0])
{
list($response) = $this->checkEmailBodyFeatureSupportWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation checkEmailBodyFeatureSupportWithHttpInfo
*
* Show which mail clients support the HTML and CSS features used in an email body.
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBodyFeatureSupport'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CheckEmailBodyFeatureSupportResults, HTTP status code, HTTP response headers (array of strings)
*/
public function checkEmailBodyFeatureSupportWithHttpInfo($email_id, string $contentType = self::contentTypes['checkEmailBodyFeatureSupport'][0])
{
$request = $this->checkEmailBodyFeatureSupportRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CheckEmailBodyFeatureSupportResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CheckEmailBodyFeatureSupportResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CheckEmailBodyFeatureSupportResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CheckEmailBodyFeatureSupportResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CheckEmailBodyFeatureSupportResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation checkEmailBodyFeatureSupportAsync
*
* Show which mail clients support the HTML and CSS features used in an email body.
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBodyFeatureSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailBodyFeatureSupportAsync($email_id, string $contentType = self::contentTypes['checkEmailBodyFeatureSupport'][0])
{
return $this->checkEmailBodyFeatureSupportAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation checkEmailBodyFeatureSupportAsyncWithHttpInfo
*
* Show which mail clients support the HTML and CSS features used in an email body.
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBodyFeatureSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailBodyFeatureSupportAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['checkEmailBodyFeatureSupport'][0])
{
$returnType = '\MailSlurp\Models\CheckEmailBodyFeatureSupportResults';
$request = $this->checkEmailBodyFeatureSupportRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'checkEmailBodyFeatureSupport'
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailBodyFeatureSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function checkEmailBodyFeatureSupportRequest($email_id, string $contentType = self::contentTypes['checkEmailBodyFeatureSupport'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling checkEmailBodyFeatureSupport'
);
}
$resourcePath = '/emails/{emailId}/check-email-body-feature-support';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation checkEmailClientSupport
*
* Show which email programs and devices support the features used in an email body.
*
* @param \MailSlurp\Models\CheckEmailClientSupportOptions $check_email_client_support_options check_email_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailClientSupport'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CheckEmailClientSupportResults
*/
public function checkEmailClientSupport($check_email_client_support_options, string $contentType = self::contentTypes['checkEmailClientSupport'][0])
{
list($response) = $this->checkEmailClientSupportWithHttpInfo($check_email_client_support_options, $contentType);
return $response;
}
/**
* Operation checkEmailClientSupportWithHttpInfo
*
* Show which email programs and devices support the features used in an email body.
*
* @param \MailSlurp\Models\CheckEmailClientSupportOptions $check_email_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailClientSupport'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CheckEmailClientSupportResults, HTTP status code, HTTP response headers (array of strings)
*/
public function checkEmailClientSupportWithHttpInfo($check_email_client_support_options, string $contentType = self::contentTypes['checkEmailClientSupport'][0])
{
$request = $this->checkEmailClientSupportRequest($check_email_client_support_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CheckEmailClientSupportResults' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CheckEmailClientSupportResults' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CheckEmailClientSupportResults', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CheckEmailClientSupportResults';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CheckEmailClientSupportResults',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation checkEmailClientSupportAsync
*
* Show which email programs and devices support the features used in an email body.
*
* @param \MailSlurp\Models\CheckEmailClientSupportOptions $check_email_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailClientSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailClientSupportAsync($check_email_client_support_options, string $contentType = self::contentTypes['checkEmailClientSupport'][0])
{
return $this->checkEmailClientSupportAsyncWithHttpInfo($check_email_client_support_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation checkEmailClientSupportAsyncWithHttpInfo
*
* Show which email programs and devices support the features used in an email body.
*
* @param \MailSlurp\Models\CheckEmailClientSupportOptions $check_email_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailClientSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function checkEmailClientSupportAsyncWithHttpInfo($check_email_client_support_options, string $contentType = self::contentTypes['checkEmailClientSupport'][0])
{
$returnType = '\MailSlurp\Models\CheckEmailClientSupportResults';
$request = $this->checkEmailClientSupportRequest($check_email_client_support_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'checkEmailClientSupport'
*
* @param \MailSlurp\Models\CheckEmailClientSupportOptions $check_email_client_support_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEmailClientSupport'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function checkEmailClientSupportRequest($check_email_client_support_options, string $contentType = self::contentTypes['checkEmailClientSupport'][0])
{
// verify the required parameter 'check_email_client_support_options' is set
if ($check_email_client_support_options === null || (is_array($check_email_client_support_options) && count($check_email_client_support_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $check_email_client_support_options when calling checkEmailClientSupport'
);
}
$resourcePath = '/emails/check-email-client-support';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($check_email_client_support_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($check_email_client_support_options));
} else {
$httpBody = $check_email_client_support_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllEmails
*
* Delete all emails in all inboxes.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllEmails(string $contentType = self::contentTypes['deleteAllEmails'][0])
{
$this->deleteAllEmailsWithHttpInfo($contentType);
}
/**
* Operation deleteAllEmailsWithHttpInfo
*
* Delete all emails in all inboxes.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllEmailsWithHttpInfo(string $contentType = self::contentTypes['deleteAllEmails'][0])
{
$request = $this->deleteAllEmailsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllEmailsAsync
*
* Delete all emails in all inboxes.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllEmailsAsync(string $contentType = self::contentTypes['deleteAllEmails'][0])
{
return $this->deleteAllEmailsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllEmailsAsyncWithHttpInfo
*
* Delete all emails in all inboxes.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllEmailsAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllEmails'][0])
{
$returnType = '';
$request = $this->deleteAllEmailsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllEmails'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllEmailsRequest(string $contentType = self::contentTypes['deleteAllEmails'][0])
{
$resourcePath = '/emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteEmail
*
* Delete an email
*
* @param string $email_id ID of email to delete (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteEmail($email_id, string $contentType = self::contentTypes['deleteEmail'][0])
{
$this->deleteEmailWithHttpInfo($email_id, $contentType);
}
/**
* Operation deleteEmailWithHttpInfo
*
* Delete an email
*
* @param string $email_id ID of email to delete (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteEmailWithHttpInfo($email_id, string $contentType = self::contentTypes['deleteEmail'][0])
{
$request = $this->deleteEmailRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteEmailAsync
*
* Delete an email
*
* @param string $email_id ID of email to delete (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteEmailAsync($email_id, string $contentType = self::contentTypes['deleteEmail'][0])
{
return $this->deleteEmailAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteEmailAsyncWithHttpInfo
*
* Delete an email
*
* @param string $email_id ID of email to delete (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteEmailAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['deleteEmail'][0])
{
$returnType = '';
$request = $this->deleteEmailRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteEmail'
*
* @param string $email_id ID of email to delete (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteEmailRequest($email_id, string $contentType = self::contentTypes['deleteEmail'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling deleteEmail'
);
}
$resourcePath = '/emails/{emailId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation downloadAttachment
*
* Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function downloadAttachment($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0])
{
list($response) = $this->downloadAttachmentWithHttpInfo($email_id, $attachment_id, $api_key, $contentType);
return $response;
}
/**
* Operation downloadAttachmentWithHttpInfo
*
* Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function downloadAttachmentWithHttpInfo($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0])
{
$request = $this->downloadAttachmentRequest($email_id, $attachment_id, $api_key, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
default:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
default:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation downloadAttachmentAsync
*
* Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentAsync($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0])
{
return $this->downloadAttachmentAsyncWithHttpInfo($email_id, $attachment_id, $api_key, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation downloadAttachmentAsyncWithHttpInfo
*
* Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentAsyncWithHttpInfo($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0])
{
$returnType = 'string';
$request = $this->downloadAttachmentRequest($email_id, $attachment_id, $api_key, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'downloadAttachment'
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function downloadAttachmentRequest($email_id, $attachment_id, $api_key = null, string $contentType = self::contentTypes['downloadAttachment'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling downloadAttachment'
);
}
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling downloadAttachment'
);
}
$resourcePath = '/emails/{emailId}/attachments/{attachmentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$api_key,
'apiKey', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['application/octet-stream', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation downloadAttachmentBase64
*
* Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DownloadAttachmentDto
*/
public function downloadAttachmentBase64($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0])
{
list($response) = $this->downloadAttachmentBase64WithHttpInfo($email_id, $attachment_id, $contentType);
return $response;
}
/**
* Operation downloadAttachmentBase64WithHttpInfo
*
* Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DownloadAttachmentDto, HTTP status code, HTTP response headers (array of strings)
*/
public function downloadAttachmentBase64WithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0])
{
$request = $this->downloadAttachmentBase64Request($email_id, $attachment_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DownloadAttachmentDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DownloadAttachmentDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DownloadAttachmentDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DownloadAttachmentDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DownloadAttachmentDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation downloadAttachmentBase64Async
*
* Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentBase64Async($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0])
{
return $this->downloadAttachmentBase64AsyncWithHttpInfo($email_id, $attachment_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation downloadAttachmentBase64AsyncWithHttpInfo
*
* Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentBase64AsyncWithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0])
{
$returnType = '\MailSlurp\Models\DownloadAttachmentDto';
$request = $this->downloadAttachmentBase64Request($email_id, $attachment_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'downloadAttachmentBase64'
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentBase64'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function downloadAttachmentBase64Request($email_id, $attachment_id, string $contentType = self::contentTypes['downloadAttachmentBase64'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling downloadAttachmentBase64'
);
}
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling downloadAttachmentBase64'
);
}
$resourcePath = '/emails/{emailId}/attachments/{attachmentId}/base64';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation downloadBody
*
* Get email body as string. Returned as `plain/text` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function downloadBody($email_id, string $contentType = self::contentTypes['downloadBody'][0])
{
list($response) = $this->downloadBodyWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation downloadBodyWithHttpInfo
*
* Get email body as string. Returned as `plain/text` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function downloadBodyWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBody'][0])
{
$request = $this->downloadBodyRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation downloadBodyAsync
*
* Get email body as string. Returned as `plain/text` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadBodyAsync($email_id, string $contentType = self::contentTypes['downloadBody'][0])
{
return $this->downloadBodyAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation downloadBodyAsyncWithHttpInfo
*
* Get email body as string. Returned as `plain/text` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadBodyAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBody'][0])
{
$returnType = 'string';
$request = $this->downloadBodyRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'downloadBody'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBody'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function downloadBodyRequest($email_id, string $contentType = self::contentTypes['downloadBody'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling downloadBody'
);
}
$resourcePath = '/emails/{emailId}/body';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['text/plain', 'text/html', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation downloadBodyBytes
*
* Get email body in bytes. Returned as `octet-stream` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function downloadBodyBytes($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0])
{
list($response) = $this->downloadBodyBytesWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation downloadBodyBytesWithHttpInfo
*
* Get email body in bytes. Returned as `octet-stream` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function downloadBodyBytesWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0])
{
$request = $this->downloadBodyBytesRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
default:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
default:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation downloadBodyBytesAsync
*
* Get email body in bytes. Returned as `octet-stream` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadBodyBytesAsync($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0])
{
return $this->downloadBodyBytesAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation downloadBodyBytesAsyncWithHttpInfo
*
* Get email body in bytes. Returned as `octet-stream` with content type header.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadBodyBytesAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0])
{
$returnType = 'string';
$request = $this->downloadBodyBytesRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'downloadBodyBytes'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadBodyBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function downloadBodyBytesRequest($email_id, string $contentType = self::contentTypes['downloadBodyBytes'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling downloadBodyBytes'
);
}
$resourcePath = '/emails/{emailId}/body-bytes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['application/octet-stream', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation forwardEmail
*
* Forward email to recipients
*
* @param string $email_id ID of email (required)
* @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options forward_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentEmailDto
*/
public function forwardEmail($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0])
{
list($response) = $this->forwardEmailWithHttpInfo($email_id, $forward_email_options, $contentType);
return $response;
}
/**
* Operation forwardEmailWithHttpInfo
*
* Forward email to recipients
*
* @param string $email_id ID of email (required)
* @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function forwardEmailWithHttpInfo($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0])
{
$request = $this->forwardEmailRequest($email_id, $forward_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation forwardEmailAsync
*
* Forward email to recipients
*
* @param string $email_id ID of email (required)
* @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function forwardEmailAsync($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0])
{
return $this->forwardEmailAsyncWithHttpInfo($email_id, $forward_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation forwardEmailAsyncWithHttpInfo
*
* Forward email to recipients
*
* @param string $email_id ID of email (required)
* @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function forwardEmailAsyncWithHttpInfo($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0])
{
$returnType = '\MailSlurp\Models\SentEmailDto';
$request = $this->forwardEmailRequest($email_id, $forward_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'forwardEmail'
*
* @param string $email_id ID of email (required)
* @param \MailSlurp\Models\ForwardEmailOptions $forward_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['forwardEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function forwardEmailRequest($email_id, $forward_email_options, string $contentType = self::contentTypes['forwardEmail'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling forwardEmail'
);
}
// verify the required parameter 'forward_email_options' is set
if ($forward_email_options === null || (is_array($forward_email_options) && count($forward_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $forward_email_options when calling forwardEmail'
);
}
$resourcePath = '/emails/{emailId}/forward';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($forward_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($forward_email_options));
} else {
$httpBody = $forward_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAttachmentMetaData
*
* Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AttachmentMetaData
*/
public function getAttachmentMetaData($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0])
{
list($response) = $this->getAttachmentMetaDataWithHttpInfo($email_id, $attachment_id, $contentType);
return $response;
}
/**
* Operation getAttachmentMetaDataWithHttpInfo
*
* Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AttachmentMetaData, HTTP status code, HTTP response headers (array of strings)
*/
public function getAttachmentMetaDataWithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0])
{
$request = $this->getAttachmentMetaDataRequest($email_id, $attachment_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\AttachmentMetaData' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AttachmentMetaData' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentMetaData', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AttachmentMetaData';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AttachmentMetaData',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAttachmentMetaDataAsync
*
* Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentMetaDataAsync($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0])
{
return $this->getAttachmentMetaDataAsyncWithHttpInfo($email_id, $attachment_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAttachmentMetaDataAsyncWithHttpInfo
*
* Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods.
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentMetaDataAsyncWithHttpInfo($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0])
{
$returnType = '\MailSlurp\Models\AttachmentMetaData';
$request = $this->getAttachmentMetaDataRequest($email_id, $attachment_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAttachmentMetaData'
*
* @param string $email_id ID of email (required)
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentMetaData'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAttachmentMetaDataRequest($email_id, $attachment_id, string $contentType = self::contentTypes['getAttachmentMetaData'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getAttachmentMetaData'
);
}
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling getAttachmentMetaData'
);
}
$resourcePath = '/emails/{emailId}/attachments/{attachmentId}/metadata';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmail
*
* Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.
*
* @param string $email_id email_id (required)
* @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Email
*/
public function getEmail($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0])
{
list($response) = $this->getEmailWithHttpInfo($email_id, $decode, $contentType);
return $response;
}
/**
* Operation getEmailWithHttpInfo
*
* Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.
*
* @param string $email_id (required)
* @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0])
{
$request = $this->getEmailRequest($email_id, $decode, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Email' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Email' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Email';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Email',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailAsync
*
* Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.
*
* @param string $email_id (required)
* @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailAsync($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0])
{
return $this->getEmailAsyncWithHttpInfo($email_id, $decode, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailAsyncWithHttpInfo
*
* Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.
*
* @param string $email_id (required)
* @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailAsyncWithHttpInfo($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0])
{
$returnType = '\MailSlurp\Models\Email';
$request = $this->getEmailRequest($email_id, $decode, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmail'
*
* @param string $email_id (required)
* @param bool $decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailRequest($email_id, $decode = false, string $contentType = self::contentTypes['getEmail'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmail'
);
}
$resourcePath = '/emails/{emailId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$decode,
'decode', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailAttachments
*
* Get all email attachment metadata. Metadata includes name and size of attachments.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AttachmentMetaData[]
*/
public function getEmailAttachments($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0])
{
list($response) = $this->getEmailAttachmentsWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation getEmailAttachmentsWithHttpInfo
*
* Get all email attachment metadata. Metadata includes name and size of attachments.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AttachmentMetaData[], HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailAttachmentsWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0])
{
$request = $this->getEmailAttachmentsRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\AttachmentMetaData[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AttachmentMetaData[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentMetaData[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AttachmentMetaData[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AttachmentMetaData[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailAttachmentsAsync
*
* Get all email attachment metadata. Metadata includes name and size of attachments.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailAttachmentsAsync($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0])
{
return $this->getEmailAttachmentsAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailAttachmentsAsyncWithHttpInfo
*
* Get all email attachment metadata. Metadata includes name and size of attachments.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailAttachmentsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0])
{
$returnType = '\MailSlurp\Models\AttachmentMetaData[]';
$request = $this->getEmailAttachmentsRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailAttachments'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailAttachmentsRequest($email_id, string $contentType = self::contentTypes['getEmailAttachments'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailAttachments'
);
}
$resourcePath = '/emails/{emailId}/attachments';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailContentMatch
*
* Get email content regex pattern match results. Runs regex against email body and returns match groups.
*
* @param string $email_id ID of email to match against (required)
* @param \MailSlurp\Models\ContentMatchOptions $content_match_options content_match_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailContentMatchResult
*/
public function getEmailContentMatch($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0])
{
list($response) = $this->getEmailContentMatchWithHttpInfo($email_id, $content_match_options, $contentType);
return $response;
}
/**
* Operation getEmailContentMatchWithHttpInfo
*
* Get email content regex pattern match results. Runs regex against email body and returns match groups.
*
* @param string $email_id ID of email to match against (required)
* @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailContentMatchResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailContentMatchWithHttpInfo($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0])
{
$request = $this->getEmailContentMatchRequest($email_id, $content_match_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailContentMatchResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailContentMatchResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailContentMatchResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailContentMatchResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailContentMatchResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailContentMatchAsync
*
* Get email content regex pattern match results. Runs regex against email body and returns match groups.
*
* @param string $email_id ID of email to match against (required)
* @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailContentMatchAsync($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0])
{
return $this->getEmailContentMatchAsyncWithHttpInfo($email_id, $content_match_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailContentMatchAsyncWithHttpInfo
*
* Get email content regex pattern match results. Runs regex against email body and returns match groups.
*
* @param string $email_id ID of email to match against (required)
* @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailContentMatchAsyncWithHttpInfo($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0])
{
$returnType = '\MailSlurp\Models\EmailContentMatchResult';
$request = $this->getEmailContentMatchRequest($email_id, $content_match_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailContentMatch'
*
* @param string $email_id ID of email to match against (required)
* @param \MailSlurp\Models\ContentMatchOptions $content_match_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentMatch'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailContentMatchRequest($email_id, $content_match_options, string $contentType = self::contentTypes['getEmailContentMatch'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailContentMatch'
);
}
// verify the required parameter 'content_match_options' is set
if ($content_match_options === null || (is_array($content_match_options) && count($content_match_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $content_match_options when calling getEmailContentMatch'
);
}
$resourcePath = '/emails/{emailId}/contentMatch';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($content_match_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($content_match_options));
} else {
$httpBody = $content_match_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailContentPart
*
* Get email content part by content type
*
* @param string $email_id ID of email to match against (required)
* @param string $content_type Content type (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentPart'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailContentPartResult
*/
public function getEmailContentPart($email_id, $content_type, string $contentType = self::contentTypes['getEmailContentPart'][0])
{
list($response) = $this->getEmailContentPartWithHttpInfo($email_id, $content_type, $contentType);
return $response;
}
/**
* Operation getEmailContentPartWithHttpInfo
*
* Get email content part by content type
*
* @param string $email_id ID of email to match against (required)
* @param string $content_type Content type (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentPart'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailContentPartResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailContentPartWithHttpInfo($email_id, $content_type, string $contentType = self::contentTypes['getEmailContentPart'][0])
{
$request = $this->getEmailContentPartRequest($email_id, $content_type, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailContentPartResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailContentPartResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailContentPartResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailContentPartResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailContentPartResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailContentPartAsync
*
* Get email content part by content type
*
* @param string $email_id ID of email to match against (required)
* @param string $content_type Content type (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentPart'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailContentPartAsync($email_id, $content_type, string $contentType = self::contentTypes['getEmailContentPart'][0])
{
return $this->getEmailContentPartAsyncWithHttpInfo($email_id, $content_type, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailContentPartAsyncWithHttpInfo
*
* Get email content part by content type
*
* @param string $email_id ID of email to match against (required)
* @param string $content_type Content type (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentPart'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailContentPartAsyncWithHttpInfo($email_id, $content_type, string $contentType = self::contentTypes['getEmailContentPart'][0])
{
$returnType = '\MailSlurp\Models\EmailContentPartResult';
$request = $this->getEmailContentPartRequest($email_id, $content_type, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailContentPart'
*
* @param string $email_id ID of email to match against (required)
* @param string $content_type Content type (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailContentPart'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailContentPartRequest($email_id, $content_type, string $contentType = self::contentTypes['getEmailContentPart'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailContentPart'
);
}
// verify the required parameter 'content_type' is set
if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $content_type when calling getEmailContentPart'
);
}
$resourcePath = '/emails/{emailId}/contentPart';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$content_type,
'contentType', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailCount
*
* Get email count
*
* @param string $inbox_id inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\CountDto
*/
public function getEmailCount($inbox_id = null, string $contentType = self::contentTypes['getEmailCount'][0])
{
list($response) = $this->getEmailCountWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getEmailCountWithHttpInfo
*
* Get email count
*
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\CountDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailCountWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getEmailCount'][0])
{
$request = $this->getEmailCountRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\CountDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\CountDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\CountDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\CountDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\CountDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailCountAsync
*
* Get email count
*
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailCountAsync($inbox_id = null, string $contentType = self::contentTypes['getEmailCount'][0])
{
return $this->getEmailCountAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailCountAsyncWithHttpInfo
*
* Get email count
*
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailCountAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getEmailCount'][0])
{
$returnType = '\MailSlurp\Models\CountDto';
$request = $this->getEmailCountRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailCount'
*
* @param string $inbox_id (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailCountRequest($inbox_id = null, string $contentType = self::contentTypes['getEmailCount'][0])
{
$resourcePath = '/emails/emails/count';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailHTML
*
* Get email content as HTML. For displaying emails in browser context.
*
* @param string $email_id email_id (required)
* @param bool $decode decode (optional, default to false)
* @param bool $replace_cid_images replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function getEmailHTML($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTML'][0])
{
list($response) = $this->getEmailHTMLWithHttpInfo($email_id, $decode, $replace_cid_images, $contentType);
return $response;
}
/**
* Operation getEmailHTMLWithHttpInfo
*
* Get email content as HTML. For displaying emails in browser context.
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailHTMLWithHttpInfo($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTML'][0])
{
$request = $this->getEmailHTMLRequest($email_id, $decode, $replace_cid_images, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailHTMLAsync
*
* Get email content as HTML. For displaying emails in browser context.
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailHTMLAsync($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTML'][0])
{
return $this->getEmailHTMLAsyncWithHttpInfo($email_id, $decode, $replace_cid_images, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailHTMLAsyncWithHttpInfo
*
* Get email content as HTML. For displaying emails in browser context.
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailHTMLAsyncWithHttpInfo($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTML'][0])
{
$returnType = 'string';
$request = $this->getEmailHTMLRequest($email_id, $decode, $replace_cid_images, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailHTML'
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTML'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailHTMLRequest($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTML'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailHTML'
);
}
$resourcePath = '/emails/{emailId}/html';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$decode,
'decode', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$replace_cid_images,
'replaceCidImages', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['text/html;charset=utf-8', 'text/html', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailHTMLJson
*
* Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content
*
* @param string $email_id email_id (required)
* @param bool $decode decode (optional, default to false)
* @param bool $replace_cid_images replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailHtmlDto
*/
public function getEmailHTMLJson($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0])
{
list($response) = $this->getEmailHTMLJsonWithHttpInfo($email_id, $decode, $replace_cid_images, $contentType);
return $response;
}
/**
* Operation getEmailHTMLJsonWithHttpInfo
*
* Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailHtmlDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailHTMLJsonWithHttpInfo($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0])
{
$request = $this->getEmailHTMLJsonRequest($email_id, $decode, $replace_cid_images, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailHtmlDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailHtmlDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailHtmlDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailHtmlDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailHtmlDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailHTMLJsonAsync
*
* Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailHTMLJsonAsync($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0])
{
return $this->getEmailHTMLJsonAsyncWithHttpInfo($email_id, $decode, $replace_cid_images, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailHTMLJsonAsyncWithHttpInfo
*
* Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailHTMLJsonAsyncWithHttpInfo($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0])
{
$returnType = '\MailSlurp\Models\EmailHtmlDto';
$request = $this->getEmailHTMLJsonRequest($email_id, $decode, $replace_cid_images, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailHTMLJson'
*
* @param string $email_id (required)
* @param bool $decode (optional, default to false)
* @param bool $replace_cid_images (optional, default to false)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailHTMLJsonRequest($email_id, $decode = false, $replace_cid_images = false, string $contentType = self::contentTypes['getEmailHTMLJson'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailHTMLJson'
);
}
$resourcePath = '/emails/{emailId}/html/json';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$decode,
'decode', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$replace_cid_images,
'replaceCidImages', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailHTMLQuery
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to perform HTML query on (required)
* @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailTextLinesResult
*/
public function getEmailHTMLQuery($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0])
{
list($response) = $this->getEmailHTMLQueryWithHttpInfo($email_id, $html_selector, $contentType);
return $response;
}
/**
* Operation getEmailHTMLQueryWithHttpInfo
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to perform HTML query on (required)
* @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailTextLinesResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailHTMLQueryWithHttpInfo($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0])
{
$request = $this->getEmailHTMLQueryRequest($email_id, $html_selector, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailTextLinesResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailTextLinesResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailTextLinesResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailTextLinesResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailTextLinesResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailHTMLQueryAsync
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to perform HTML query on (required)
* @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailHTMLQueryAsync($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0])
{
return $this->getEmailHTMLQueryAsyncWithHttpInfo($email_id, $html_selector, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailHTMLQueryAsyncWithHttpInfo
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to perform HTML query on (required)
* @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailHTMLQueryAsyncWithHttpInfo($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0])
{
$returnType = '\MailSlurp\Models\EmailTextLinesResult';
$request = $this->getEmailHTMLQueryRequest($email_id, $html_selector, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailHTMLQuery'
*
* @param string $email_id ID of email to perform HTML query on (required)
* @param string $html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailHTMLQuery'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailHTMLQueryRequest($email_id, $html_selector, string $contentType = self::contentTypes['getEmailHTMLQuery'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailHTMLQuery'
);
}
// verify the required parameter 'html_selector' is set
if ($html_selector === null || (is_array($html_selector) && count($html_selector) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $html_selector when calling getEmailHTMLQuery'
);
}
$resourcePath = '/emails/{emailId}/htmlQuery';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$html_selector,
'htmlSelector', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailLinks
*
* Parse and return list of links found in an email (only works for HTML content)
*
* @param string $email_id ID of email to fetch text for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailLinksResult
*/
public function getEmailLinks($email_id, string $contentType = self::contentTypes['getEmailLinks'][0])
{
list($response) = $this->getEmailLinksWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation getEmailLinksWithHttpInfo
*
* Parse and return list of links found in an email (only works for HTML content)
*
* @param string $email_id ID of email to fetch text for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailLinksResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailLinksWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailLinks'][0])
{
$request = $this->getEmailLinksRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailLinksResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailLinksResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailLinksResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailLinksResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailLinksResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailLinksAsync
*
* Parse and return list of links found in an email (only works for HTML content)
*
* @param string $email_id ID of email to fetch text for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailLinksAsync($email_id, string $contentType = self::contentTypes['getEmailLinks'][0])
{
return $this->getEmailLinksAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailLinksAsyncWithHttpInfo
*
* Parse and return list of links found in an email (only works for HTML content)
*
* @param string $email_id ID of email to fetch text for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailLinksAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailLinks'][0])
{
$returnType = '\MailSlurp\Models\EmailLinksResult';
$request = $this->getEmailLinksRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailLinks'
*
* @param string $email_id ID of email to fetch text for (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailLinks'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailLinksRequest($email_id, string $contentType = self::contentTypes['getEmailLinks'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailLinks'
);
}
$resourcePath = '/emails/{emailId}/links';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailPreviewURLs
*
* Get email URLs for viewing in browser or downloading
*
* @param string $email_id email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreviewUrls
*/
public function getEmailPreviewURLs($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0])
{
list($response) = $this->getEmailPreviewURLsWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation getEmailPreviewURLsWithHttpInfo
*
* Get email URLs for viewing in browser or downloading
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreviewUrls, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailPreviewURLsWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0])
{
$request = $this->getEmailPreviewURLsRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreviewUrls' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreviewUrls' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreviewUrls', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreviewUrls';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreviewUrls',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailPreviewURLsAsync
*
* Get email URLs for viewing in browser or downloading
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailPreviewURLsAsync($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0])
{
return $this->getEmailPreviewURLsAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailPreviewURLsAsyncWithHttpInfo
*
* Get email URLs for viewing in browser or downloading
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailPreviewURLsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0])
{
$returnType = '\MailSlurp\Models\EmailPreviewUrls';
$request = $this->getEmailPreviewURLsRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailPreviewURLs'
*
* @param string $email_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailPreviewURLs'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailPreviewURLsRequest($email_id, string $contentType = self::contentTypes['getEmailPreviewURLs'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailPreviewURLs'
);
}
$resourcePath = '/emails/{emailId}/urls';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailScreenshotAsBase64
*
* Take a screenshot of an email in a browser and return base64 encoded string
*
* @param string $email_id email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBase64'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailScreenshotResult
*/
public function getEmailScreenshotAsBase64($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBase64'][0])
{
list($response) = $this->getEmailScreenshotAsBase64WithHttpInfo($email_id, $get_email_screenshot_options, $contentType);
return $response;
}
/**
* Operation getEmailScreenshotAsBase64WithHttpInfo
*
* Take a screenshot of an email in a browser and return base64 encoded string
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBase64'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailScreenshotResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailScreenshotAsBase64WithHttpInfo($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBase64'][0])
{
$request = $this->getEmailScreenshotAsBase64Request($email_id, $get_email_screenshot_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailScreenshotResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailScreenshotResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailScreenshotResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailScreenshotResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailScreenshotResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailScreenshotAsBase64Async
*
* Take a screenshot of an email in a browser and return base64 encoded string
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBase64'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailScreenshotAsBase64Async($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBase64'][0])
{
return $this->getEmailScreenshotAsBase64AsyncWithHttpInfo($email_id, $get_email_screenshot_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailScreenshotAsBase64AsyncWithHttpInfo
*
* Take a screenshot of an email in a browser and return base64 encoded string
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBase64'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailScreenshotAsBase64AsyncWithHttpInfo($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBase64'][0])
{
$returnType = '\MailSlurp\Models\EmailScreenshotResult';
$request = $this->getEmailScreenshotAsBase64Request($email_id, $get_email_screenshot_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailScreenshotAsBase64'
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBase64'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailScreenshotAsBase64Request($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBase64'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailScreenshotAsBase64'
);
}
// verify the required parameter 'get_email_screenshot_options' is set
if ($get_email_screenshot_options === null || (is_array($get_email_screenshot_options) && count($get_email_screenshot_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $get_email_screenshot_options when calling getEmailScreenshotAsBase64'
);
}
$resourcePath = '/emails/{emailId}/screenshot/base64';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($get_email_screenshot_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($get_email_screenshot_options));
} else {
$httpBody = $get_email_screenshot_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailScreenshotAsBinary
*
* Take a screenshot of an email in a browser
*
* @param string $email_id email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBinary'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function getEmailScreenshotAsBinary($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBinary'][0])
{
$this->getEmailScreenshotAsBinaryWithHttpInfo($email_id, $get_email_screenshot_options, $contentType);
}
/**
* Operation getEmailScreenshotAsBinaryWithHttpInfo
*
* Take a screenshot of an email in a browser
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBinary'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailScreenshotAsBinaryWithHttpInfo($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBinary'][0])
{
$request = $this->getEmailScreenshotAsBinaryRequest($email_id, $get_email_screenshot_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation getEmailScreenshotAsBinaryAsync
*
* Take a screenshot of an email in a browser
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBinary'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailScreenshotAsBinaryAsync($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBinary'][0])
{
return $this->getEmailScreenshotAsBinaryAsyncWithHttpInfo($email_id, $get_email_screenshot_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailScreenshotAsBinaryAsyncWithHttpInfo
*
* Take a screenshot of an email in a browser
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBinary'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailScreenshotAsBinaryAsyncWithHttpInfo($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBinary'][0])
{
$returnType = '';
$request = $this->getEmailScreenshotAsBinaryRequest($email_id, $get_email_screenshot_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailScreenshotAsBinary'
*
* @param string $email_id (required)
* @param \MailSlurp\Models\GetEmailScreenshotOptions $get_email_screenshot_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailScreenshotAsBinary'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailScreenshotAsBinaryRequest($email_id, $get_email_screenshot_options, string $contentType = self::contentTypes['getEmailScreenshotAsBinary'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailScreenshotAsBinary'
);
}
// verify the required parameter 'get_email_screenshot_options' is set
if ($get_email_screenshot_options === null || (is_array($get_email_screenshot_options) && count($get_email_screenshot_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $get_email_screenshot_options when calling getEmailScreenshotAsBinary'
);
}
$resourcePath = '/emails/{emailId}/screenshot/binary';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($get_email_screenshot_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($get_email_screenshot_options));
} else {
$httpBody = $get_email_screenshot_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailTextLines
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to fetch text for (required)
* @param bool $decode_html_entities Decode HTML entities (optional)
* @param string $line_separator Line separator character (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailTextLinesResult
*/
public function getEmailTextLines($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0])
{
list($response) = $this->getEmailTextLinesWithHttpInfo($email_id, $decode_html_entities, $line_separator, $contentType);
return $response;
}
/**
* Operation getEmailTextLinesWithHttpInfo
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to fetch text for (required)
* @param bool $decode_html_entities Decode HTML entities (optional)
* @param string $line_separator Line separator character (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailTextLinesResult, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailTextLinesWithHttpInfo($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0])
{
$request = $this->getEmailTextLinesRequest($email_id, $decode_html_entities, $line_separator, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailTextLinesResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailTextLinesResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailTextLinesResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailTextLinesResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailTextLinesResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailTextLinesAsync
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to fetch text for (required)
* @param bool $decode_html_entities Decode HTML entities (optional)
* @param string $line_separator Line separator character (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailTextLinesAsync($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0])
{
return $this->getEmailTextLinesAsyncWithHttpInfo($email_id, $decode_html_entities, $line_separator, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailTextLinesAsyncWithHttpInfo
*
* Parse and return text from an email, stripping HTML and decoding encoded characters
*
* @param string $email_id ID of email to fetch text for (required)
* @param bool $decode_html_entities Decode HTML entities (optional)
* @param string $line_separator Line separator character (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailTextLinesAsyncWithHttpInfo($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0])
{
$returnType = '\MailSlurp\Models\EmailTextLinesResult';
$request = $this->getEmailTextLinesRequest($email_id, $decode_html_entities, $line_separator, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailTextLines'
*
* @param string $email_id ID of email to fetch text for (required)
* @param bool $decode_html_entities Decode HTML entities (optional)
* @param string $line_separator Line separator character (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailTextLines'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailTextLinesRequest($email_id, $decode_html_entities = null, $line_separator = null, string $contentType = self::contentTypes['getEmailTextLines'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getEmailTextLines'
);
}
$resourcePath = '/emails/{emailId}/textLines';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$decode_html_entities,
'decodeHtmlEntities', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$line_separator,
'lineSeparator', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailsOffsetPaginated
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsOffsetPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageEmailProjection
*/
public function getEmailsOffsetPaginated($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsOffsetPaginated'][0])
{
list($response) = $this->getEmailsOffsetPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getEmailsOffsetPaginatedWithHttpInfo
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsOffsetPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailsOffsetPaginatedWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsOffsetPaginated'][0])
{
$request = $this->getEmailsOffsetPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailsOffsetPaginatedAsync
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsOffsetPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailsOffsetPaginatedAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsOffsetPaginated'][0])
{
return $this->getEmailsOffsetPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailsOffsetPaginatedAsyncWithHttpInfo
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsOffsetPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailsOffsetPaginatedAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsOffsetPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageEmailProjection';
$request = $this->getEmailsOffsetPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailsOffsetPaginated'
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsOffsetPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailsOffsetPaginatedRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsOffsetPaginated'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling EmailControllerApi.getEmailsOffsetPaginated, must be smaller than or equal to 100.');
}
$resourcePath = '/emails/offset-paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'array', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getEmailsPaginated
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageEmailProjection
*/
public function getEmailsPaginated($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0])
{
list($response) = $this->getEmailsPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getEmailsPaginatedWithHttpInfo
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getEmailsPaginatedWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0])
{
$request = $this->getEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getEmailsPaginatedAsync
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailsPaginatedAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0])
{
return $this->getEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEmailsPaginatedAsyncWithHttpInfo
*
* Get all emails in all inboxes in paginated form. Email API list all.
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getEmailsPaginatedAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageEmailProjection';
$request = $this->getEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getEmailsPaginated'
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getEmailsPaginatedRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getEmailsPaginated'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling EmailControllerApi.getEmailsPaginated, must be smaller than or equal to 100.');
}
$resourcePath = '/emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'array', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getGravatarUrlForEmailAddress
*
* @param string $email_address email_address (required)
* @param string $size size (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\GravatarUrl
*/
public function getGravatarUrlForEmailAddress($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0])
{
list($response) = $this->getGravatarUrlForEmailAddressWithHttpInfo($email_address, $size, $contentType);
return $response;
}
/**
* Operation getGravatarUrlForEmailAddressWithHttpInfo
*
* @param string $email_address (required)
* @param string $size (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\GravatarUrl, HTTP status code, HTTP response headers (array of strings)
*/
public function getGravatarUrlForEmailAddressWithHttpInfo($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0])
{
$request = $this->getGravatarUrlForEmailAddressRequest($email_address, $size, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\GravatarUrl' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\GravatarUrl' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\GravatarUrl', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\GravatarUrl';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\GravatarUrl',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getGravatarUrlForEmailAddressAsync
*
* @param string $email_address (required)
* @param string $size (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGravatarUrlForEmailAddressAsync($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0])
{
return $this->getGravatarUrlForEmailAddressAsyncWithHttpInfo($email_address, $size, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getGravatarUrlForEmailAddressAsyncWithHttpInfo
*
* @param string $email_address (required)
* @param string $size (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getGravatarUrlForEmailAddressAsyncWithHttpInfo($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0])
{
$returnType = '\MailSlurp\Models\GravatarUrl';
$request = $this->getGravatarUrlForEmailAddressRequest($email_address, $size, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getGravatarUrlForEmailAddress'
*
* @param string $email_address (required)
* @param string $size (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGravatarUrlForEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getGravatarUrlForEmailAddressRequest($email_address, $size = null, string $contentType = self::contentTypes['getGravatarUrlForEmailAddress'][0])
{
// verify the required parameter 'email_address' is set
if ($email_address === null || (is_array($email_address) && count($email_address) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_address when calling getGravatarUrlForEmailAddress'
);
}
$resourcePath = '/emails/gravatarFor';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getLatestEmail
*
* Get latest email in all inboxes. Most recently received.
*
* @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Email
*/
public function getLatestEmail($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0])
{
list($response) = $this->getLatestEmailWithHttpInfo($inbox_ids, $contentType);
return $response;
}
/**
* Operation getLatestEmailWithHttpInfo
*
* Get latest email in all inboxes. Most recently received.
*
* @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings)
*/
public function getLatestEmailWithHttpInfo($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0])
{
$request = $this->getLatestEmailRequest($inbox_ids, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Email' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Email' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Email';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Email',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getLatestEmailAsync
*
* Get latest email in all inboxes. Most recently received.
*
* @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getLatestEmailAsync($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0])
{
return $this->getLatestEmailAsyncWithHttpInfo($inbox_ids, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getLatestEmailAsyncWithHttpInfo
*
* Get latest email in all inboxes. Most recently received.
*
* @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getLatestEmailAsyncWithHttpInfo($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0])
{
$returnType = '\MailSlurp\Models\Email';
$request = $this->getLatestEmailRequest($inbox_ids, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getLatestEmail'
*
* @param string[] $inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getLatestEmailRequest($inbox_ids = null, string $contentType = self::contentTypes['getLatestEmail'][0])
{
$resourcePath = '/emails/latest';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_ids,
'inboxIds', // param base name
'array', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getLatestEmailInInbox1
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Email
*/
public function getLatestEmailInInbox1($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0])
{
list($response) = $this->getLatestEmailInInbox1WithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getLatestEmailInInbox1WithHttpInfo
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Email, HTTP status code, HTTP response headers (array of strings)
*/
public function getLatestEmailInInbox1WithHttpInfo($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0])
{
$request = $this->getLatestEmailInInbox1Request($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Email' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Email' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Email', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Email';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Email',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getLatestEmailInInbox1Async
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getLatestEmailInInbox1Async($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0])
{
return $this->getLatestEmailInInbox1AsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getLatestEmailInInbox1AsyncWithHttpInfo
*
* Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet.
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getLatestEmailInInbox1AsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0])
{
$returnType = '\MailSlurp\Models\Email';
$request = $this->getLatestEmailInInbox1Request($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getLatestEmailInInbox1'
*
* @param string $inbox_id ID of the inbox you want to get the latest email from (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getLatestEmailInInbox1'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getLatestEmailInInbox1Request($inbox_id, string $contentType = self::contentTypes['getLatestEmailInInbox1'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling getLatestEmailInInbox1'
);
}
$resourcePath = '/emails/latestIn';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getOrganizationEmailsPaginated
*
* Get all organization emails. List team or shared test email accounts
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter search filter for emails. (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageEmailProjection
*/
public function getOrganizationEmailsPaginated($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0])
{
list($response) = $this->getOrganizationEmailsPaginatedWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
return $response;
}
/**
* Operation getOrganizationEmailsPaginatedWithHttpInfo
*
* Get all organization emails. List team or shared test email accounts
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter search filter for emails. (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrganizationEmailsPaginatedWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0])
{
$request = $this->getOrganizationEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getOrganizationEmailsPaginatedAsync
*
* Get all organization emails. List team or shared test email accounts
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter search filter for emails. (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrganizationEmailsPaginatedAsync($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0])
{
return $this->getOrganizationEmailsPaginatedAsyncWithHttpInfo($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrganizationEmailsPaginatedAsyncWithHttpInfo
*
* Get all organization emails. List team or shared test email accounts
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter search filter for emails. (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrganizationEmailsPaginatedAsyncWithHttpInfo($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageEmailProjection';
$request = $this->getOrganizationEmailsPaginatedRequest($inbox_id, $page, $size, $sort, $unread_only, $search_filter, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getOrganizationEmailsPaginated'
*
* @param string[] $inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. (optional)
* @param int $page Optional page index in email list pagination (optional, default to 0)
* @param int $size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param bool $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (optional, default to false)
* @param string $search_filter Optional search filter search filter for emails. (optional)
* @param \DateTime $since Optional filter emails received after given date time. If unset will use time 24hours prior to now. (optional)
* @param \DateTime $before Optional filter emails received before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationEmailsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getOrganizationEmailsPaginatedRequest($inbox_id = null, $page = 0, $size = 20, $sort = 'ASC', $unread_only = false, $search_filter = null, $since = null, $before = null, string $contentType = self::contentTypes['getOrganizationEmailsPaginated'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling EmailControllerApi.getOrganizationEmailsPaginated, must be smaller than or equal to 100.');
}
$resourcePath = '/emails/organization';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'array', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$unread_only,
'unreadOnly', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search_filter,
'searchFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getRawEmailContents
*
* Get raw email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function getRawEmailContents($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0])
{
$this->getRawEmailContentsWithHttpInfo($email_id, $contentType);
}
/**
* Operation getRawEmailContentsWithHttpInfo
*
* Get raw email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function getRawEmailContentsWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0])
{
$request = $this->getRawEmailContentsRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation getRawEmailContentsAsync
*
* Get raw email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawEmailContentsAsync($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0])
{
return $this->getRawEmailContentsAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getRawEmailContentsAsyncWithHttpInfo
*
* Get raw email string. Returns unparsed raw SMTP message with headers and body.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawEmailContentsAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0])
{
$returnType = '';
$request = $this->getRawEmailContentsRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getRawEmailContents'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailContents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getRawEmailContentsRequest($email_id, string $contentType = self::contentTypes['getRawEmailContents'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getRawEmailContents'
);
}
$resourcePath = '/emails/{emailId}/raw';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getRawEmailJson
*
* Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\RawEmailJson
*/
public function getRawEmailJson($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0])
{
list($response) = $this->getRawEmailJsonWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation getRawEmailJsonWithHttpInfo
*
* Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\RawEmailJson, HTTP status code, HTTP response headers (array of strings)
*/
public function getRawEmailJsonWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0])
{
$request = $this->getRawEmailJsonRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\RawEmailJson' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\RawEmailJson' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\RawEmailJson', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\RawEmailJson';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\RawEmailJson',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getRawEmailJsonAsync
*
* Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawEmailJsonAsync($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0])
{
return $this->getRawEmailJsonAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getRawEmailJsonAsyncWithHttpInfo
*
* Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRawEmailJsonAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0])
{
$returnType = '\MailSlurp\Models\RawEmailJson';
$request = $this->getRawEmailJsonRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getRawEmailJson'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRawEmailJson'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getRawEmailJsonRequest($email_id, string $contentType = self::contentTypes['getRawEmailJson'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling getRawEmailJson'
);
}
$resourcePath = '/emails/{emailId}/raw/json';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getUnreadEmailCount
*
* Get unread email count
*
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\UnreadCount
*/
public function getUnreadEmailCount($inbox_id = null, string $contentType = self::contentTypes['getUnreadEmailCount'][0])
{
list($response) = $this->getUnreadEmailCountWithHttpInfo($inbox_id, $contentType);
return $response;
}
/**
* Operation getUnreadEmailCountWithHttpInfo
*
* Get unread email count
*
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\UnreadCount, HTTP status code, HTTP response headers (array of strings)
*/
public function getUnreadEmailCountWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getUnreadEmailCount'][0])
{
$request = $this->getUnreadEmailCountRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\UnreadCount' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\UnreadCount' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\UnreadCount', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\UnreadCount';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\UnreadCount',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getUnreadEmailCountAsync
*
* Get unread email count
*
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getUnreadEmailCountAsync($inbox_id = null, string $contentType = self::contentTypes['getUnreadEmailCount'][0])
{
return $this->getUnreadEmailCountAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getUnreadEmailCountAsyncWithHttpInfo
*
* Get unread email count
*
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getUnreadEmailCountAsyncWithHttpInfo($inbox_id = null, string $contentType = self::contentTypes['getUnreadEmailCount'][0])
{
$returnType = '\MailSlurp\Models\UnreadCount';
$request = $this->getUnreadEmailCountRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getUnreadEmailCount'
*
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUnreadEmailCount'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getUnreadEmailCountRequest($inbox_id = null, string $contentType = self::contentTypes['getUnreadEmailCount'][0])
{
$resourcePath = '/emails/unreadCount';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation markAllAsRead
*
* Mark all emails as read or unread
*
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAllAsRead'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function markAllAsRead($read = true, $inbox_id = null, string $contentType = self::contentTypes['markAllAsRead'][0])
{
$this->markAllAsReadWithHttpInfo($read, $inbox_id, $contentType);
}
/**
* Operation markAllAsReadWithHttpInfo
*
* Mark all emails as read or unread
*
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAllAsRead'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function markAllAsReadWithHttpInfo($read = true, $inbox_id = null, string $contentType = self::contentTypes['markAllAsRead'][0])
{
$request = $this->markAllAsReadRequest($read, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation markAllAsReadAsync
*
* Mark all emails as read or unread
*
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAllAsRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function markAllAsReadAsync($read = true, $inbox_id = null, string $contentType = self::contentTypes['markAllAsRead'][0])
{
return $this->markAllAsReadAsyncWithHttpInfo($read, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation markAllAsReadAsyncWithHttpInfo
*
* Mark all emails as read or unread
*
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAllAsRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function markAllAsReadAsyncWithHttpInfo($read = true, $inbox_id = null, string $contentType = self::contentTypes['markAllAsRead'][0])
{
$returnType = '';
$request = $this->markAllAsReadRequest($read, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'markAllAsRead'
*
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $inbox_id Optional inbox ID filter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAllAsRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function markAllAsReadRequest($read = true, $inbox_id = null, string $contentType = self::contentTypes['markAllAsRead'][0])
{
$resourcePath = '/emails/read';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$read,
'read', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation markAsRead
*
* Mark an email as read or unread
*
* @param string $email_id email_id (required)
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\EmailPreview
*/
public function markAsRead($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0])
{
list($response) = $this->markAsReadWithHttpInfo($email_id, $read, $contentType);
return $response;
}
/**
* Operation markAsReadWithHttpInfo
*
* Mark an email as read or unread
*
* @param string $email_id (required)
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\EmailPreview, HTTP status code, HTTP response headers (array of strings)
*/
public function markAsReadWithHttpInfo($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0])
{
$request = $this->markAsReadRequest($email_id, $read, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\EmailPreview' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\EmailPreview' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\EmailPreview', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\EmailPreview';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\EmailPreview',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation markAsReadAsync
*
* Mark an email as read or unread
*
* @param string $email_id (required)
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function markAsReadAsync($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0])
{
return $this->markAsReadAsyncWithHttpInfo($email_id, $read, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation markAsReadAsyncWithHttpInfo
*
* Mark an email as read or unread
*
* @param string $email_id (required)
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function markAsReadAsyncWithHttpInfo($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0])
{
$returnType = '\MailSlurp\Models\EmailPreview';
$request = $this->markAsReadRequest($email_id, $read, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'markAsRead'
*
* @param string $email_id (required)
* @param bool $read What value to assign to email read property. Default true. (optional, default to true)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['markAsRead'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function markAsReadRequest($email_id, $read = true, string $contentType = self::contentTypes['markAsRead'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling markAsRead'
);
}
$resourcePath = '/emails/{emailId}/read';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$read,
'read', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PATCH',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation replyToEmail
*
* Reply to an email
*
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options reply_to_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentEmailDto
*/
public function replyToEmail($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0])
{
list($response) = $this->replyToEmailWithHttpInfo($email_id, $reply_to_email_options, $contentType);
return $response;
}
/**
* Operation replyToEmailWithHttpInfo
*
* Reply to an email
*
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function replyToEmailWithHttpInfo($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0])
{
$request = $this->replyToEmailRequest($email_id, $reply_to_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation replyToEmailAsync
*
* Reply to an email
*
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function replyToEmailAsync($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0])
{
return $this->replyToEmailAsyncWithHttpInfo($email_id, $reply_to_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation replyToEmailAsyncWithHttpInfo
*
* Reply to an email
*
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function replyToEmailAsyncWithHttpInfo($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0])
{
$returnType = '\MailSlurp\Models\SentEmailDto';
$request = $this->replyToEmailRequest($email_id, $reply_to_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'replyToEmail'
*
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToEmailOptions $reply_to_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function replyToEmailRequest($email_id, $reply_to_email_options, string $contentType = self::contentTypes['replyToEmail'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling replyToEmail'
);
}
// verify the required parameter 'reply_to_email_options' is set
if ($reply_to_email_options === null || (is_array($reply_to_email_options) && count($reply_to_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $reply_to_email_options when calling replyToEmail'
);
}
$resourcePath = '/emails/{emailId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($reply_to_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($reply_to_email_options));
} else {
$httpBody = $reply_to_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation searchEmails
*
* Get all emails by search criteria. Return in paginated form.
*
* @param \MailSlurp\Models\SearchEmailsOptions $search_emails_options search_emails_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageEmailProjection
*/
public function searchEmails($search_emails_options, string $contentType = self::contentTypes['searchEmails'][0])
{
list($response) = $this->searchEmailsWithHttpInfo($search_emails_options, $contentType);
return $response;
}
/**
* Operation searchEmailsWithHttpInfo
*
* Get all emails by search criteria. Return in paginated form.
*
* @param \MailSlurp\Models\SearchEmailsOptions $search_emails_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function searchEmailsWithHttpInfo($search_emails_options, string $contentType = self::contentTypes['searchEmails'][0])
{
$request = $this->searchEmailsRequest($search_emails_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation searchEmailsAsync
*
* Get all emails by search criteria. Return in paginated form.
*
* @param \MailSlurp\Models\SearchEmailsOptions $search_emails_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function searchEmailsAsync($search_emails_options, string $contentType = self::contentTypes['searchEmails'][0])
{
return $this->searchEmailsAsyncWithHttpInfo($search_emails_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation searchEmailsAsyncWithHttpInfo
*
* Get all emails by search criteria. Return in paginated form.
*
* @param \MailSlurp\Models\SearchEmailsOptions $search_emails_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function searchEmailsAsyncWithHttpInfo($search_emails_options, string $contentType = self::contentTypes['searchEmails'][0])
{
$returnType = '\MailSlurp\Models\PageEmailProjection';
$request = $this->searchEmailsRequest($search_emails_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'searchEmails'
*
* @param \MailSlurp\Models\SearchEmailsOptions $search_emails_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function searchEmailsRequest($search_emails_options, string $contentType = self::contentTypes['searchEmails'][0])
{
// verify the required parameter 'search_emails_options' is set
if ($search_emails_options === null || (is_array($search_emails_options) && count($search_emails_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $search_emails_options when calling searchEmails'
);
}
$resourcePath = '/emails/search';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($search_emails_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($search_emails_options));
} else {
$httpBody = $search_emails_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendEmailSourceOptional
*
* Send email
*
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required)
* @param string $inbox_id ID of the inbox you want to send the email from (optional)
* @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional)
* @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function sendEmailSourceOptional($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0])
{
$this->sendEmailSourceOptionalWithHttpInfo($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType);
}
/**
* Operation sendEmailSourceOptionalWithHttpInfo
*
* Send email
*
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $inbox_id ID of the inbox you want to send the email from (optional)
* @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional)
* @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function sendEmailSourceOptionalWithHttpInfo($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0])
{
$request = $this->sendEmailSourceOptionalRequest($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation sendEmailSourceOptionalAsync
*
* Send email
*
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $inbox_id ID of the inbox you want to send the email from (optional)
* @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional)
* @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailSourceOptionalAsync($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0])
{
return $this->sendEmailSourceOptionalAsyncWithHttpInfo($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendEmailSourceOptionalAsyncWithHttpInfo
*
* Send email
*
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $inbox_id ID of the inbox you want to send the email from (optional)
* @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional)
* @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailSourceOptionalAsyncWithHttpInfo($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0])
{
$returnType = '';
$request = $this->sendEmailSourceOptionalRequest($send_email_options, $inbox_id, $use_domain_pool, $virtual_send, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendEmailSourceOptional'
*
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $inbox_id ID of the inbox you want to send the email from (optional)
* @param bool $use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. (optional)
* @param bool $virtual_send Optionally create inbox to send from that is a virtual inbox and won't send to external addresses (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSourceOptional'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendEmailSourceOptionalRequest($send_email_options, $inbox_id = null, $use_domain_pool = null, $virtual_send = null, string $contentType = self::contentTypes['sendEmailSourceOptional'][0])
{
// verify the required parameter 'send_email_options' is set
if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_email_options when calling sendEmailSourceOptional'
);
}
$resourcePath = '/emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$use_domain_pool,
'useDomainPool', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$virtual_send,
'virtualSend', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options));
} else {
$httpBody = $send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation validateEmail
*
* Validate email HTML contents
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ValidationDto
*/
public function validateEmail($email_id, string $contentType = self::contentTypes['validateEmail'][0])
{
list($response) = $this->validateEmailWithHttpInfo($email_id, $contentType);
return $response;
}
/**
* Operation validateEmailWithHttpInfo
*
* Validate email HTML contents
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ValidationDto, HTTP status code, HTTP response headers (array of strings)
*/
public function validateEmailWithHttpInfo($email_id, string $contentType = self::contentTypes['validateEmail'][0])
{
$request = $this->validateEmailRequest($email_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\ValidationDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ValidationDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ValidationDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ValidationDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ValidationDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation validateEmailAsync
*
* Validate email HTML contents
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function validateEmailAsync($email_id, string $contentType = self::contentTypes['validateEmail'][0])
{
return $this->validateEmailAsyncWithHttpInfo($email_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation validateEmailAsyncWithHttpInfo
*
* Validate email HTML contents
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function validateEmailAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['validateEmail'][0])
{
$returnType = '\MailSlurp\Models\ValidationDto';
$request = $this->validateEmailRequest($email_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'validateEmail'
*
* @param string $email_id ID of email (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function validateEmailRequest($email_id, string $contentType = self::contentTypes['validateEmail'][0])
{
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling validateEmail'
);
}
$resourcePath = '/emails/{emailId}/validate';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* DomainControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* DomainControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class DomainControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'addDomainWildcardCatchAll' => [
'application/json',
],
'createDomain' => [
'application/json',
],
'deleteDomain' => [
'application/json',
],
'getAvailableDomains' => [
'application/json',
],
'getDomain' => [
'application/json',
],
'getDomainIssues' => [
'application/json',
],
'getDomainWildcardCatchAllInbox' => [
'application/json',
],
'getDomains' => [
'application/json',
],
'getMailSlurpDomains' => [
'application/json',
],
'updateDomain' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation addDomainWildcardCatchAll
*
* Add catch all wild card inbox to domain
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainDto
*/
public function addDomainWildcardCatchAll($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0])
{
list($response) = $this->addDomainWildcardCatchAllWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation addDomainWildcardCatchAllWithHttpInfo
*
* Add catch all wild card inbox to domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings)
*/
public function addDomainWildcardCatchAllWithHttpInfo($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0])
{
$request = $this->addDomainWildcardCatchAllRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation addDomainWildcardCatchAllAsync
*
* Add catch all wild card inbox to domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function addDomainWildcardCatchAllAsync($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0])
{
return $this->addDomainWildcardCatchAllAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation addDomainWildcardCatchAllAsyncWithHttpInfo
*
* Add catch all wild card inbox to domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function addDomainWildcardCatchAllAsyncWithHttpInfo($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0])
{
$returnType = '\MailSlurp\Models\DomainDto';
$request = $this->addDomainWildcardCatchAllRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'addDomainWildcardCatchAll'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addDomainWildcardCatchAll'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function addDomainWildcardCatchAllRequest($id, string $contentType = self::contentTypes['addDomainWildcardCatchAll'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling addDomainWildcardCatchAll'
);
}
$resourcePath = '/domains/{id}/wildcard';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createDomain
*
* Create Domain
*
* @param \MailSlurp\Models\CreateDomainOptions $create_domain_options create_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainDto
*/
public function createDomain($create_domain_options, string $contentType = self::contentTypes['createDomain'][0])
{
list($response) = $this->createDomainWithHttpInfo($create_domain_options, $contentType);
return $response;
}
/**
* Operation createDomainWithHttpInfo
*
* Create Domain
*
* @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createDomainWithHttpInfo($create_domain_options, string $contentType = self::contentTypes['createDomain'][0])
{
$request = $this->createDomainRequest($create_domain_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createDomainAsync
*
* Create Domain
*
* @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createDomainAsync($create_domain_options, string $contentType = self::contentTypes['createDomain'][0])
{
return $this->createDomainAsyncWithHttpInfo($create_domain_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createDomainAsyncWithHttpInfo
*
* Create Domain
*
* @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createDomainAsyncWithHttpInfo($create_domain_options, string $contentType = self::contentTypes['createDomain'][0])
{
$returnType = '\MailSlurp\Models\DomainDto';
$request = $this->createDomainRequest($create_domain_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createDomain'
*
* @param \MailSlurp\Models\CreateDomainOptions $create_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createDomainRequest($create_domain_options, string $contentType = self::contentTypes['createDomain'][0])
{
// verify the required parameter 'create_domain_options' is set
if ($create_domain_options === null || (is_array($create_domain_options) && count($create_domain_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_domain_options when calling createDomain'
);
}
$resourcePath = '/domains';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_domain_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_domain_options));
} else {
$httpBody = $create_domain_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteDomain
*
* Delete a domain
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string[]
*/
public function deleteDomain($id, string $contentType = self::contentTypes['deleteDomain'][0])
{
list($response) = $this->deleteDomainWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation deleteDomainWithHttpInfo
*
* Delete a domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string[], HTTP status code, HTTP response headers (array of strings)
*/
public function deleteDomainWithHttpInfo($id, string $contentType = self::contentTypes['deleteDomain'][0])
{
$request = $this->deleteDomainRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 204:
if ('string[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 204:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation deleteDomainAsync
*
* Delete a domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteDomainAsync($id, string $contentType = self::contentTypes['deleteDomain'][0])
{
return $this->deleteDomainAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteDomainAsyncWithHttpInfo
*
* Delete a domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteDomainAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteDomain'][0])
{
$returnType = 'string[]';
$request = $this->deleteDomainRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteDomain'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteDomainRequest($id, string $contentType = self::contentTypes['deleteDomain'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteDomain'
);
}
$resourcePath = '/domains/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAvailableDomains
*
* Get all usable domains
*
* @param string $inbox_type inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAvailableDomains'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainGroupsDto
*/
public function getAvailableDomains($inbox_type = null, string $contentType = self::contentTypes['getAvailableDomains'][0])
{
list($response) = $this->getAvailableDomainsWithHttpInfo($inbox_type, $contentType);
return $response;
}
/**
* Operation getAvailableDomainsWithHttpInfo
*
* Get all usable domains
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAvailableDomains'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainGroupsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getAvailableDomainsWithHttpInfo($inbox_type = null, string $contentType = self::contentTypes['getAvailableDomains'][0])
{
$request = $this->getAvailableDomainsRequest($inbox_type, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DomainGroupsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainGroupsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainGroupsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainGroupsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainGroupsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAvailableDomainsAsync
*
* Get all usable domains
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAvailableDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAvailableDomainsAsync($inbox_type = null, string $contentType = self::contentTypes['getAvailableDomains'][0])
{
return $this->getAvailableDomainsAsyncWithHttpInfo($inbox_type, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAvailableDomainsAsyncWithHttpInfo
*
* Get all usable domains
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAvailableDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAvailableDomainsAsyncWithHttpInfo($inbox_type = null, string $contentType = self::contentTypes['getAvailableDomains'][0])
{
$returnType = '\MailSlurp\Models\DomainGroupsDto';
$request = $this->getAvailableDomainsRequest($inbox_type, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAvailableDomains'
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAvailableDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAvailableDomainsRequest($inbox_type = null, string $contentType = self::contentTypes['getAvailableDomains'][0])
{
$resourcePath = '/domains/available-domains';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_type,
'inboxType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getDomain
*
* Get a domain
*
* @param string $id id (required)
* @param bool $check_for_errors check_for_errors (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainDto
*/
public function getDomain($id, $check_for_errors = null, string $contentType = self::contentTypes['getDomain'][0])
{
list($response) = $this->getDomainWithHttpInfo($id, $check_for_errors, $contentType);
return $response;
}
/**
* Operation getDomainWithHttpInfo
*
* Get a domain
*
* @param string $id (required)
* @param bool $check_for_errors (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getDomainWithHttpInfo($id, $check_for_errors = null, string $contentType = self::contentTypes['getDomain'][0])
{
$request = $this->getDomainRequest($id, $check_for_errors, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getDomainAsync
*
* Get a domain
*
* @param string $id (required)
* @param bool $check_for_errors (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainAsync($id, $check_for_errors = null, string $contentType = self::contentTypes['getDomain'][0])
{
return $this->getDomainAsyncWithHttpInfo($id, $check_for_errors, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDomainAsyncWithHttpInfo
*
* Get a domain
*
* @param string $id (required)
* @param bool $check_for_errors (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainAsyncWithHttpInfo($id, $check_for_errors = null, string $contentType = self::contentTypes['getDomain'][0])
{
$returnType = '\MailSlurp\Models\DomainDto';
$request = $this->getDomainRequest($id, $check_for_errors, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getDomain'
*
* @param string $id (required)
* @param bool $check_for_errors (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getDomainRequest($id, $check_for_errors = null, string $contentType = self::contentTypes['getDomain'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getDomain'
);
}
$resourcePath = '/domains/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$check_for_errors,
'checkForErrors', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getDomainIssues
*
* Get domain issues
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainIssues'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainIssuesDto
*/
public function getDomainIssues(string $contentType = self::contentTypes['getDomainIssues'][0])
{
list($response) = $this->getDomainIssuesWithHttpInfo($contentType);
return $response;
}
/**
* Operation getDomainIssuesWithHttpInfo
*
* Get domain issues
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainIssues'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainIssuesDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getDomainIssuesWithHttpInfo(string $contentType = self::contentTypes['getDomainIssues'][0])
{
$request = $this->getDomainIssuesRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DomainIssuesDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainIssuesDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainIssuesDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainIssuesDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainIssuesDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getDomainIssuesAsync
*
* Get domain issues
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainIssues'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainIssuesAsync(string $contentType = self::contentTypes['getDomainIssues'][0])
{
return $this->getDomainIssuesAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDomainIssuesAsyncWithHttpInfo
*
* Get domain issues
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainIssues'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainIssuesAsyncWithHttpInfo(string $contentType = self::contentTypes['getDomainIssues'][0])
{
$returnType = '\MailSlurp\Models\DomainIssuesDto';
$request = $this->getDomainIssuesRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getDomainIssues'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainIssues'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getDomainIssuesRequest(string $contentType = self::contentTypes['getDomainIssues'][0])
{
$resourcePath = '/domains/issues';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getDomainWildcardCatchAllInbox
*
* Get catch all wild card inbox for domain
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function getDomainWildcardCatchAllInbox($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0])
{
list($response) = $this->getDomainWildcardCatchAllInboxWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getDomainWildcardCatchAllInboxWithHttpInfo
*
* Get catch all wild card inbox for domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getDomainWildcardCatchAllInboxWithHttpInfo($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0])
{
$request = $this->getDomainWildcardCatchAllInboxRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getDomainWildcardCatchAllInboxAsync
*
* Get catch all wild card inbox for domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainWildcardCatchAllInboxAsync($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0])
{
return $this->getDomainWildcardCatchAllInboxAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDomainWildcardCatchAllInboxAsyncWithHttpInfo
*
* Get catch all wild card inbox for domain
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainWildcardCatchAllInboxAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->getDomainWildcardCatchAllInboxRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getDomainWildcardCatchAllInbox'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomainWildcardCatchAllInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getDomainWildcardCatchAllInboxRequest($id, string $contentType = self::contentTypes['getDomainWildcardCatchAllInbox'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getDomainWildcardCatchAllInbox'
);
}
$resourcePath = '/domains/{id}/wildcard';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getDomains
*
* Get domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainPreview[]
*/
public function getDomains(string $contentType = self::contentTypes['getDomains'][0])
{
list($response) = $this->getDomainsWithHttpInfo($contentType);
return $response;
}
/**
* Operation getDomainsWithHttpInfo
*
* Get domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainPreview[], HTTP status code, HTTP response headers (array of strings)
*/
public function getDomainsWithHttpInfo(string $contentType = self::contentTypes['getDomains'][0])
{
$request = $this->getDomainsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DomainPreview[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainPreview[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainPreview[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainPreview[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainPreview[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getDomainsAsync
*
* Get domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainsAsync(string $contentType = self::contentTypes['getDomains'][0])
{
return $this->getDomainsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDomainsAsyncWithHttpInfo
*
* Get domains
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDomainsAsyncWithHttpInfo(string $contentType = self::contentTypes['getDomains'][0])
{
$returnType = '\MailSlurp\Models\DomainPreview[]';
$request = $this->getDomainsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getDomains'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getDomainsRequest(string $contentType = self::contentTypes['getDomains'][0])
{
$resourcePath = '/domains';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getMailSlurpDomains
*
* Get MailSlurp domains
*
* @param string $inbox_type inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMailSlurpDomains'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainGroupsDto
*/
public function getMailSlurpDomains($inbox_type = null, string $contentType = self::contentTypes['getMailSlurpDomains'][0])
{
list($response) = $this->getMailSlurpDomainsWithHttpInfo($inbox_type, $contentType);
return $response;
}
/**
* Operation getMailSlurpDomainsWithHttpInfo
*
* Get MailSlurp domains
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMailSlurpDomains'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainGroupsDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getMailSlurpDomainsWithHttpInfo($inbox_type = null, string $contentType = self::contentTypes['getMailSlurpDomains'][0])
{
$request = $this->getMailSlurpDomainsRequest($inbox_type, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DomainGroupsDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainGroupsDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainGroupsDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainGroupsDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainGroupsDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getMailSlurpDomainsAsync
*
* Get MailSlurp domains
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMailSlurpDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMailSlurpDomainsAsync($inbox_type = null, string $contentType = self::contentTypes['getMailSlurpDomains'][0])
{
return $this->getMailSlurpDomainsAsyncWithHttpInfo($inbox_type, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getMailSlurpDomainsAsyncWithHttpInfo
*
* Get MailSlurp domains
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMailSlurpDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMailSlurpDomainsAsyncWithHttpInfo($inbox_type = null, string $contentType = self::contentTypes['getMailSlurpDomains'][0])
{
$returnType = '\MailSlurp\Models\DomainGroupsDto';
$request = $this->getMailSlurpDomainsRequest($inbox_type, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getMailSlurpDomains'
*
* @param string $inbox_type (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMailSlurpDomains'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getMailSlurpDomainsRequest($inbox_type = null, string $contentType = self::contentTypes['getMailSlurpDomains'][0])
{
$resourcePath = '/domains/mailslurp-domains';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_type,
'inboxType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateDomain
*
* Update a domain
*
* @param string $id id (required)
* @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options update_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DomainDto
*/
public function updateDomain($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0])
{
list($response) = $this->updateDomainWithHttpInfo($id, $update_domain_options, $contentType);
return $response;
}
/**
* Operation updateDomainWithHttpInfo
*
* Update a domain
*
* @param string $id (required)
* @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DomainDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateDomainWithHttpInfo($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0])
{
$request = $this->updateDomainRequest($id, $update_domain_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DomainDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DomainDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DomainDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DomainDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DomainDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateDomainAsync
*
* Update a domain
*
* @param string $id (required)
* @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateDomainAsync($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0])
{
return $this->updateDomainAsyncWithHttpInfo($id, $update_domain_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateDomainAsyncWithHttpInfo
*
* Update a domain
*
* @param string $id (required)
* @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateDomainAsyncWithHttpInfo($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0])
{
$returnType = '\MailSlurp\Models\DomainDto';
$request = $this->updateDomainRequest($id, $update_domain_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateDomain'
*
* @param string $id (required)
* @param \MailSlurp\Models\UpdateDomainOptions $update_domain_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateDomain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateDomainRequest($id, $update_domain_options, string $contentType = self::contentTypes['updateDomain'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling updateDomain'
);
}
// verify the required parameter 'update_domain_options' is set
if ($update_domain_options === null || (is_array($update_domain_options) && count($update_domain_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_domain_options when calling updateDomain'
);
}
$resourcePath = '/domains/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_domain_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_domain_options));
} else {
$httpBody = $update_domain_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* ContactControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* ContactControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ContactControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createContact' => [
'application/json',
],
'deleteContact' => [
'application/json',
],
'getAllContacts' => [
'application/json',
],
'getContact' => [
'application/json',
],
'getContactVCard' => [
'application/json',
],
'getContacts' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createContact
*
* Create a contact
*
* @param \MailSlurp\Models\CreateContactOptions $create_contact_options create_contact_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ContactDto
*/
public function createContact($create_contact_options, string $contentType = self::contentTypes['createContact'][0])
{
list($response) = $this->createContactWithHttpInfo($create_contact_options, $contentType);
return $response;
}
/**
* Operation createContactWithHttpInfo
*
* Create a contact
*
* @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ContactDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createContactWithHttpInfo($create_contact_options, string $contentType = self::contentTypes['createContact'][0])
{
$request = $this->createContactRequest($create_contact_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\ContactDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ContactDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ContactDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ContactDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ContactDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createContactAsync
*
* Create a contact
*
* @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createContactAsync($create_contact_options, string $contentType = self::contentTypes['createContact'][0])
{
return $this->createContactAsyncWithHttpInfo($create_contact_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createContactAsyncWithHttpInfo
*
* Create a contact
*
* @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createContactAsyncWithHttpInfo($create_contact_options, string $contentType = self::contentTypes['createContact'][0])
{
$returnType = '\MailSlurp\Models\ContactDto';
$request = $this->createContactRequest($create_contact_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createContact'
*
* @param \MailSlurp\Models\CreateContactOptions $create_contact_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createContactRequest($create_contact_options, string $contentType = self::contentTypes['createContact'][0])
{
// verify the required parameter 'create_contact_options' is set
if ($create_contact_options === null || (is_array($create_contact_options) && count($create_contact_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_contact_options when calling createContact'
);
}
$resourcePath = '/contacts';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_contact_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_contact_options));
} else {
$httpBody = $create_contact_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteContact
*
* Delete contact
*
* @param string $contact_id contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteContact($contact_id, string $contentType = self::contentTypes['deleteContact'][0])
{
$this->deleteContactWithHttpInfo($contact_id, $contentType);
}
/**
* Operation deleteContactWithHttpInfo
*
* Delete contact
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteContactWithHttpInfo($contact_id, string $contentType = self::contentTypes['deleteContact'][0])
{
$request = $this->deleteContactRequest($contact_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteContactAsync
*
* Delete contact
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteContactAsync($contact_id, string $contentType = self::contentTypes['deleteContact'][0])
{
return $this->deleteContactAsyncWithHttpInfo($contact_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteContactAsyncWithHttpInfo
*
* Delete contact
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteContactAsyncWithHttpInfo($contact_id, string $contentType = self::contentTypes['deleteContact'][0])
{
$returnType = '';
$request = $this->deleteContactRequest($contact_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteContact'
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteContactRequest($contact_id, string $contentType = self::contentTypes['deleteContact'][0])
{
// verify the required parameter 'contact_id' is set
if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $contact_id when calling deleteContact'
);
}
$resourcePath = '/contacts/{contactId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($contact_id !== null) {
$resourcePath = str_replace(
'{' . 'contactId' . '}',
ObjectSerializer::toPathValue($contact_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllContacts
*
* Get all contacts
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $search Search terms (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageContactProjection
*/
public function getAllContacts($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, $search = null, string $contentType = self::contentTypes['getAllContacts'][0])
{
list($response) = $this->getAllContactsWithHttpInfo($page, $size, $sort, $since, $before, $search, $contentType);
return $response;
}
/**
* Operation getAllContactsWithHttpInfo
*
* Get all contacts
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $search Search terms (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageContactProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllContactsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, $search = null, string $contentType = self::contentTypes['getAllContacts'][0])
{
$request = $this->getAllContactsRequest($page, $size, $sort, $since, $before, $search, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageContactProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageContactProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageContactProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageContactProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageContactProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllContactsAsync
*
* Get all contacts
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $search Search terms (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllContactsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, $search = null, string $contentType = self::contentTypes['getAllContacts'][0])
{
return $this->getAllContactsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $search, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllContactsAsyncWithHttpInfo
*
* Get all contacts
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $search Search terms (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllContactsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, $search = null, string $contentType = self::contentTypes['getAllContacts'][0])
{
$returnType = '\MailSlurp\Models\PageContactProjection';
$request = $this->getAllContactsRequest($page, $size, $sort, $since, $before, $search, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllContacts'
*
* @param int $page Optional page index in list pagination (optional, default to 0)
* @param int $size Optional page size in list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $search Search terms (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllContactsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, $search = null, string $contentType = self::contentTypes['getAllContacts'][0])
{
$resourcePath = '/contacts/paginated';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search,
'search', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getContact
*
* Get contact
*
* @param string $contact_id contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ContactDto
*/
public function getContact($contact_id, string $contentType = self::contentTypes['getContact'][0])
{
list($response) = $this->getContactWithHttpInfo($contact_id, $contentType);
return $response;
}
/**
* Operation getContactWithHttpInfo
*
* Get contact
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ContactDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getContactWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContact'][0])
{
$request = $this->getContactRequest($contact_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ContactDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ContactDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ContactDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ContactDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ContactDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getContactAsync
*
* Get contact
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getContactAsync($contact_id, string $contentType = self::contentTypes['getContact'][0])
{
return $this->getContactAsyncWithHttpInfo($contact_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getContactAsyncWithHttpInfo
*
* Get contact
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getContactAsyncWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContact'][0])
{
$returnType = '\MailSlurp\Models\ContactDto';
$request = $this->getContactRequest($contact_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getContact'
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContact'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getContactRequest($contact_id, string $contentType = self::contentTypes['getContact'][0])
{
// verify the required parameter 'contact_id' is set
if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $contact_id when calling getContact'
);
}
$resourcePath = '/contacts/{contactId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($contact_id !== null) {
$resourcePath = str_replace(
'{' . 'contactId' . '}',
ObjectSerializer::toPathValue($contact_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getContactVCard
*
* Get contact vCard vcf file
*
* @param string $contact_id contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
* @deprecated
*/
public function getContactVCard($contact_id, string $contentType = self::contentTypes['getContactVCard'][0])
{
$this->getContactVCardWithHttpInfo($contact_id, $contentType);
}
/**
* Operation getContactVCardWithHttpInfo
*
* Get contact vCard vcf file
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
* @deprecated
*/
public function getContactVCardWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContactVCard'][0])
{
$request = $this->getContactVCardRequest($contact_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation getContactVCardAsync
*
* Get contact vCard vcf file
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getContactVCardAsync($contact_id, string $contentType = self::contentTypes['getContactVCard'][0])
{
return $this->getContactVCardAsyncWithHttpInfo($contact_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getContactVCardAsyncWithHttpInfo
*
* Get contact vCard vcf file
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @deprecated
*/
public function getContactVCardAsyncWithHttpInfo($contact_id, string $contentType = self::contentTypes['getContactVCard'][0])
{
$returnType = '';
$request = $this->getContactVCardRequest($contact_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getContactVCard'
*
* @param string $contact_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContactVCard'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
* @deprecated
*/
public function getContactVCardRequest($contact_id, string $contentType = self::contentTypes['getContactVCard'][0])
{
// verify the required parameter 'contact_id' is set
if ($contact_id === null || (is_array($contact_id) && count($contact_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $contact_id when calling getContactVCard'
);
}
$resourcePath = '/contacts/{contactId}/download';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($contact_id !== null) {
$resourcePath = str_replace(
'{' . 'contactId' . '}',
ObjectSerializer::toPathValue($contact_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getContacts
*
* Get all contacts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ContactProjection[]
*/
public function getContacts(string $contentType = self::contentTypes['getContacts'][0])
{
list($response) = $this->getContactsWithHttpInfo($contentType);
return $response;
}
/**
* Operation getContactsWithHttpInfo
*
* Get all contacts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ContactProjection[], HTTP status code, HTTP response headers (array of strings)
*/
public function getContactsWithHttpInfo(string $contentType = self::contentTypes['getContacts'][0])
{
$request = $this->getContactsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ContactProjection[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ContactProjection[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ContactProjection[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ContactProjection[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ContactProjection[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getContactsAsync
*
* Get all contacts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getContactsAsync(string $contentType = self::contentTypes['getContacts'][0])
{
return $this->getContactsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getContactsAsyncWithHttpInfo
*
* Get all contacts
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getContactsAsyncWithHttpInfo(string $contentType = self::contentTypes['getContacts'][0])
{
$returnType = '\MailSlurp\Models\ContactProjection[]';
$request = $this->getContactsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getContacts'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getContacts'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getContactsRequest(string $contentType = self::contentTypes['getContacts'][0])
{
$resourcePath = '/contacts';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* ConnectorControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* ConnectorControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class ConnectorControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createConnector' => [
'application/json',
],
'createConnectorImapConnection' => [
'application/json',
],
'createConnectorSmtpConnection' => [
'application/json',
],
'deleteAllConnector' => [
'application/json',
],
'deleteConnector' => [
'application/json',
],
'deleteConnectorImapConnection' => [
'application/json',
],
'deleteConnectorSmtpConnection' => [
'application/json',
],
'getAllConnectorSyncEvents' => [
'application/json',
],
'getConnector' => [
'application/json',
],
'getConnectorSyncEvent' => [
'application/json',
],
'getConnectorSyncEvents' => [
'application/json',
],
'getConnectors' => [
'application/json',
],
'syncConnector' => [
'application/json',
],
'updateConnector' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createConnector
*
* Create an inbox connector
*
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ConnectorDto
*/
public function createConnector($create_connector_options, string $contentType = self::contentTypes['createConnector'][0])
{
list($response) = $this->createConnectorWithHttpInfo($create_connector_options, $contentType);
return $response;
}
/**
* Operation createConnectorWithHttpInfo
*
* Create an inbox connector
*
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ConnectorDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createConnectorWithHttpInfo($create_connector_options, string $contentType = self::contentTypes['createConnector'][0])
{
$request = $this->createConnectorRequest($create_connector_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\ConnectorDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ConnectorDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ConnectorDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ConnectorDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ConnectorDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createConnectorAsync
*
* Create an inbox connector
*
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createConnectorAsync($create_connector_options, string $contentType = self::contentTypes['createConnector'][0])
{
return $this->createConnectorAsyncWithHttpInfo($create_connector_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createConnectorAsyncWithHttpInfo
*
* Create an inbox connector
*
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createConnectorAsyncWithHttpInfo($create_connector_options, string $contentType = self::contentTypes['createConnector'][0])
{
$returnType = '\MailSlurp\Models\ConnectorDto';
$request = $this->createConnectorRequest($create_connector_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createConnector'
*
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createConnectorRequest($create_connector_options, string $contentType = self::contentTypes['createConnector'][0])
{
// verify the required parameter 'create_connector_options' is set
if ($create_connector_options === null || (is_array($create_connector_options) && count($create_connector_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_connector_options when calling createConnector'
);
}
$resourcePath = '/connectors';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_connector_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_connector_options));
} else {
$httpBody = $create_connector_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createConnectorImapConnection
*
* Create an inbox connector IMAP connection
*
* @param string $id id (required)
* @param \MailSlurp\Models\CreateConnectorImapConnectionOptions $create_connector_imap_connection_options create_connector_imap_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorImapConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ConnectorImapConnectionDto
*/
public function createConnectorImapConnection($id, $create_connector_imap_connection_options, string $contentType = self::contentTypes['createConnectorImapConnection'][0])
{
list($response) = $this->createConnectorImapConnectionWithHttpInfo($id, $create_connector_imap_connection_options, $contentType);
return $response;
}
/**
* Operation createConnectorImapConnectionWithHttpInfo
*
* Create an inbox connector IMAP connection
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorImapConnectionOptions $create_connector_imap_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorImapConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ConnectorImapConnectionDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createConnectorImapConnectionWithHttpInfo($id, $create_connector_imap_connection_options, string $contentType = self::contentTypes['createConnectorImapConnection'][0])
{
$request = $this->createConnectorImapConnectionRequest($id, $create_connector_imap_connection_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\ConnectorImapConnectionDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ConnectorImapConnectionDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ConnectorImapConnectionDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ConnectorImapConnectionDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ConnectorImapConnectionDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createConnectorImapConnectionAsync
*
* Create an inbox connector IMAP connection
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorImapConnectionOptions $create_connector_imap_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorImapConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createConnectorImapConnectionAsync($id, $create_connector_imap_connection_options, string $contentType = self::contentTypes['createConnectorImapConnection'][0])
{
return $this->createConnectorImapConnectionAsyncWithHttpInfo($id, $create_connector_imap_connection_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createConnectorImapConnectionAsyncWithHttpInfo
*
* Create an inbox connector IMAP connection
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorImapConnectionOptions $create_connector_imap_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorImapConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createConnectorImapConnectionAsyncWithHttpInfo($id, $create_connector_imap_connection_options, string $contentType = self::contentTypes['createConnectorImapConnection'][0])
{
$returnType = '\MailSlurp\Models\ConnectorImapConnectionDto';
$request = $this->createConnectorImapConnectionRequest($id, $create_connector_imap_connection_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createConnectorImapConnection'
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorImapConnectionOptions $create_connector_imap_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorImapConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createConnectorImapConnectionRequest($id, $create_connector_imap_connection_options, string $contentType = self::contentTypes['createConnectorImapConnection'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling createConnectorImapConnection'
);
}
// verify the required parameter 'create_connector_imap_connection_options' is set
if ($create_connector_imap_connection_options === null || (is_array($create_connector_imap_connection_options) && count($create_connector_imap_connection_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_connector_imap_connection_options when calling createConnectorImapConnection'
);
}
$resourcePath = '/connectors/{id}/imap';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_connector_imap_connection_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_connector_imap_connection_options));
} else {
$httpBody = $create_connector_imap_connection_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createConnectorSmtpConnection
*
* Create an inbox connector SMTP connection
*
* @param string $id id (required)
* @param \MailSlurp\Models\CreateConnectorSmtpConnectionOptions $create_connector_smtp_connection_options create_connector_smtp_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ConnectorSmtpConnectionDto
*/
public function createConnectorSmtpConnection($id, $create_connector_smtp_connection_options, string $contentType = self::contentTypes['createConnectorSmtpConnection'][0])
{
list($response) = $this->createConnectorSmtpConnectionWithHttpInfo($id, $create_connector_smtp_connection_options, $contentType);
return $response;
}
/**
* Operation createConnectorSmtpConnectionWithHttpInfo
*
* Create an inbox connector SMTP connection
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorSmtpConnectionOptions $create_connector_smtp_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ConnectorSmtpConnectionDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createConnectorSmtpConnectionWithHttpInfo($id, $create_connector_smtp_connection_options, string $contentType = self::contentTypes['createConnectorSmtpConnection'][0])
{
$request = $this->createConnectorSmtpConnectionRequest($id, $create_connector_smtp_connection_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\ConnectorSmtpConnectionDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ConnectorSmtpConnectionDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ConnectorSmtpConnectionDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ConnectorSmtpConnectionDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ConnectorSmtpConnectionDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createConnectorSmtpConnectionAsync
*
* Create an inbox connector SMTP connection
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorSmtpConnectionOptions $create_connector_smtp_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createConnectorSmtpConnectionAsync($id, $create_connector_smtp_connection_options, string $contentType = self::contentTypes['createConnectorSmtpConnection'][0])
{
return $this->createConnectorSmtpConnectionAsyncWithHttpInfo($id, $create_connector_smtp_connection_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createConnectorSmtpConnectionAsyncWithHttpInfo
*
* Create an inbox connector SMTP connection
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorSmtpConnectionOptions $create_connector_smtp_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createConnectorSmtpConnectionAsyncWithHttpInfo($id, $create_connector_smtp_connection_options, string $contentType = self::contentTypes['createConnectorSmtpConnection'][0])
{
$returnType = '\MailSlurp\Models\ConnectorSmtpConnectionDto';
$request = $this->createConnectorSmtpConnectionRequest($id, $create_connector_smtp_connection_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createConnectorSmtpConnection'
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorSmtpConnectionOptions $create_connector_smtp_connection_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createConnectorSmtpConnectionRequest($id, $create_connector_smtp_connection_options, string $contentType = self::contentTypes['createConnectorSmtpConnection'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling createConnectorSmtpConnection'
);
}
// verify the required parameter 'create_connector_smtp_connection_options' is set
if ($create_connector_smtp_connection_options === null || (is_array($create_connector_smtp_connection_options) && count($create_connector_smtp_connection_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_connector_smtp_connection_options when calling createConnectorSmtpConnection'
);
}
$resourcePath = '/connectors/{id}/smtp';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_connector_smtp_connection_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_connector_smtp_connection_options));
} else {
$httpBody = $create_connector_smtp_connection_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAllConnector
*
* Delete all inbox connectors
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllConnector(string $contentType = self::contentTypes['deleteAllConnector'][0])
{
$this->deleteAllConnectorWithHttpInfo($contentType);
}
/**
* Operation deleteAllConnectorWithHttpInfo
*
* Delete all inbox connectors
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllConnectorWithHttpInfo(string $contentType = self::contentTypes['deleteAllConnector'][0])
{
$request = $this->deleteAllConnectorRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllConnectorAsync
*
* Delete all inbox connectors
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllConnectorAsync(string $contentType = self::contentTypes['deleteAllConnector'][0])
{
return $this->deleteAllConnectorAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllConnectorAsyncWithHttpInfo
*
* Delete all inbox connectors
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllConnectorAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllConnector'][0])
{
$returnType = '';
$request = $this->deleteAllConnectorRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllConnector'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllConnectorRequest(string $contentType = self::contentTypes['deleteAllConnector'][0])
{
$resourcePath = '/connectors';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteConnector
*
* Delete an inbox connector
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteConnector($id, string $contentType = self::contentTypes['deleteConnector'][0])
{
$this->deleteConnectorWithHttpInfo($id, $contentType);
}
/**
* Operation deleteConnectorWithHttpInfo
*
* Delete an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteConnectorWithHttpInfo($id, string $contentType = self::contentTypes['deleteConnector'][0])
{
$request = $this->deleteConnectorRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteConnectorAsync
*
* Delete an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteConnectorAsync($id, string $contentType = self::contentTypes['deleteConnector'][0])
{
return $this->deleteConnectorAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteConnectorAsyncWithHttpInfo
*
* Delete an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteConnectorAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteConnector'][0])
{
$returnType = '';
$request = $this->deleteConnectorRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteConnector'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteConnectorRequest($id, string $contentType = self::contentTypes['deleteConnector'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteConnector'
);
}
$resourcePath = '/connectors/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteConnectorImapConnection
*
* Delete an inbox connector IMAP connection
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorImapConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteConnectorImapConnection($id, string $contentType = self::contentTypes['deleteConnectorImapConnection'][0])
{
$this->deleteConnectorImapConnectionWithHttpInfo($id, $contentType);
}
/**
* Operation deleteConnectorImapConnectionWithHttpInfo
*
* Delete an inbox connector IMAP connection
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorImapConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteConnectorImapConnectionWithHttpInfo($id, string $contentType = self::contentTypes['deleteConnectorImapConnection'][0])
{
$request = $this->deleteConnectorImapConnectionRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteConnectorImapConnectionAsync
*
* Delete an inbox connector IMAP connection
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorImapConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteConnectorImapConnectionAsync($id, string $contentType = self::contentTypes['deleteConnectorImapConnection'][0])
{
return $this->deleteConnectorImapConnectionAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteConnectorImapConnectionAsyncWithHttpInfo
*
* Delete an inbox connector IMAP connection
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorImapConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteConnectorImapConnectionAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteConnectorImapConnection'][0])
{
$returnType = '';
$request = $this->deleteConnectorImapConnectionRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteConnectorImapConnection'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorImapConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteConnectorImapConnectionRequest($id, string $contentType = self::contentTypes['deleteConnectorImapConnection'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteConnectorImapConnection'
);
}
$resourcePath = '/connectors/{id}/imap';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteConnectorSmtpConnection
*
* Delete an inbox connector SMTP connection
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteConnectorSmtpConnection($id, string $contentType = self::contentTypes['deleteConnectorSmtpConnection'][0])
{
$this->deleteConnectorSmtpConnectionWithHttpInfo($id, $contentType);
}
/**
* Operation deleteConnectorSmtpConnectionWithHttpInfo
*
* Delete an inbox connector SMTP connection
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteConnectorSmtpConnectionWithHttpInfo($id, string $contentType = self::contentTypes['deleteConnectorSmtpConnection'][0])
{
$request = $this->deleteConnectorSmtpConnectionRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteConnectorSmtpConnectionAsync
*
* Delete an inbox connector SMTP connection
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteConnectorSmtpConnectionAsync($id, string $contentType = self::contentTypes['deleteConnectorSmtpConnection'][0])
{
return $this->deleteConnectorSmtpConnectionAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteConnectorSmtpConnectionAsyncWithHttpInfo
*
* Delete an inbox connector SMTP connection
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteConnectorSmtpConnectionAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteConnectorSmtpConnection'][0])
{
$returnType = '';
$request = $this->deleteConnectorSmtpConnectionRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteConnectorSmtpConnection'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteConnectorSmtpConnection'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteConnectorSmtpConnectionRequest($id, string $contentType = self::contentTypes['deleteConnectorSmtpConnection'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling deleteConnectorSmtpConnection'
);
}
$resourcePath = '/connectors/{id}/smtp';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAllConnectorSyncEvents
*
* Get all inbox connector sync events
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageConnectorSyncEvents
*/
public function getAllConnectorSyncEvents($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllConnectorSyncEvents'][0])
{
list($response) = $this->getAllConnectorSyncEventsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getAllConnectorSyncEventsWithHttpInfo
*
* Get all inbox connector sync events
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageConnectorSyncEvents, HTTP status code, HTTP response headers (array of strings)
*/
public function getAllConnectorSyncEventsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllConnectorSyncEvents'][0])
{
$request = $this->getAllConnectorSyncEventsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageConnectorSyncEvents' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageConnectorSyncEvents' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageConnectorSyncEvents', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageConnectorSyncEvents';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageConnectorSyncEvents',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAllConnectorSyncEventsAsync
*
* Get all inbox connector sync events
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllConnectorSyncEventsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllConnectorSyncEvents'][0])
{
return $this->getAllConnectorSyncEventsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAllConnectorSyncEventsAsyncWithHttpInfo
*
* Get all inbox connector sync events
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAllConnectorSyncEventsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllConnectorSyncEvents'][0])
{
$returnType = '\MailSlurp\Models\PageConnectorSyncEvents';
$request = $this->getAllConnectorSyncEventsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAllConnectorSyncEvents'
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAllConnectorSyncEventsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAllConnectorSyncEvents'][0])
{
$resourcePath = '/connectors/events';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getConnector
*
* Get an inbox connector
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ConnectorDto
*/
public function getConnector($id, string $contentType = self::contentTypes['getConnector'][0])
{
list($response) = $this->getConnectorWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getConnectorWithHttpInfo
*
* Get an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ConnectorDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getConnectorWithHttpInfo($id, string $contentType = self::contentTypes['getConnector'][0])
{
$request = $this->getConnectorRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ConnectorDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ConnectorDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ConnectorDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ConnectorDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ConnectorDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getConnectorAsync
*
* Get an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorAsync($id, string $contentType = self::contentTypes['getConnector'][0])
{
return $this->getConnectorAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getConnectorAsyncWithHttpInfo
*
* Get an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getConnector'][0])
{
$returnType = '\MailSlurp\Models\ConnectorDto';
$request = $this->getConnectorRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getConnector'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getConnectorRequest($id, string $contentType = self::contentTypes['getConnector'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getConnector'
);
}
$resourcePath = '/connectors/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getConnectorSyncEvent
*
* Get an inbox connector sync event
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ConnectorSyncEventDto
*/
public function getConnectorSyncEvent($id, string $contentType = self::contentTypes['getConnectorSyncEvent'][0])
{
list($response) = $this->getConnectorSyncEventWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getConnectorSyncEventWithHttpInfo
*
* Get an inbox connector sync event
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvent'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ConnectorSyncEventDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getConnectorSyncEventWithHttpInfo($id, string $contentType = self::contentTypes['getConnectorSyncEvent'][0])
{
$request = $this->getConnectorSyncEventRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ConnectorSyncEventDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ConnectorSyncEventDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ConnectorSyncEventDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ConnectorSyncEventDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ConnectorSyncEventDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getConnectorSyncEventAsync
*
* Get an inbox connector sync event
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorSyncEventAsync($id, string $contentType = self::contentTypes['getConnectorSyncEvent'][0])
{
return $this->getConnectorSyncEventAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getConnectorSyncEventAsyncWithHttpInfo
*
* Get an inbox connector sync event
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorSyncEventAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getConnectorSyncEvent'][0])
{
$returnType = '\MailSlurp\Models\ConnectorSyncEventDto';
$request = $this->getConnectorSyncEventRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getConnectorSyncEvent'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvent'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getConnectorSyncEventRequest($id, string $contentType = self::contentTypes['getConnectorSyncEvent'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getConnectorSyncEvent'
);
}
$resourcePath = '/connectors/events/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getConnectorSyncEvents
*
* Get an inbox connector sync events
*
* @param string $id id (required)
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageConnectorSyncEvents
*/
public function getConnectorSyncEvents($id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectorSyncEvents'][0])
{
list($response) = $this->getConnectorSyncEventsWithHttpInfo($id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getConnectorSyncEventsWithHttpInfo
*
* Get an inbox connector sync events
*
* @param string $id (required)
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageConnectorSyncEvents, HTTP status code, HTTP response headers (array of strings)
*/
public function getConnectorSyncEventsWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectorSyncEvents'][0])
{
$request = $this->getConnectorSyncEventsRequest($id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageConnectorSyncEvents' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageConnectorSyncEvents' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageConnectorSyncEvents', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageConnectorSyncEvents';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageConnectorSyncEvents',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getConnectorSyncEventsAsync
*
* Get an inbox connector sync events
*
* @param string $id (required)
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorSyncEventsAsync($id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectorSyncEvents'][0])
{
return $this->getConnectorSyncEventsAsyncWithHttpInfo($id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getConnectorSyncEventsAsyncWithHttpInfo
*
* Get an inbox connector sync events
*
* @param string $id (required)
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorSyncEventsAsyncWithHttpInfo($id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectorSyncEvents'][0])
{
$returnType = '\MailSlurp\Models\PageConnectorSyncEvents';
$request = $this->getConnectorSyncEventsRequest($id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getConnectorSyncEvents'
*
* @param string $id (required)
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectorSyncEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getConnectorSyncEventsRequest($id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectorSyncEvents'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getConnectorSyncEvents'
);
}
$resourcePath = '/connectors/{id}/events';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getConnectors
*
* Get inbox connectors
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectors'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageConnector
*/
public function getConnectors($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectors'][0])
{
list($response) = $this->getConnectorsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getConnectorsWithHttpInfo
*
* Get inbox connectors
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectors'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageConnector, HTTP status code, HTTP response headers (array of strings)
*/
public function getConnectorsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectors'][0])
{
$request = $this->getConnectorsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageConnector' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageConnector' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageConnector', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageConnector';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageConnector',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getConnectorsAsync
*
* Get inbox connectors
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectors'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectors'][0])
{
return $this->getConnectorsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getConnectorsAsyncWithHttpInfo
*
* Get inbox connectors
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectors'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getConnectorsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectors'][0])
{
$returnType = '\MailSlurp\Models\PageConnector';
$request = $this->getConnectorsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getConnectors'
*
* @param int $page Optional page index in connector list pagination (optional, default to 0)
* @param int $size Optional page size in connector list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConnectors'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getConnectorsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getConnectors'][0])
{
$resourcePath = '/connectors';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation syncConnector
*
* Sync an inbox connector
*
* @param string $id id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['syncConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ConnectorSyncRequestResult
*/
public function syncConnector($id, string $contentType = self::contentTypes['syncConnector'][0])
{
list($response) = $this->syncConnectorWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation syncConnectorWithHttpInfo
*
* Sync an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['syncConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ConnectorSyncRequestResult, HTTP status code, HTTP response headers (array of strings)
*/
public function syncConnectorWithHttpInfo($id, string $contentType = self::contentTypes['syncConnector'][0])
{
$request = $this->syncConnectorRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ConnectorSyncRequestResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ConnectorSyncRequestResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ConnectorSyncRequestResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ConnectorSyncRequestResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ConnectorSyncRequestResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation syncConnectorAsync
*
* Sync an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['syncConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function syncConnectorAsync($id, string $contentType = self::contentTypes['syncConnector'][0])
{
return $this->syncConnectorAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation syncConnectorAsyncWithHttpInfo
*
* Sync an inbox connector
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['syncConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function syncConnectorAsyncWithHttpInfo($id, string $contentType = self::contentTypes['syncConnector'][0])
{
$returnType = '\MailSlurp\Models\ConnectorSyncRequestResult';
$request = $this->syncConnectorRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'syncConnector'
*
* @param string $id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['syncConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function syncConnectorRequest($id, string $contentType = self::contentTypes['syncConnector'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling syncConnector'
);
}
$resourcePath = '/connectors/{id}/sync';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateConnector
*
* Update an inbox connector
*
* @param string $id id (required)
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ConnectorDto
*/
public function updateConnector($id, $create_connector_options, string $contentType = self::contentTypes['updateConnector'][0])
{
list($response) = $this->updateConnectorWithHttpInfo($id, $create_connector_options, $contentType);
return $response;
}
/**
* Operation updateConnectorWithHttpInfo
*
* Update an inbox connector
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConnector'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ConnectorDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateConnectorWithHttpInfo($id, $create_connector_options, string $contentType = self::contentTypes['updateConnector'][0])
{
$request = $this->updateConnectorRequest($id, $create_connector_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ConnectorDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ConnectorDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ConnectorDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ConnectorDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ConnectorDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateConnectorAsync
*
* Update an inbox connector
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateConnectorAsync($id, $create_connector_options, string $contentType = self::contentTypes['updateConnector'][0])
{
return $this->updateConnectorAsyncWithHttpInfo($id, $create_connector_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateConnectorAsyncWithHttpInfo
*
* Update an inbox connector
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateConnectorAsyncWithHttpInfo($id, $create_connector_options, string $contentType = self::contentTypes['updateConnector'][0])
{
$returnType = '\MailSlurp\Models\ConnectorDto';
$request = $this->updateConnectorRequest($id, $create_connector_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateConnector'
*
* @param string $id (required)
* @param \MailSlurp\Models\CreateConnectorOptions $create_connector_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConnector'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateConnectorRequest($id, $create_connector_options, string $contentType = self::contentTypes['updateConnector'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling updateConnector'
);
}
// verify the required parameter 'create_connector_options' is set
if ($create_connector_options === null || (is_array($create_connector_options) && count($create_connector_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_connector_options when calling updateConnector'
);
}
$resourcePath = '/connectors/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_connector_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_connector_options));
} else {
$httpBody = $create_connector_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* CommonActionsControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* CommonActionsControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class CommonActionsControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createNewEmailAddress' => [
'application/json',
],
'createRandomInbox' => [
'application/json',
],
'deleteEmailAddress' => [
'application/json',
],
'emptyInbox' => [
'application/json',
],
'sendEmailQuery' => [
'application/json',
],
'sendEmailSimple' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createNewEmailAddress
*
* Create new random inbox
*
* @param bool $allow_team_access allow_team_access (optional)
* @param bool $use_domain_pool use_domain_pool (optional)
* @param \DateTime $expires_at expires_at (optional)
* @param int $expires_in expires_in (optional)
* @param string $email_address email_address (optional)
* @param string $inbox_type inbox_type (optional)
* @param string $description description (optional)
* @param string $name name (optional)
* @param string[] $tags tags (optional)
* @param bool $favourite favourite (optional)
* @param bool $virtual_inbox virtual_inbox (optional)
* @param bool $use_short_address use_short_address (optional)
* @param string $domain_name domain_name (optional)
* @param string $domain_id domain_id (optional)
* @param string $prefix prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function createNewEmailAddress($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createNewEmailAddress'][0])
{
list($response) = $this->createNewEmailAddressWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType);
return $response;
}
/**
* Operation createNewEmailAddressWithHttpInfo
*
* Create new random inbox
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createNewEmailAddressWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createNewEmailAddress'][0])
{
$request = $this->createNewEmailAddressRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createNewEmailAddressAsync
*
* Create new random inbox
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewEmailAddressAsync($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createNewEmailAddress'][0])
{
return $this->createNewEmailAddressAsyncWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createNewEmailAddressAsyncWithHttpInfo
*
* Create new random inbox
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createNewEmailAddressAsyncWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createNewEmailAddress'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->createNewEmailAddressRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createNewEmailAddress'
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createNewEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createNewEmailAddressRequest($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createNewEmailAddress'][0])
{
$resourcePath = '/newEmailAddress';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$allow_team_access,
'allowTeamAccess', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$use_domain_pool,
'useDomainPool', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$expires_at,
'expiresAt', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$expires_in,
'expiresIn', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_type,
'inboxType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$description,
'description', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$name,
'name', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$tags,
'tags', // param base name
'array', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$favourite,
'favourite', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$virtual_inbox,
'virtualInbox', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$use_short_address,
'useShortAddress', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_name,
'domainName', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_id,
'domainId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$prefix,
'prefix', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation createRandomInbox
*
* Create new random inbox
*
* @param bool $allow_team_access allow_team_access (optional)
* @param bool $use_domain_pool use_domain_pool (optional)
* @param \DateTime $expires_at expires_at (optional)
* @param int $expires_in expires_in (optional)
* @param string $email_address email_address (optional)
* @param string $inbox_type inbox_type (optional)
* @param string $description description (optional)
* @param string $name name (optional)
* @param string[] $tags tags (optional)
* @param bool $favourite favourite (optional)
* @param bool $virtual_inbox virtual_inbox (optional)
* @param bool $use_short_address use_short_address (optional)
* @param string $domain_name domain_name (optional)
* @param string $domain_id domain_id (optional)
* @param string $prefix prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto
*/
public function createRandomInbox($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createRandomInbox'][0])
{
list($response) = $this->createRandomInboxWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType);
return $response;
}
/**
* Operation createRandomInboxWithHttpInfo
*
* Create new random inbox
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createRandomInboxWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createRandomInbox'][0])
{
$request = $this->createRandomInboxRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\InboxDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createRandomInboxAsync
*
* Create new random inbox
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createRandomInboxAsync($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createRandomInbox'][0])
{
return $this->createRandomInboxAsyncWithHttpInfo($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createRandomInboxAsyncWithHttpInfo
*
* Create new random inbox
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createRandomInboxAsyncWithHttpInfo($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createRandomInbox'][0])
{
$returnType = '\MailSlurp\Models\InboxDto';
$request = $this->createRandomInboxRequest($allow_team_access, $use_domain_pool, $expires_at, $expires_in, $email_address, $inbox_type, $description, $name, $tags, $favourite, $virtual_inbox, $use_short_address, $domain_name, $domain_id, $prefix, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createRandomInbox'
*
* @param bool $allow_team_access (optional)
* @param bool $use_domain_pool (optional)
* @param \DateTime $expires_at (optional)
* @param int $expires_in (optional)
* @param string $email_address (optional)
* @param string $inbox_type (optional)
* @param string $description (optional)
* @param string $name (optional)
* @param string[] $tags (optional)
* @param bool $favourite (optional)
* @param bool $virtual_inbox (optional)
* @param bool $use_short_address (optional)
* @param string $domain_name (optional)
* @param string $domain_id (optional)
* @param string $prefix (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createRandomInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createRandomInboxRequest($allow_team_access = null, $use_domain_pool = null, $expires_at = null, $expires_in = null, $email_address = null, $inbox_type = null, $description = null, $name = null, $tags = null, $favourite = null, $virtual_inbox = null, $use_short_address = null, $domain_name = null, $domain_id = null, $prefix = null, string $contentType = self::contentTypes['createRandomInbox'][0])
{
$resourcePath = '/createInbox';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$allow_team_access,
'allowTeamAccess', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$use_domain_pool,
'useDomainPool', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$expires_at,
'expiresAt', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$expires_in,
'expiresIn', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$email_address,
'emailAddress', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_type,
'inboxType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$description,
'description', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$name,
'name', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$tags,
'tags', // param base name
'array', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$favourite,
'favourite', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$virtual_inbox,
'virtualInbox', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$use_short_address,
'useShortAddress', // param base name
'boolean', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_name,
'domainName', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_id,
'domainId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$prefix,
'prefix', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteEmailAddress
*
* Delete inbox email address by inbox id
*
* @param string $inbox_id inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteEmailAddress($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0])
{
$this->deleteEmailAddressWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation deleteEmailAddressWithHttpInfo
*
* Delete inbox email address by inbox id
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteEmailAddressWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0])
{
$request = $this->deleteEmailAddressRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteEmailAddressAsync
*
* Delete inbox email address by inbox id
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteEmailAddressAsync($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0])
{
return $this->deleteEmailAddressAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteEmailAddressAsyncWithHttpInfo
*
* Delete inbox email address by inbox id
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteEmailAddressAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0])
{
$returnType = '';
$request = $this->deleteEmailAddressRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteEmailAddress'
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEmailAddress'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteEmailAddressRequest($inbox_id, string $contentType = self::contentTypes['deleteEmailAddress'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling deleteEmailAddress'
);
}
$resourcePath = '/deleteEmailAddress';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation emptyInbox
*
* Delete all emails in an inbox
*
* @param string $inbox_id inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function emptyInbox($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0])
{
$this->emptyInboxWithHttpInfo($inbox_id, $contentType);
}
/**
* Operation emptyInboxWithHttpInfo
*
* Delete all emails in an inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function emptyInboxWithHttpInfo($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0])
{
$request = $this->emptyInboxRequest($inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation emptyInboxAsync
*
* Delete all emails in an inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function emptyInboxAsync($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0])
{
return $this->emptyInboxAsyncWithHttpInfo($inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation emptyInboxAsyncWithHttpInfo
*
* Delete all emails in an inbox
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function emptyInboxAsyncWithHttpInfo($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0])
{
$returnType = '';
$request = $this->emptyInboxRequest($inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'emptyInbox'
*
* @param string $inbox_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['emptyInbox'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function emptyInboxRequest($inbox_id, string $contentType = self::contentTypes['emptyInbox'][0])
{
// verify the required parameter 'inbox_id' is set
if ($inbox_id === null || (is_array($inbox_id) && count($inbox_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $inbox_id when calling emptyInbox'
);
}
$resourcePath = '/emptyInbox';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendEmailQuery
*
* Send an email using query parameters
*
* @param string $to Email address to send to (required)
* @param string $sender_id ID of inbox to send from. If null an inbox will be created for sending (optional)
* @param string $body Body of the email message. Supports HTML (optional)
* @param string $subject Subject line of the email (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailQuery'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function sendEmailQuery($to, $sender_id = null, $body = null, $subject = null, string $contentType = self::contentTypes['sendEmailQuery'][0])
{
$this->sendEmailQueryWithHttpInfo($to, $sender_id, $body, $subject, $contentType);
}
/**
* Operation sendEmailQueryWithHttpInfo
*
* Send an email using query parameters
*
* @param string $to Email address to send to (required)
* @param string $sender_id ID of inbox to send from. If null an inbox will be created for sending (optional)
* @param string $body Body of the email message. Supports HTML (optional)
* @param string $subject Subject line of the email (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailQuery'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function sendEmailQueryWithHttpInfo($to, $sender_id = null, $body = null, $subject = null, string $contentType = self::contentTypes['sendEmailQuery'][0])
{
$request = $this->sendEmailQueryRequest($to, $sender_id, $body, $subject, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation sendEmailQueryAsync
*
* Send an email using query parameters
*
* @param string $to Email address to send to (required)
* @param string $sender_id ID of inbox to send from. If null an inbox will be created for sending (optional)
* @param string $body Body of the email message. Supports HTML (optional)
* @param string $subject Subject line of the email (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailQuery'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailQueryAsync($to, $sender_id = null, $body = null, $subject = null, string $contentType = self::contentTypes['sendEmailQuery'][0])
{
return $this->sendEmailQueryAsyncWithHttpInfo($to, $sender_id, $body, $subject, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendEmailQueryAsyncWithHttpInfo
*
* Send an email using query parameters
*
* @param string $to Email address to send to (required)
* @param string $sender_id ID of inbox to send from. If null an inbox will be created for sending (optional)
* @param string $body Body of the email message. Supports HTML (optional)
* @param string $subject Subject line of the email (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailQuery'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailQueryAsyncWithHttpInfo($to, $sender_id = null, $body = null, $subject = null, string $contentType = self::contentTypes['sendEmailQuery'][0])
{
$returnType = '';
$request = $this->sendEmailQueryRequest($to, $sender_id, $body, $subject, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendEmailQuery'
*
* @param string $to Email address to send to (required)
* @param string $sender_id ID of inbox to send from. If null an inbox will be created for sending (optional)
* @param string $body Body of the email message. Supports HTML (optional)
* @param string $subject Subject line of the email (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailQuery'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendEmailQueryRequest($to, $sender_id = null, $body = null, $subject = null, string $contentType = self::contentTypes['sendEmailQuery'][0])
{
// verify the required parameter 'to' is set
if ($to === null || (is_array($to) && count($to) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $to when calling sendEmailQuery'
);
}
$resourcePath = '/sendEmailQuery';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sender_id,
'senderId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$to,
'to', // param base name
'string', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$body,
'body', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$subject,
'subject', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendEmailSimple
*
* Send an email
*
* @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options simple_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function sendEmailSimple($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0])
{
$this->sendEmailSimpleWithHttpInfo($simple_send_email_options, $contentType);
}
/**
* Operation sendEmailSimpleWithHttpInfo
*
* Send an email
*
* @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function sendEmailSimpleWithHttpInfo($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0])
{
$request = $this->sendEmailSimpleRequest($simple_send_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation sendEmailSimpleAsync
*
* Send an email
*
* @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailSimpleAsync($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0])
{
return $this->sendEmailSimpleAsyncWithHttpInfo($simple_send_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendEmailSimpleAsyncWithHttpInfo
*
* Send an email
*
* @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendEmailSimpleAsyncWithHttpInfo($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0])
{
$returnType = '';
$request = $this->sendEmailSimpleRequest($simple_send_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendEmailSimple'
*
* @param \MailSlurp\Models\SimpleSendEmailOptions $simple_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmailSimple'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendEmailSimpleRequest($simple_send_email_options, string $contentType = self::contentTypes['sendEmailSimple'][0])
{
// verify the required parameter 'simple_send_email_options' is set
if ($simple_send_email_options === null || (is_array($simple_send_email_options) && count($simple_send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $simple_send_email_options when calling sendEmailSimple'
);
}
$resourcePath = '/sendEmail';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($simple_send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_send_email_options));
} else {
$httpBody = $simple_send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* BulkActionsControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* BulkActionsControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class BulkActionsControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'bulkCreateInboxes' => [
'application/json',
],
'bulkDeleteInboxes' => [
'application/json',
],
'bulkSendEmails' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation bulkCreateInboxes
*
* Bulk create Inboxes (email addresses)
*
* @param int $count Number of inboxes to be created in bulk (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\InboxDto[]
*/
public function bulkCreateInboxes($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0])
{
list($response) = $this->bulkCreateInboxesWithHttpInfo($count, $contentType);
return $response;
}
/**
* Operation bulkCreateInboxesWithHttpInfo
*
* Bulk create Inboxes (email addresses)
*
* @param int $count Number of inboxes to be created in bulk (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\InboxDto[], HTTP status code, HTTP response headers (array of strings)
*/
public function bulkCreateInboxesWithHttpInfo($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0])
{
$request = $this->bulkCreateInboxesRequest($count, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\InboxDto[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\InboxDto[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\InboxDto[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\InboxDto[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\InboxDto[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation bulkCreateInboxesAsync
*
* Bulk create Inboxes (email addresses)
*
* @param int $count Number of inboxes to be created in bulk (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function bulkCreateInboxesAsync($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0])
{
return $this->bulkCreateInboxesAsyncWithHttpInfo($count, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation bulkCreateInboxesAsyncWithHttpInfo
*
* Bulk create Inboxes (email addresses)
*
* @param int $count Number of inboxes to be created in bulk (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function bulkCreateInboxesAsyncWithHttpInfo($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0])
{
$returnType = '\MailSlurp\Models\InboxDto[]';
$request = $this->bulkCreateInboxesRequest($count, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'bulkCreateInboxes'
*
* @param int $count Number of inboxes to be created in bulk (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkCreateInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function bulkCreateInboxesRequest($count, string $contentType = self::contentTypes['bulkCreateInboxes'][0])
{
// verify the required parameter 'count' is set
if ($count === null || (is_array($count) && count($count) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $count when calling bulkCreateInboxes'
);
}
$resourcePath = '/bulk/inboxes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$count,
'count', // param base name
'integer', // openApiType
'form', // style
true, // explode
true // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation bulkDeleteInboxes
*
* Bulk Delete Inboxes
*
* @param string[] $request_body request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function bulkDeleteInboxes($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0])
{
$this->bulkDeleteInboxesWithHttpInfo($request_body, $contentType);
}
/**
* Operation bulkDeleteInboxesWithHttpInfo
*
* Bulk Delete Inboxes
*
* @param string[] $request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function bulkDeleteInboxesWithHttpInfo($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0])
{
$request = $this->bulkDeleteInboxesRequest($request_body, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation bulkDeleteInboxesAsync
*
* Bulk Delete Inboxes
*
* @param string[] $request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function bulkDeleteInboxesAsync($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0])
{
return $this->bulkDeleteInboxesAsyncWithHttpInfo($request_body, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation bulkDeleteInboxesAsyncWithHttpInfo
*
* Bulk Delete Inboxes
*
* @param string[] $request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function bulkDeleteInboxesAsyncWithHttpInfo($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0])
{
$returnType = '';
$request = $this->bulkDeleteInboxesRequest($request_body, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'bulkDeleteInboxes'
*
* @param string[] $request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkDeleteInboxes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function bulkDeleteInboxesRequest($request_body, string $contentType = self::contentTypes['bulkDeleteInboxes'][0])
{
// verify the required parameter 'request_body' is set
if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $request_body when calling bulkDeleteInboxes'
);
}
$resourcePath = '/bulk/inboxes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($request_body)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($request_body));
} else {
$httpBody = $request_body;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation bulkSendEmails
*
* Bulk Send Emails
*
* @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options bulk_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function bulkSendEmails($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0])
{
$this->bulkSendEmailsWithHttpInfo($bulk_send_email_options, $contentType);
}
/**
* Operation bulkSendEmailsWithHttpInfo
*
* Bulk Send Emails
*
* @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function bulkSendEmailsWithHttpInfo($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0])
{
$request = $this->bulkSendEmailsRequest($bulk_send_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation bulkSendEmailsAsync
*
* Bulk Send Emails
*
* @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function bulkSendEmailsAsync($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0])
{
return $this->bulkSendEmailsAsyncWithHttpInfo($bulk_send_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation bulkSendEmailsAsyncWithHttpInfo
*
* Bulk Send Emails
*
* @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function bulkSendEmailsAsyncWithHttpInfo($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0])
{
$returnType = '';
$request = $this->bulkSendEmailsRequest($bulk_send_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'bulkSendEmails'
*
* @param \MailSlurp\Models\BulkSendEmailOptions $bulk_send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function bulkSendEmailsRequest($bulk_send_email_options, string $contentType = self::contentTypes['bulkSendEmails'][0])
{
// verify the required parameter 'bulk_send_email_options' is set
if ($bulk_send_email_options === null || (is_array($bulk_send_email_options) && count($bulk_send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $bulk_send_email_options when calling bulkSendEmails'
);
}
$resourcePath = '/bulk/send';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($bulk_send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($bulk_send_email_options));
} else {
$httpBody = $bulk_send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* BounceControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* BounceControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class BounceControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'filterBouncedRecipient' => [
'application/json',
],
'getAccountBounceBlockStatus' => [
'application/json',
],
'getBouncedEmail' => [
'application/json',
],
'getBouncedEmails' => [
'application/json',
],
'getBouncedRecipient' => [
'application/json',
],
'getBouncedRecipients' => [
'application/json',
],
'getComplaint' => [
'application/json',
],
'getComplaints' => [
'application/json',
],
'getListUnsubscribeRecipients' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation filterBouncedRecipient
*
* Filter a list of email recipients and remove those who have bounced
*
* @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options filter_bounced_recipients_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\FilterBouncedRecipientsResult
*/
public function filterBouncedRecipient($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0])
{
list($response) = $this->filterBouncedRecipientWithHttpInfo($filter_bounced_recipients_options, $contentType);
return $response;
}
/**
* Operation filterBouncedRecipientWithHttpInfo
*
* Filter a list of email recipients and remove those who have bounced
*
* @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\FilterBouncedRecipientsResult, HTTP status code, HTTP response headers (array of strings)
*/
public function filterBouncedRecipientWithHttpInfo($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0])
{
$request = $this->filterBouncedRecipientRequest($filter_bounced_recipients_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\FilterBouncedRecipientsResult' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\FilterBouncedRecipientsResult' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\FilterBouncedRecipientsResult', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\FilterBouncedRecipientsResult';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\FilterBouncedRecipientsResult',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation filterBouncedRecipientAsync
*
* Filter a list of email recipients and remove those who have bounced
*
* @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function filterBouncedRecipientAsync($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0])
{
return $this->filterBouncedRecipientAsyncWithHttpInfo($filter_bounced_recipients_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation filterBouncedRecipientAsyncWithHttpInfo
*
* Filter a list of email recipients and remove those who have bounced
*
* @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function filterBouncedRecipientAsyncWithHttpInfo($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0])
{
$returnType = '\MailSlurp\Models\FilterBouncedRecipientsResult';
$request = $this->filterBouncedRecipientRequest($filter_bounced_recipients_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'filterBouncedRecipient'
*
* @param \MailSlurp\Models\FilterBouncedRecipientsOptions $filter_bounced_recipients_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['filterBouncedRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function filterBouncedRecipientRequest($filter_bounced_recipients_options, string $contentType = self::contentTypes['filterBouncedRecipient'][0])
{
// verify the required parameter 'filter_bounced_recipients_options' is set
if ($filter_bounced_recipients_options === null || (is_array($filter_bounced_recipients_options) && count($filter_bounced_recipients_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $filter_bounced_recipients_options when calling filterBouncedRecipient'
);
}
$resourcePath = '/bounce/filter-recipients';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($filter_bounced_recipients_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($filter_bounced_recipients_options));
} else {
$httpBody = $filter_bounced_recipients_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAccountBounceBlockStatus
*
* Can account send email
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountBounceBlockStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AccountBounceBlockDto
*/
public function getAccountBounceBlockStatus(string $contentType = self::contentTypes['getAccountBounceBlockStatus'][0])
{
list($response) = $this->getAccountBounceBlockStatusWithHttpInfo($contentType);
return $response;
}
/**
* Operation getAccountBounceBlockStatusWithHttpInfo
*
* Can account send email
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountBounceBlockStatus'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AccountBounceBlockDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getAccountBounceBlockStatusWithHttpInfo(string $contentType = self::contentTypes['getAccountBounceBlockStatus'][0])
{
$request = $this->getAccountBounceBlockStatusRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\AccountBounceBlockDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AccountBounceBlockDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AccountBounceBlockDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AccountBounceBlockDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AccountBounceBlockDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAccountBounceBlockStatusAsync
*
* Can account send email
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountBounceBlockStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAccountBounceBlockStatusAsync(string $contentType = self::contentTypes['getAccountBounceBlockStatus'][0])
{
return $this->getAccountBounceBlockStatusAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAccountBounceBlockStatusAsyncWithHttpInfo
*
* Can account send email
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountBounceBlockStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAccountBounceBlockStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['getAccountBounceBlockStatus'][0])
{
$returnType = '\MailSlurp\Models\AccountBounceBlockDto';
$request = $this->getAccountBounceBlockStatusRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAccountBounceBlockStatus'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountBounceBlockStatus'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAccountBounceBlockStatusRequest(string $contentType = self::contentTypes['getAccountBounceBlockStatus'][0])
{
$resourcePath = '/bounce/account-block';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getBouncedEmail
*
* Get a bounced email.
*
* @param string $id ID of the bounced email to fetch (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\BouncedEmailDto
*/
public function getBouncedEmail($id, string $contentType = self::contentTypes['getBouncedEmail'][0])
{
list($response) = $this->getBouncedEmailWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getBouncedEmailWithHttpInfo
*
* Get a bounced email.
*
* @param string $id ID of the bounced email to fetch (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\BouncedEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getBouncedEmailWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedEmail'][0])
{
$request = $this->getBouncedEmailRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\BouncedEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\BouncedEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\BouncedEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\BouncedEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\BouncedEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getBouncedEmailAsync
*
* Get a bounced email.
*
* @param string $id ID of the bounced email to fetch (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedEmailAsync($id, string $contentType = self::contentTypes['getBouncedEmail'][0])
{
return $this->getBouncedEmailAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getBouncedEmailAsyncWithHttpInfo
*
* Get a bounced email.
*
* @param string $id ID of the bounced email to fetch (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedEmailAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedEmail'][0])
{
$returnType = '\MailSlurp\Models\BouncedEmailDto';
$request = $this->getBouncedEmailRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getBouncedEmail'
*
* @param string $id ID of the bounced email to fetch (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getBouncedEmailRequest($id, string $contentType = self::contentTypes['getBouncedEmail'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getBouncedEmail'
);
}
$resourcePath = '/bounce/emails/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getBouncedEmails
*
* Get paginated list of bounced emails.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageBouncedEmail
*/
public function getBouncedEmails($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0])
{
list($response) = $this->getBouncedEmailsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getBouncedEmailsWithHttpInfo
*
* Get paginated list of bounced emails.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageBouncedEmail, HTTP status code, HTTP response headers (array of strings)
*/
public function getBouncedEmailsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0])
{
$request = $this->getBouncedEmailsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageBouncedEmail' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageBouncedEmail' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageBouncedEmail', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageBouncedEmail';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageBouncedEmail',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getBouncedEmailsAsync
*
* Get paginated list of bounced emails.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedEmailsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0])
{
return $this->getBouncedEmailsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getBouncedEmailsAsyncWithHttpInfo
*
* Get paginated list of bounced emails.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedEmailsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0])
{
$returnType = '\MailSlurp\Models\PageBouncedEmail';
$request = $this->getBouncedEmailsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getBouncedEmails'
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getBouncedEmailsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedEmails'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getBouncedEmails, must be smaller than or equal to 100.');
}
$resourcePath = '/bounce/emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getBouncedRecipient
*
* Get a bounced email.
*
* @param string $id ID of the bounced recipient (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\BouncedRecipientDto
*/
public function getBouncedRecipient($id, string $contentType = self::contentTypes['getBouncedRecipient'][0])
{
list($response) = $this->getBouncedRecipientWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getBouncedRecipientWithHttpInfo
*
* Get a bounced email.
*
* @param string $id ID of the bounced recipient (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\BouncedRecipientDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getBouncedRecipientWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedRecipient'][0])
{
$request = $this->getBouncedRecipientRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\BouncedRecipientDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\BouncedRecipientDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\BouncedRecipientDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\BouncedRecipientDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\BouncedRecipientDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getBouncedRecipientAsync
*
* Get a bounced email.
*
* @param string $id ID of the bounced recipient (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedRecipientAsync($id, string $contentType = self::contentTypes['getBouncedRecipient'][0])
{
return $this->getBouncedRecipientAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getBouncedRecipientAsyncWithHttpInfo
*
* Get a bounced email.
*
* @param string $id ID of the bounced recipient (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedRecipientAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getBouncedRecipient'][0])
{
$returnType = '\MailSlurp\Models\BouncedRecipientDto';
$request = $this->getBouncedRecipientRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getBouncedRecipient'
*
* @param string $id ID of the bounced recipient (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipient'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getBouncedRecipientRequest($id, string $contentType = self::contentTypes['getBouncedRecipient'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getBouncedRecipient'
);
}
$resourcePath = '/bounce/recipients/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getBouncedRecipients
*
* Get paginated list of bounced recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageBouncedRecipients
*/
public function getBouncedRecipients($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0])
{
list($response) = $this->getBouncedRecipientsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getBouncedRecipientsWithHttpInfo
*
* Get paginated list of bounced recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageBouncedRecipients, HTTP status code, HTTP response headers (array of strings)
*/
public function getBouncedRecipientsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0])
{
$request = $this->getBouncedRecipientsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageBouncedRecipients' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageBouncedRecipients' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageBouncedRecipients', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageBouncedRecipients';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageBouncedRecipients',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getBouncedRecipientsAsync
*
* Get paginated list of bounced recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedRecipientsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0])
{
return $this->getBouncedRecipientsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getBouncedRecipientsAsyncWithHttpInfo
*
* Get paginated list of bounced recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBouncedRecipientsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0])
{
$returnType = '\MailSlurp\Models\PageBouncedRecipients';
$request = $this->getBouncedRecipientsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getBouncedRecipients'
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBouncedRecipients'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getBouncedRecipientsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getBouncedRecipients'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getBouncedRecipients, must be smaller than or equal to 100.');
}
$resourcePath = '/bounce/recipients';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getComplaint
*
* Get complaint
*
* @param string $id ID of the complaint (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaint'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\Complaint
*/
public function getComplaint($id, string $contentType = self::contentTypes['getComplaint'][0])
{
list($response) = $this->getComplaintWithHttpInfo($id, $contentType);
return $response;
}
/**
* Operation getComplaintWithHttpInfo
*
* Get complaint
*
* @param string $id ID of the complaint (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaint'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\Complaint, HTTP status code, HTTP response headers (array of strings)
*/
public function getComplaintWithHttpInfo($id, string $contentType = self::contentTypes['getComplaint'][0])
{
$request = $this->getComplaintRequest($id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\Complaint' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\Complaint' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\Complaint', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\Complaint';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\Complaint',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getComplaintAsync
*
* Get complaint
*
* @param string $id ID of the complaint (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaint'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getComplaintAsync($id, string $contentType = self::contentTypes['getComplaint'][0])
{
return $this->getComplaintAsyncWithHttpInfo($id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getComplaintAsyncWithHttpInfo
*
* Get complaint
*
* @param string $id ID of the complaint (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaint'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getComplaintAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getComplaint'][0])
{
$returnType = '\MailSlurp\Models\Complaint';
$request = $this->getComplaintRequest($id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getComplaint'
*
* @param string $id ID of the complaint (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaint'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getComplaintRequest($id, string $contentType = self::contentTypes['getComplaint'][0])
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $id when calling getComplaint'
);
}
$resourcePath = '/bounce/complaints/{id}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($id !== null) {
$resourcePath = str_replace(
'{' . 'id' . '}',
ObjectSerializer::toPathValue($id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getComplaints
*
* Get paginated list of complaints.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageComplaint
*/
public function getComplaints($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0])
{
list($response) = $this->getComplaintsWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getComplaintsWithHttpInfo
*
* Get paginated list of complaints.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageComplaint, HTTP status code, HTTP response headers (array of strings)
*/
public function getComplaintsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0])
{
$request = $this->getComplaintsRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageComplaint' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageComplaint' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageComplaint', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageComplaint';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageComplaint',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getComplaintsAsync
*
* Get paginated list of complaints.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getComplaintsAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0])
{
return $this->getComplaintsAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getComplaintsAsyncWithHttpInfo
*
* Get paginated list of complaints.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getComplaintsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0])
{
$returnType = '\MailSlurp\Models\PageComplaint';
$request = $this->getComplaintsRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getComplaints'
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getComplaints'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getComplaintsRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getComplaints'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getComplaints, must be smaller than or equal to 100.');
}
$resourcePath = '/bounce/complaints';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getListUnsubscribeRecipients
*
* Get paginated list of unsubscribed recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $domain_id Filter by domainId (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageListUnsubscribeRecipients
*/
public function getListUnsubscribeRecipients($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0])
{
list($response) = $this->getListUnsubscribeRecipientsWithHttpInfo($page, $size, $sort, $domain_id, $contentType);
return $response;
}
/**
* Operation getListUnsubscribeRecipientsWithHttpInfo
*
* Get paginated list of unsubscribed recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $domain_id Filter by domainId (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageListUnsubscribeRecipients, HTTP status code, HTTP response headers (array of strings)
*/
public function getListUnsubscribeRecipientsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0])
{
$request = $this->getListUnsubscribeRecipientsRequest($page, $size, $sort, $domain_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageListUnsubscribeRecipients' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageListUnsubscribeRecipients' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageListUnsubscribeRecipients', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageListUnsubscribeRecipients';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageListUnsubscribeRecipients',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getListUnsubscribeRecipientsAsync
*
* Get paginated list of unsubscribed recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $domain_id Filter by domainId (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getListUnsubscribeRecipientsAsync($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0])
{
return $this->getListUnsubscribeRecipientsAsyncWithHttpInfo($page, $size, $sort, $domain_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getListUnsubscribeRecipientsAsyncWithHttpInfo
*
* Get paginated list of unsubscribed recipients.
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $domain_id Filter by domainId (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getListUnsubscribeRecipientsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0])
{
$returnType = '\MailSlurp\Models\PageListUnsubscribeRecipients';
$request = $this->getListUnsubscribeRecipientsRequest($page, $size, $sort, $domain_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getListUnsubscribeRecipients'
*
* @param int $page Optional page index (optional, default to 0)
* @param int $size Optional page size (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $domain_id Filter by domainId (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getListUnsubscribeRecipients'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getListUnsubscribeRecipientsRequest($page = 0, $size = 20, $sort = 'ASC', $domain_id = null, string $contentType = self::contentTypes['getListUnsubscribeRecipients'][0])
{
if ($size !== null && $size > 100) {
throw new \InvalidArgumentException('invalid value for "$size" when calling BounceControllerApi.getListUnsubscribeRecipients, must be smaller than or equal to 100.');
}
$resourcePath = '/bounce/list-unsubscribe-recipients';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$domain_id,
'domainId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* AttachmentControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* AttachmentControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class AttachmentControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'deleteAllAttachments' => [
'application/json',
],
'deleteAttachment' => [
'application/json',
],
'downloadAttachmentAsBase64Encoded' => [
'application/json',
],
'downloadAttachmentAsBytes' => [
'application/json',
],
'getAttachment' => [
'application/json',
],
'getAttachmentInfo' => [
'application/json',
],
'getAttachments' => [
'application/json',
],
'uploadAttachment' => [
'application/json',
],
'uploadAttachmentBytes' => [
'application/json',
],
'uploadMultipartForm' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation deleteAllAttachments
*
* Delete all attachments
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAllAttachments(string $contentType = self::contentTypes['deleteAllAttachments'][0])
{
$this->deleteAllAttachmentsWithHttpInfo($contentType);
}
/**
* Operation deleteAllAttachmentsWithHttpInfo
*
* Delete all attachments
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAllAttachmentsWithHttpInfo(string $contentType = self::contentTypes['deleteAllAttachments'][0])
{
$request = $this->deleteAllAttachmentsRequest($contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAllAttachmentsAsync
*
* Delete all attachments
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllAttachmentsAsync(string $contentType = self::contentTypes['deleteAllAttachments'][0])
{
return $this->deleteAllAttachmentsAsyncWithHttpInfo($contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAllAttachmentsAsyncWithHttpInfo
*
* Delete all attachments
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAllAttachmentsAsyncWithHttpInfo(string $contentType = self::contentTypes['deleteAllAttachments'][0])
{
$returnType = '';
$request = $this->deleteAllAttachmentsRequest($contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAllAttachments'
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAllAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAllAttachmentsRequest(string $contentType = self::contentTypes['deleteAllAttachments'][0])
{
$resourcePath = '/attachments';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAttachment
*
* Delete an attachment
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAttachment($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0])
{
$this->deleteAttachmentWithHttpInfo($attachment_id, $contentType);
}
/**
* Operation deleteAttachmentWithHttpInfo
*
* Delete an attachment
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAttachmentWithHttpInfo($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0])
{
$request = $this->deleteAttachmentRequest($attachment_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAttachmentAsync
*
* Delete an attachment
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAttachmentAsync($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0])
{
return $this->deleteAttachmentAsyncWithHttpInfo($attachment_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAttachmentAsyncWithHttpInfo
*
* Delete an attachment
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAttachmentAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0])
{
$returnType = '';
$request = $this->deleteAttachmentRequest($attachment_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAttachment'
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAttachmentRequest($attachment_id, string $contentType = self::contentTypes['deleteAttachment'][0])
{
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling deleteAttachment'
);
}
$resourcePath = '/attachments/{attachmentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation downloadAttachmentAsBase64Encoded
*
* Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\DownloadAttachmentDto
*/
public function downloadAttachmentAsBase64Encoded($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0])
{
list($response) = $this->downloadAttachmentAsBase64EncodedWithHttpInfo($attachment_id, $contentType);
return $response;
}
/**
* Operation downloadAttachmentAsBase64EncodedWithHttpInfo
*
* Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\DownloadAttachmentDto, HTTP status code, HTTP response headers (array of strings)
*/
public function downloadAttachmentAsBase64EncodedWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0])
{
$request = $this->downloadAttachmentAsBase64EncodedRequest($attachment_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\DownloadAttachmentDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\DownloadAttachmentDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\DownloadAttachmentDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\DownloadAttachmentDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\DownloadAttachmentDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation downloadAttachmentAsBase64EncodedAsync
*
* Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentAsBase64EncodedAsync($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0])
{
return $this->downloadAttachmentAsBase64EncodedAsyncWithHttpInfo($attachment_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation downloadAttachmentAsBase64EncodedAsyncWithHttpInfo
*
* Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentAsBase64EncodedAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0])
{
$returnType = '\MailSlurp\Models\DownloadAttachmentDto';
$request = $this->downloadAttachmentAsBase64EncodedRequest($attachment_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'downloadAttachmentAsBase64Encoded'
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBase64Encoded'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function downloadAttachmentAsBase64EncodedRequest($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBase64Encoded'][0])
{
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling downloadAttachmentAsBase64Encoded'
);
}
$resourcePath = '/attachments/{attachmentId}/base64';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation downloadAttachmentAsBytes
*
* Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string
*/
public function downloadAttachmentAsBytes($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0])
{
list($response) = $this->downloadAttachmentAsBytesWithHttpInfo($attachment_id, $contentType);
return $response;
}
/**
* Operation downloadAttachmentAsBytesWithHttpInfo
*
* Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function downloadAttachmentAsBytesWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0])
{
$request = $this->downloadAttachmentAsBytesRequest($attachment_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
default:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
default:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation downloadAttachmentAsBytesAsync
*
* Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentAsBytesAsync($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0])
{
return $this->downloadAttachmentAsBytesAsyncWithHttpInfo($attachment_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation downloadAttachmentAsBytesAsyncWithHttpInfo
*
* Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function downloadAttachmentAsBytesAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0])
{
$returnType = 'string';
$request = $this->downloadAttachmentAsBytesRequest($attachment_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'downloadAttachmentAsBytes'
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadAttachmentAsBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function downloadAttachmentAsBytesRequest($attachment_id, string $contentType = self::contentTypes['downloadAttachmentAsBytes'][0])
{
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling downloadAttachmentAsBytes'
);
}
$resourcePath = '/attachments/{attachmentId}/bytes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['application/octet-stream', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAttachment
*
* Get an attachment entity
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AttachmentEntity
*/
public function getAttachment($attachment_id, string $contentType = self::contentTypes['getAttachment'][0])
{
list($response) = $this->getAttachmentWithHttpInfo($attachment_id, $contentType);
return $response;
}
/**
* Operation getAttachmentWithHttpInfo
*
* Get an attachment entity
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AttachmentEntity, HTTP status code, HTTP response headers (array of strings)
*/
public function getAttachmentWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachment'][0])
{
$request = $this->getAttachmentRequest($attachment_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\AttachmentEntity' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AttachmentEntity' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentEntity', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AttachmentEntity';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AttachmentEntity',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAttachmentAsync
*
* Get an attachment entity
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentAsync($attachment_id, string $contentType = self::contentTypes['getAttachment'][0])
{
return $this->getAttachmentAsyncWithHttpInfo($attachment_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAttachmentAsyncWithHttpInfo
*
* Get an attachment entity
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachment'][0])
{
$returnType = '\MailSlurp\Models\AttachmentEntity';
$request = $this->getAttachmentRequest($attachment_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAttachment'
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAttachmentRequest($attachment_id, string $contentType = self::contentTypes['getAttachment'][0])
{
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling getAttachment'
);
}
$resourcePath = '/attachments/{attachmentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAttachmentInfo
*
* Get email attachment metadata information
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AttachmentMetaData
*/
public function getAttachmentInfo($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0])
{
list($response) = $this->getAttachmentInfoWithHttpInfo($attachment_id, $contentType);
return $response;
}
/**
* Operation getAttachmentInfoWithHttpInfo
*
* Get email attachment metadata information
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AttachmentMetaData, HTTP status code, HTTP response headers (array of strings)
*/
public function getAttachmentInfoWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0])
{
$request = $this->getAttachmentInfoRequest($attachment_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\AttachmentMetaData' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AttachmentMetaData' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AttachmentMetaData', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AttachmentMetaData';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AttachmentMetaData',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAttachmentInfoAsync
*
* Get email attachment metadata information
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentInfoAsync($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0])
{
return $this->getAttachmentInfoAsyncWithHttpInfo($attachment_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAttachmentInfoAsyncWithHttpInfo
*
* Get email attachment metadata information
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentInfoAsyncWithHttpInfo($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0])
{
$returnType = '\MailSlurp\Models\AttachmentMetaData';
$request = $this->getAttachmentInfoRequest($attachment_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAttachmentInfo'
*
* @param string $attachment_id ID of attachment (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachmentInfo'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAttachmentInfoRequest($attachment_id, string $contentType = self::contentTypes['getAttachmentInfo'][0])
{
// verify the required parameter 'attachment_id' is set
if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $attachment_id when calling getAttachmentInfo'
);
}
$resourcePath = '/attachments/{attachmentId}/metadata';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($attachment_id !== null) {
$resourcePath = str_replace(
'{' . 'attachmentId' . '}',
ObjectSerializer::toPathValue($attachment_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAttachments
*
* Get email attachments
*
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $file_name_filter Optional file name and content type search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inboxId to filter attachments by (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageAttachmentEntity
*/
public function getAttachments($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAttachments'][0])
{
list($response) = $this->getAttachmentsWithHttpInfo($page, $size, $sort, $file_name_filter, $since, $before, $inbox_id, $contentType);
return $response;
}
/**
* Operation getAttachmentsWithHttpInfo
*
* Get email attachments
*
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $file_name_filter Optional file name and content type search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inboxId to filter attachments by (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageAttachmentEntity, HTTP status code, HTTP response headers (array of strings)
*/
public function getAttachmentsWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAttachments'][0])
{
$request = $this->getAttachmentsRequest($page, $size, $sort, $file_name_filter, $since, $before, $inbox_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageAttachmentEntity' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageAttachmentEntity' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageAttachmentEntity', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageAttachmentEntity';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageAttachmentEntity',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAttachmentsAsync
*
* Get email attachments
*
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $file_name_filter Optional file name and content type search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inboxId to filter attachments by (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentsAsync($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAttachments'][0])
{
return $this->getAttachmentsAsyncWithHttpInfo($page, $size, $sort, $file_name_filter, $since, $before, $inbox_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAttachmentsAsyncWithHttpInfo
*
* Get email attachments
*
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $file_name_filter Optional file name and content type search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inboxId to filter attachments by (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAttachmentsAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAttachments'][0])
{
$returnType = '\MailSlurp\Models\PageAttachmentEntity';
$request = $this->getAttachmentsRequest($page, $size, $sort, $file_name_filter, $since, $before, $inbox_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAttachments'
*
* @param int $page Optional page index for list pagination (optional, default to 0)
* @param int $size Optional page size for list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param string $file_name_filter Optional file name and content type search filter (optional)
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $inbox_id Optional inboxId to filter attachments by (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAttachments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAttachmentsRequest($page = 0, $size = 20, $sort = 'ASC', $file_name_filter = null, $since = null, $before = null, $inbox_id = null, string $contentType = self::contentTypes['getAttachments'][0])
{
$resourcePath = '/attachments';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$file_name_filter,
'fileNameFilter', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$inbox_id,
'inboxId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation uploadAttachment
*
* Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options upload_attachment_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string[]
*/
public function uploadAttachment($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0])
{
list($response) = $this->uploadAttachmentWithHttpInfo($upload_attachment_options, $contentType);
return $response;
}
/**
* Operation uploadAttachmentWithHttpInfo
*
* Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string[], HTTP status code, HTTP response headers (array of strings)
*/
public function uploadAttachmentWithHttpInfo($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0])
{
$request = $this->uploadAttachmentRequest($upload_attachment_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('string[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation uploadAttachmentAsync
*
* Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function uploadAttachmentAsync($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0])
{
return $this->uploadAttachmentAsyncWithHttpInfo($upload_attachment_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation uploadAttachmentAsyncWithHttpInfo
*
* Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function uploadAttachmentAsyncWithHttpInfo($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0])
{
$returnType = 'string[]';
$request = $this->uploadAttachmentRequest($upload_attachment_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'uploadAttachment'
*
* @param \MailSlurp\Models\UploadAttachmentOptions $upload_attachment_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachment'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function uploadAttachmentRequest($upload_attachment_options, string $contentType = self::contentTypes['uploadAttachment'][0])
{
// verify the required parameter 'upload_attachment_options' is set
if ($upload_attachment_options === null || (is_array($upload_attachment_options) && count($upload_attachment_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $upload_attachment_options when calling uploadAttachment'
);
}
$resourcePath = '/attachments';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($upload_attachment_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($upload_attachment_options));
} else {
$httpBody = $upload_attachment_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation uploadAttachmentBytes
*
* Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_type content_type (optional)
* @param string $content_type2 Optional contentType for file. For instance `application/pdf` (optional)
* @param string $content_id Optional content ID (CID) to save upload with (optional)
* @param string $filename Optional filename to save upload with (optional)
* @param string $filename2 filename2 (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string[]
*/
public function uploadAttachmentBytes($content_type = null, $content_type2 = null, $content_id = null, $filename = null, $filename2 = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0])
{
list($response) = $this->uploadAttachmentBytesWithHttpInfo($content_type, $content_type2, $content_id, $filename, $filename2, $contentType);
return $response;
}
/**
* Operation uploadAttachmentBytesWithHttpInfo
*
* Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_type (optional)
* @param string $content_type2 Optional contentType for file. For instance `application/pdf` (optional)
* @param string $content_id Optional content ID (CID) to save upload with (optional)
* @param string $filename Optional filename to save upload with (optional)
* @param string $filename2 (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string[], HTTP status code, HTTP response headers (array of strings)
*/
public function uploadAttachmentBytesWithHttpInfo($content_type = null, $content_type2 = null, $content_id = null, $filename = null, $filename2 = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0])
{
$request = $this->uploadAttachmentBytesRequest($content_type, $content_type2, $content_id, $filename, $filename2, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('string[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation uploadAttachmentBytesAsync
*
* Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_type (optional)
* @param string $content_type2 Optional contentType for file. For instance `application/pdf` (optional)
* @param string $content_id Optional content ID (CID) to save upload with (optional)
* @param string $filename Optional filename to save upload with (optional)
* @param string $filename2 (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function uploadAttachmentBytesAsync($content_type = null, $content_type2 = null, $content_id = null, $filename = null, $filename2 = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0])
{
return $this->uploadAttachmentBytesAsyncWithHttpInfo($content_type, $content_type2, $content_id, $filename, $filename2, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation uploadAttachmentBytesAsyncWithHttpInfo
*
* Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_type (optional)
* @param string $content_type2 Optional contentType for file. For instance `application/pdf` (optional)
* @param string $content_id Optional content ID (CID) to save upload with (optional)
* @param string $filename Optional filename to save upload with (optional)
* @param string $filename2 (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function uploadAttachmentBytesAsyncWithHttpInfo($content_type = null, $content_type2 = null, $content_id = null, $filename = null, $filename2 = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0])
{
$returnType = 'string[]';
$request = $this->uploadAttachmentBytesRequest($content_type, $content_type2, $content_id, $filename, $filename2, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'uploadAttachmentBytes'
*
* @param string $content_type (optional)
* @param string $content_type2 Optional contentType for file. For instance `application/pdf` (optional)
* @param string $content_id Optional content ID (CID) to save upload with (optional)
* @param string $filename Optional filename to save upload with (optional)
* @param string $filename2 (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadAttachmentBytes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function uploadAttachmentBytesRequest($content_type = null, $content_type2 = null, $content_id = null, $filename = null, $filename2 = null, string $contentType = self::contentTypes['uploadAttachmentBytes'][0])
{
$resourcePath = '/attachments/bytes';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$content_type2,
'contentType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$content_id,
'contentId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$filename,
'filename', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// header params
if ($content_type !== null) {
$headerParams['contentType'] = ObjectSerializer::toHeaderValue($content_type);
}
// header params
if ($filename2 !== null) {
$headerParams['filename'] = ObjectSerializer::toHeaderValue($filename2);
}
$headers = $this->headerSelector->selectHeaders(
['application/json', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation uploadMultipartForm
*
* Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_id Optional content ID of attachment (optional)
* @param string $content_type Optional content type of attachment (optional)
* @param string $filename Optional name of file (optional)
* @param string $x_filename Optional content type header of attachment (optional)
* @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request upload_multipart_form_request (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return string[]
*/
public function uploadMultipartForm($content_id = null, $content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0])
{
list($response) = $this->uploadMultipartFormWithHttpInfo($content_id, $content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType);
return $response;
}
/**
* Operation uploadMultipartFormWithHttpInfo
*
* Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_id Optional content ID of attachment (optional)
* @param string $content_type Optional content type of attachment (optional)
* @param string $filename Optional name of file (optional)
* @param string $x_filename Optional content type header of attachment (optional)
* @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of string[], HTTP status code, HTTP response headers (array of strings)
*/
public function uploadMultipartFormWithHttpInfo($content_id = null, $content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0])
{
$request = $this->uploadMultipartFormRequest($content_id, $content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('string[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('string[]' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, 'string[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = 'string[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation uploadMultipartFormAsync
*
* Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_id Optional content ID of attachment (optional)
* @param string $content_type Optional content type of attachment (optional)
* @param string $filename Optional name of file (optional)
* @param string $x_filename Optional content type header of attachment (optional)
* @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function uploadMultipartFormAsync($content_id = null, $content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0])
{
return $this->uploadMultipartFormAsyncWithHttpInfo($content_id, $content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation uploadMultipartFormAsyncWithHttpInfo
*
* Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
*
* @param string $content_id Optional content ID of attachment (optional)
* @param string $content_type Optional content type of attachment (optional)
* @param string $filename Optional name of file (optional)
* @param string $x_filename Optional content type header of attachment (optional)
* @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function uploadMultipartFormAsyncWithHttpInfo($content_id = null, $content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0])
{
$returnType = 'string[]';
$request = $this->uploadMultipartFormRequest($content_id, $content_type, $filename, $x_filename, $upload_multipart_form_request, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'uploadMultipartForm'
*
* @param string $content_id Optional content ID of attachment (optional)
* @param string $content_type Optional content type of attachment (optional)
* @param string $filename Optional name of file (optional)
* @param string $x_filename Optional content type header of attachment (optional)
* @param \MailSlurp\Models\UploadMultipartFormRequest $upload_multipart_form_request (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMultipartForm'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function uploadMultipartFormRequest($content_id = null, $content_type = null, $filename = null, $x_filename = null, $upload_multipart_form_request = null, string $contentType = self::contentTypes['uploadMultipartForm'][0])
{
$resourcePath = '/attachments/multipart';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$content_id,
'contentId', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$content_type,
'contentType', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$filename,
'filename', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$x_filename,
'x-filename', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($upload_multipart_form_request)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($upload_multipart_form_request));
} else {
$httpBody = $upload_multipart_form_request;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* AliasControllerApi
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Apis;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use MailSlurp\ApiException;
use MailSlurp\Configuration;
use MailSlurp\HeaderSelector;
use MailSlurp\ObjectSerializer;
/**
* AliasControllerApi Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class AliasControllerApi
{
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
'createAlias' => [
'application/json',
],
'deleteAlias' => [
'application/json',
],
'getAlias' => [
'application/json',
],
'getAliasEmails' => [
'application/json',
],
'getAliasThreads' => [
'application/json',
],
'getAliases' => [
'application/json',
],
'getThread' => [
'application/json',
],
'getThreadsPaginated' => [
'application/json',
],
'replyToAliasEmail' => [
'application/json',
],
'sendAliasEmail' => [
'application/json',
],
'updateAlias' => [
'application/json',
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
/**
* Set the host index
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
{
$this->hostIndex = $hostIndex;
}
/**
* Get the host index
*
* @return int Host index
*/
public function getHostIndex()
{
return $this->hostIndex;
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createAlias
*
* Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active.
*
* @param \MailSlurp\Models\CreateAliasOptions $create_alias_options create_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AliasDto
*/
public function createAlias($create_alias_options, string $contentType = self::contentTypes['createAlias'][0])
{
list($response) = $this->createAliasWithHttpInfo($create_alias_options, $contentType);
return $response;
}
/**
* Operation createAliasWithHttpInfo
*
* Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active.
*
* @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AliasDto, HTTP status code, HTTP response headers (array of strings)
*/
public function createAliasWithHttpInfo($create_alias_options, string $contentType = self::contentTypes['createAlias'][0])
{
$request = $this->createAliasRequest($create_alias_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 201:
if ('\MailSlurp\Models\AliasDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AliasDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AliasDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AliasDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AliasDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation createAliasAsync
*
* Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active.
*
* @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createAliasAsync($create_alias_options, string $contentType = self::contentTypes['createAlias'][0])
{
return $this->createAliasAsyncWithHttpInfo($create_alias_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createAliasAsyncWithHttpInfo
*
* Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active.
*
* @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createAliasAsyncWithHttpInfo($create_alias_options, string $contentType = self::contentTypes['createAlias'][0])
{
$returnType = '\MailSlurp\Models\AliasDto';
$request = $this->createAliasRequest($create_alias_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'createAlias'
*
* @param \MailSlurp\Models\CreateAliasOptions $create_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createAliasRequest($create_alias_options, string $contentType = self::contentTypes['createAlias'][0])
{
// verify the required parameter 'create_alias_options' is set
if ($create_alias_options === null || (is_array($create_alias_options) && count($create_alias_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $create_alias_options when calling createAlias'
);
}
$resourcePath = '/aliases';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($create_alias_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_alias_options));
} else {
$httpBody = $create_alias_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation deleteAlias
*
* Delete an email alias
*
* @param string $alias_id alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return void
*/
public function deleteAlias($alias_id, string $contentType = self::contentTypes['deleteAlias'][0])
{
$this->deleteAliasWithHttpInfo($alias_id, $contentType);
}
/**
* Operation deleteAliasWithHttpInfo
*
* Delete an email alias
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteAliasWithHttpInfo($alias_id, string $contentType = self::contentTypes['deleteAlias'][0])
{
$request = $this->deleteAliasRequest($alias_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
return [null, $statusCode, $response->getHeaders()];
} catch (ApiException $e) {
switch ($e->getCode()) {
}
throw $e;
}
}
/**
* Operation deleteAliasAsync
*
* Delete an email alias
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAliasAsync($alias_id, string $contentType = self::contentTypes['deleteAlias'][0])
{
return $this->deleteAliasAsyncWithHttpInfo($alias_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteAliasAsyncWithHttpInfo
*
* Delete an email alias
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteAliasAsyncWithHttpInfo($alias_id, string $contentType = self::contentTypes['deleteAlias'][0])
{
$returnType = '';
$request = $this->deleteAliasRequest($alias_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
return [null, $response->getStatusCode(), $response->getHeaders()];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'deleteAlias'
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteAliasRequest($alias_id, string $contentType = self::contentTypes['deleteAlias'][0])
{
// verify the required parameter 'alias_id' is set
if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $alias_id when calling deleteAlias'
);
}
$resourcePath = '/aliases/{aliasId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($alias_id !== null) {
$resourcePath = str_replace(
'{' . 'aliasId' . '}',
ObjectSerializer::toPathValue($alias_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
[],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'DELETE',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAlias
*
* Get an email alias
*
* @param string $alias_id alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AliasDto
*/
public function getAlias($alias_id, string $contentType = self::contentTypes['getAlias'][0])
{
list($response) = $this->getAliasWithHttpInfo($alias_id, $contentType);
return $response;
}
/**
* Operation getAliasWithHttpInfo
*
* Get an email alias
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AliasDto, HTTP status code, HTTP response headers (array of strings)
*/
public function getAliasWithHttpInfo($alias_id, string $contentType = self::contentTypes['getAlias'][0])
{
$request = $this->getAliasRequest($alias_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\AliasDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AliasDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AliasDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AliasDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AliasDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAliasAsync
*
* Get an email alias
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasAsync($alias_id, string $contentType = self::contentTypes['getAlias'][0])
{
return $this->getAliasAsyncWithHttpInfo($alias_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAliasAsyncWithHttpInfo
*
* Get an email alias
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasAsyncWithHttpInfo($alias_id, string $contentType = self::contentTypes['getAlias'][0])
{
$returnType = '\MailSlurp\Models\AliasDto';
$request = $this->getAliasRequest($alias_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAlias'
*
* @param string $alias_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAliasRequest($alias_id, string $contentType = self::contentTypes['getAlias'][0])
{
// verify the required parameter 'alias_id' is set
if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $alias_id when calling getAlias'
);
}
$resourcePath = '/aliases/{aliasId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($alias_id !== null) {
$resourcePath = str_replace(
'{' . 'aliasId' . '}',
ObjectSerializer::toPathValue($alias_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAliasEmails
*
* Get emails for an alias
*
* @param string $alias_id alias_id (required)
* @param int $page Optional page index alias email list pagination (optional, default to 0)
* @param int $size Optional page size alias email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageEmailProjection
*/
public function getAliasEmails($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0])
{
list($response) = $this->getAliasEmailsWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getAliasEmailsWithHttpInfo
*
* Get emails for an alias
*
* @param string $alias_id (required)
* @param int $page Optional page index alias email list pagination (optional, default to 0)
* @param int $size Optional page size alias email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageEmailProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAliasEmailsWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0])
{
$request = $this->getAliasEmailsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageEmailProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageEmailProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageEmailProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageEmailProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageEmailProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAliasEmailsAsync
*
* Get emails for an alias
*
* @param string $alias_id (required)
* @param int $page Optional page index alias email list pagination (optional, default to 0)
* @param int $size Optional page size alias email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasEmailsAsync($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0])
{
return $this->getAliasEmailsAsyncWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAliasEmailsAsyncWithHttpInfo
*
* Get emails for an alias
*
* @param string $alias_id (required)
* @param int $page Optional page index alias email list pagination (optional, default to 0)
* @param int $size Optional page size alias email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasEmailsAsyncWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0])
{
$returnType = '\MailSlurp\Models\PageEmailProjection';
$request = $this->getAliasEmailsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAliasEmails'
*
* @param string $alias_id (required)
* @param int $page Optional page index alias email list pagination (optional, default to 0)
* @param int $size Optional page size alias email list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasEmails'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAliasEmailsRequest($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasEmails'][0])
{
// verify the required parameter 'alias_id' is set
if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $alias_id when calling getAliasEmails'
);
}
$resourcePath = '/aliases/{aliasId}/emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($alias_id !== null) {
$resourcePath = str_replace(
'{' . 'aliasId' . '}',
ObjectSerializer::toPathValue($alias_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAliasThreads
*
* Get threads created for an alias
*
* @param string $alias_id alias_id (required)
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageThreadProjection
*/
public function getAliasThreads($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0])
{
list($response) = $this->getAliasThreadsWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getAliasThreadsWithHttpInfo
*
* Get threads created for an alias
*
* @param string $alias_id (required)
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageThreadProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getAliasThreadsWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0])
{
$request = $this->getAliasThreadsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageThreadProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageThreadProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageThreadProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageThreadProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageThreadProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAliasThreadsAsync
*
* Get threads created for an alias
*
* @param string $alias_id (required)
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasThreadsAsync($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0])
{
return $this->getAliasThreadsAsyncWithHttpInfo($alias_id, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAliasThreadsAsyncWithHttpInfo
*
* Get threads created for an alias
*
* @param string $alias_id (required)
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasThreadsAsyncWithHttpInfo($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0])
{
$returnType = '\MailSlurp\Models\PageThreadProjection';
$request = $this->getAliasThreadsRequest($alias_id, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAliasThreads'
*
* @param string $alias_id (required)
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliasThreads'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAliasThreadsRequest($alias_id, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliasThreads'][0])
{
// verify the required parameter 'alias_id' is set
if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $alias_id when calling getAliasThreads'
);
}
$resourcePath = '/aliases/{aliasId}/threads';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// path params
if ($alias_id !== null) {
$resourcePath = str_replace(
'{' . 'aliasId' . '}',
ObjectSerializer::toPathValue($alias_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getAliases
*
* Get all email aliases you have created
*
* @param string $search Optional search term (optional)
* @param int $page Optional page index in alias list pagination (optional, default to 0)
* @param int $size Optional page size in alias list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageAlias
*/
public function getAliases($search = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0])
{
list($response) = $this->getAliasesWithHttpInfo($search, $page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getAliasesWithHttpInfo
*
* Get all email aliases you have created
*
* @param string $search Optional search term (optional)
* @param int $page Optional page index in alias list pagination (optional, default to 0)
* @param int $size Optional page size in alias list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageAlias, HTTP status code, HTTP response headers (array of strings)
*/
public function getAliasesWithHttpInfo($search = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0])
{
$request = $this->getAliasesRequest($search, $page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageAlias' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageAlias' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageAlias', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageAlias';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageAlias',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getAliasesAsync
*
* Get all email aliases you have created
*
* @param string $search Optional search term (optional)
* @param int $page Optional page index in alias list pagination (optional, default to 0)
* @param int $size Optional page size in alias list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasesAsync($search = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0])
{
return $this->getAliasesAsyncWithHttpInfo($search, $page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAliasesAsyncWithHttpInfo
*
* Get all email aliases you have created
*
* @param string $search Optional search term (optional)
* @param int $page Optional page index in alias list pagination (optional, default to 0)
* @param int $size Optional page size in alias list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAliasesAsyncWithHttpInfo($search = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0])
{
$returnType = '\MailSlurp\Models\PageAlias';
$request = $this->getAliasesRequest($search, $page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getAliases'
*
* @param string $search Optional search term (optional)
* @param int $page Optional page index in alias list pagination (optional, default to 0)
* @param int $size Optional page size in alias list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Filter by created at after the given timestamp (optional)
* @param \DateTime $before Filter by created at before the given timestamp (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAliases'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getAliasesRequest($search = null, $page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getAliases'][0])
{
$resourcePath = '/aliases';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$search,
'search', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getThread
*
* Get a thread
*
* @param string $thread_id thread_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThread'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\ThreadProjection
*/
public function getThread($thread_id, string $contentType = self::contentTypes['getThread'][0])
{
list($response) = $this->getThreadWithHttpInfo($thread_id, $contentType);
return $response;
}
/**
* Operation getThreadWithHttpInfo
*
* Get a thread
*
* @param string $thread_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThread'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\ThreadProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getThreadWithHttpInfo($thread_id, string $contentType = self::contentTypes['getThread'][0])
{
$request = $this->getThreadRequest($thread_id, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\ThreadProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\ThreadProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\ThreadProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\ThreadProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\ThreadProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getThreadAsync
*
* Get a thread
*
* @param string $thread_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThread'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getThreadAsync($thread_id, string $contentType = self::contentTypes['getThread'][0])
{
return $this->getThreadAsyncWithHttpInfo($thread_id, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getThreadAsyncWithHttpInfo
*
* Get a thread
*
* @param string $thread_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThread'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getThreadAsyncWithHttpInfo($thread_id, string $contentType = self::contentTypes['getThread'][0])
{
$returnType = '\MailSlurp\Models\ThreadProjection';
$request = $this->getThreadRequest($thread_id, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getThread'
*
* @param string $thread_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThread'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getThreadRequest($thread_id, string $contentType = self::contentTypes['getThread'][0])
{
// verify the required parameter 'thread_id' is set
if ($thread_id === null || (is_array($thread_id) && count($thread_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $thread_id when calling getThread'
);
}
$resourcePath = '/aliases/threads/{threadId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($thread_id !== null) {
$resourcePath = str_replace(
'{' . 'threadId' . '}',
ObjectSerializer::toPathValue($thread_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation getThreadsPaginated
*
* Get all threads
*
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThreadsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\PageThreadProjection
*/
public function getThreadsPaginated($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getThreadsPaginated'][0])
{
list($response) = $this->getThreadsPaginatedWithHttpInfo($page, $size, $sort, $since, $before, $contentType);
return $response;
}
/**
* Operation getThreadsPaginatedWithHttpInfo
*
* Get all threads
*
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThreadsPaginated'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\PageThreadProjection, HTTP status code, HTTP response headers (array of strings)
*/
public function getThreadsPaginatedWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getThreadsPaginated'][0])
{
$request = $this->getThreadsPaginatedRequest($page, $size, $sort, $since, $before, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\PageThreadProjection' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\PageThreadProjection' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\PageThreadProjection', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\PageThreadProjection';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\PageThreadProjection',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation getThreadsPaginatedAsync
*
* Get all threads
*
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThreadsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getThreadsPaginatedAsync($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getThreadsPaginated'][0])
{
return $this->getThreadsPaginatedAsyncWithHttpInfo($page, $size, $sort, $since, $before, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getThreadsPaginatedAsyncWithHttpInfo
*
* Get all threads
*
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThreadsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getThreadsPaginatedAsyncWithHttpInfo($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getThreadsPaginated'][0])
{
$returnType = '\MailSlurp\Models\PageThreadProjection';
$request = $this->getThreadsPaginatedRequest($page, $size, $sort, $since, $before, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'getThreadsPaginated'
*
* @param int $page Optional page index in thread list pagination (optional, default to 0)
* @param int $size Optional page size in thread list pagination (optional, default to 20)
* @param string $sort Optional createdAt sort direction ASC or DESC (optional, default to 'ASC')
* @param \DateTime $since Optional filter by sent after given date time (optional)
* @param \DateTime $before Optional filter by sent before given date time (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getThreadsPaginated'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getThreadsPaginatedRequest($page = 0, $size = 20, $sort = 'ASC', $since = null, $before = null, string $contentType = self::contentTypes['getThreadsPaginated'][0])
{
$resourcePath = '/aliases/threads';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$page,
'page', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$size,
'size', // param base name
'integer', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$sort,
'sort', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$since,
'since', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$before,
'before', // param base name
'string', // openApiType
'form', // style
true, // explode
false // required
) ?? []);
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'GET',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation replyToAliasEmail
*
* Reply to an email
*
* @param string $alias_id ID of the alias that email belongs to (required)
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options reply_to_alias_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentEmailDto
*/
public function replyToAliasEmail($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0])
{
list($response) = $this->replyToAliasEmailWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, $contentType);
return $response;
}
/**
* Operation replyToAliasEmailWithHttpInfo
*
* Reply to an email
*
* @param string $alias_id ID of the alias that email belongs to (required)
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function replyToAliasEmailWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0])
{
$request = $this->replyToAliasEmailRequest($alias_id, $email_id, $reply_to_alias_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation replyToAliasEmailAsync
*
* Reply to an email
*
* @param string $alias_id ID of the alias that email belongs to (required)
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function replyToAliasEmailAsync($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0])
{
return $this->replyToAliasEmailAsyncWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation replyToAliasEmailAsyncWithHttpInfo
*
* Reply to an email
*
* @param string $alias_id ID of the alias that email belongs to (required)
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function replyToAliasEmailAsyncWithHttpInfo($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0])
{
$returnType = '\MailSlurp\Models\SentEmailDto';
$request = $this->replyToAliasEmailRequest($alias_id, $email_id, $reply_to_alias_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'replyToAliasEmail'
*
* @param string $alias_id ID of the alias that email belongs to (required)
* @param string $email_id ID of the email that should be replied to (required)
* @param \MailSlurp\Models\ReplyToAliasEmailOptions $reply_to_alias_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['replyToAliasEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function replyToAliasEmailRequest($alias_id, $email_id, $reply_to_alias_email_options, string $contentType = self::contentTypes['replyToAliasEmail'][0])
{
// verify the required parameter 'alias_id' is set
if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $alias_id when calling replyToAliasEmail'
);
}
// verify the required parameter 'email_id' is set
if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $email_id when calling replyToAliasEmail'
);
}
// verify the required parameter 'reply_to_alias_email_options' is set
if ($reply_to_alias_email_options === null || (is_array($reply_to_alias_email_options) && count($reply_to_alias_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $reply_to_alias_email_options when calling replyToAliasEmail'
);
}
$resourcePath = '/aliases/{aliasId}/emails/{emailId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($alias_id !== null) {
$resourcePath = str_replace(
'{' . 'aliasId' . '}',
ObjectSerializer::toPathValue($alias_id),
$resourcePath
);
}
// path params
if ($email_id !== null) {
$resourcePath = str_replace(
'{' . 'emailId' . '}',
ObjectSerializer::toPathValue($email_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($reply_to_alias_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($reply_to_alias_email_options));
} else {
$httpBody = $reply_to_alias_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation sendAliasEmail
*
* Send an email from an alias inbox
*
* @param string $alias_id alias_id (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\SentEmailDto
*/
public function sendAliasEmail($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0])
{
list($response) = $this->sendAliasEmailWithHttpInfo($alias_id, $send_email_options, $contentType);
return $response;
}
/**
* Operation sendAliasEmailWithHttpInfo
*
* Send an email from an alias inbox
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\SentEmailDto, HTTP status code, HTTP response headers (array of strings)
*/
public function sendAliasEmailWithHttpInfo($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0])
{
$request = $this->sendAliasEmailRequest($alias_id, $send_email_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\MailSlurp\Models\SentEmailDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\SentEmailDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\SentEmailDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\SentEmailDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\SentEmailDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation sendAliasEmailAsync
*
* Send an email from an alias inbox
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendAliasEmailAsync($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0])
{
return $this->sendAliasEmailAsyncWithHttpInfo($alias_id, $send_email_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation sendAliasEmailAsyncWithHttpInfo
*
* Send an email from an alias inbox
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function sendAliasEmailAsyncWithHttpInfo($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0])
{
$returnType = '\MailSlurp\Models\SentEmailDto';
$request = $this->sendAliasEmailRequest($alias_id, $send_email_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'sendAliasEmail'
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\SendEmailOptions $send_email_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendAliasEmail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function sendAliasEmailRequest($alias_id, $send_email_options, string $contentType = self::contentTypes['sendAliasEmail'][0])
{
// verify the required parameter 'alias_id' is set
if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $alias_id when calling sendAliasEmail'
);
}
// verify the required parameter 'send_email_options' is set
if ($send_email_options === null || (is_array($send_email_options) && count($send_email_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $send_email_options when calling sendAliasEmail'
);
}
$resourcePath = '/aliases/{aliasId}/emails';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($alias_id !== null) {
$resourcePath = str_replace(
'{' . 'aliasId' . '}',
ObjectSerializer::toPathValue($alias_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($send_email_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($send_email_options));
} else {
$httpBody = $send_email_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation updateAlias
*
* Update an email alias
*
* @param string $alias_id alias_id (required)
* @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options update_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \MailSlurp\Models\AliasDto
*/
public function updateAlias($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0])
{
list($response) = $this->updateAliasWithHttpInfo($alias_id, $update_alias_options, $contentType);
return $response;
}
/**
* Operation updateAliasWithHttpInfo
*
* Update an email alias
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation
*
* @throws \MailSlurp\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \MailSlurp\Models\AliasDto, HTTP status code, HTTP response headers (array of strings)
*/
public function updateAliasWithHttpInfo($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0])
{
$request = $this->updateAliasRequest($alias_id, $update_alias_options, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 202:
if ('\MailSlurp\Models\AliasDto' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\MailSlurp\Models\AliasDto' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\MailSlurp\Models\AliasDto', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\MailSlurp\Models\AliasDto';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 202:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\MailSlurp\Models\AliasDto',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation updateAliasAsync
*
* Update an email alias
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateAliasAsync($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0])
{
return $this->updateAliasAsyncWithHttpInfo($alias_id, $update_alias_options, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation updateAliasAsyncWithHttpInfo
*
* Update an email alias
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function updateAliasAsyncWithHttpInfo($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0])
{
$returnType = '\MailSlurp\Models\AliasDto';
$request = $this->updateAliasRequest($alias_id, $update_alias_options, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'updateAlias'
*
* @param string $alias_id (required)
* @param \MailSlurp\Models\UpdateAliasOptions $update_alias_options (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateAlias'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateAliasRequest($alias_id, $update_alias_options, string $contentType = self::contentTypes['updateAlias'][0])
{
// verify the required parameter 'alias_id' is set
if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $alias_id when calling updateAlias'
);
}
// verify the required parameter 'update_alias_options' is set
if ($update_alias_options === null || (is_array($update_alias_options) && count($update_alias_options) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $update_alias_options when calling updateAlias'
);
}
$resourcePath = '/aliases/{aliasId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if ($alias_id !== null) {
$resourcePath = str_replace(
'{' . 'aliasId' . '}',
ObjectSerializer::toPathValue($alias_id),
$resourcePath
);
}
$headers = $this->headerSelector->selectHeaders(
['*/*', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($update_alias_options)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_alias_options));
} else {
$httpBody = $update_alias_options;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix('x-api-key');
if ($apiKey !== null) {
$headers['x-api-key'] = $apiKey;
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'PUT',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Create http client option
*
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
}
}
return $options;
}
}
<?php
/**
* WebhookTestResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookTestResult Class Doc Comment
*
* @category Class
* @description Results of testing a webhook
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookTestResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookTestResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message' => 'string',
'response' => '\MailSlurp\Models\WebhookTestResponse',
'request' => '\MailSlurp\Models\WebhookTestRequest'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message' => null,
'response' => null,
'request' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message' => true,
'response' => false,
'request' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message' => 'message',
'response' => 'response',
'request' => 'request'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message' => 'setMessage',
'response' => 'setResponse',
'request' => 'setRequest'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message' => 'getMessage',
'response' => 'getResponse',
'request' => 'getRequest'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('response', $data ?? [], null);
$this->setIfExists('request', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['response'] === null) {
$invalidProperties[] = "'response' can't be null";
}
if ($this->container['request'] === null) {
$invalidProperties[] = "'request' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets response
*
* @return \MailSlurp\Models\WebhookTestResponse
*/
public function getResponse()
{
return $this->container['response'];
}
/**
* Sets response
*
* @param \MailSlurp\Models\WebhookTestResponse $response response
*
* @return self
*/
public function setResponse($response)
{
if (is_null($response)) {
throw new \InvalidArgumentException('non-nullable response cannot be null');
}
$this->container['response'] = $response;
return $this;
}
/**
* Gets request
*
* @return \MailSlurp\Models\WebhookTestRequest
*/
public function getRequest()
{
return $this->container['request'];
}
/**
* Sets request
*
* @param \MailSlurp\Models\WebhookTestRequest $request request
*
* @return self
*/
public function setRequest($request)
{
if (is_null($request)) {
throw new \InvalidArgumentException('non-nullable request cannot be null');
}
$this->container['request'] = $request;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookTestResponse
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookTestResponse Class Doc Comment
*
* @category Class
* @description Response from webhook test request
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookTestResponse implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookTestResponse';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'status_code' => 'int',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'status_code' => 'int32',
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'status_code' => true,
'message' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'status_code' => 'statusCode',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'status_code' => 'setStatusCode',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'status_code' => 'getStatusCode',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('status_code', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets status_code
*
* @return int|null
*/
public function getStatusCode()
{
return $this->container['status_code'];
}
/**
* Sets status_code
*
* @param int|null $status_code status_code
*
* @return self
*/
public function setStatusCode($status_code)
{
if (is_null($status_code)) {
array_push($this->openAPINullablesSetToNull, 'status_code');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('status_code', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['status_code'] = $status_code;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookTestRequest
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookTestRequest Class Doc Comment
*
* @category Class
* @description Result of webhook test request
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookTestRequest implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookTestRequest';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'url' => 'string',
'method' => 'string',
'headers' => 'array<string,string>',
'payload' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'url' => null,
'method' => null,
'headers' => null,
'payload' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'url' => false,
'method' => false,
'headers' => false,
'payload' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'url' => 'url',
'method' => 'method',
'headers' => 'headers',
'payload' => 'payload'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'url' => 'setUrl',
'method' => 'setMethod',
'headers' => 'setHeaders',
'payload' => 'setPayload'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'url' => 'getUrl',
'method' => 'getMethod',
'headers' => 'getHeaders',
'payload' => 'getPayload'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const METHOD_POST = 'POST';
public const METHOD_DELETE = 'DELETE';
public const METHOD_GET = 'GET';
public const METHOD_PUT = 'PUT';
public const METHOD_PATCH = 'PATCH';
public const METHOD_HEAD = 'HEAD';
public const METHOD_OPTIONS = 'OPTIONS';
public const METHOD_TRACE = 'TRACE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getMethodAllowableValues()
{
return [
self::METHOD_POST,
self::METHOD_DELETE,
self::METHOD_GET,
self::METHOD_PUT,
self::METHOD_PATCH,
self::METHOD_HEAD,
self::METHOD_OPTIONS,
self::METHOD_TRACE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('method', $data ?? [], null);
$this->setIfExists('headers', $data ?? [], null);
$this->setIfExists('payload', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
if ($this->container['method'] === null) {
$invalidProperties[] = "'method' can't be null";
}
$allowedValues = $this->getMethodAllowableValues();
if (!is_null($this->container['method']) && !in_array($this->container['method'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'method', must be one of '%s'",
$this->container['method'],
implode("', '", $allowedValues)
);
}
if ($this->container['headers'] === null) {
$invalidProperties[] = "'headers' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url url
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets method
*
* @return string
*/
public function getMethod()
{
return $this->container['method'];
}
/**
* Sets method
*
* @param string $method method
*
* @return self
*/
public function setMethod($method)
{
$allowedValues = $this->getMethodAllowableValues();
if (!in_array($method, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'method', must be one of '%s'",
$method,
implode("', '", $allowedValues)
)
);
}
if (is_null($method)) {
throw new \InvalidArgumentException('non-nullable method cannot be null');
}
$this->container['method'] = $method;
return $this;
}
/**
* Gets headers
*
* @return array<string,string>
*/
public function getHeaders()
{
return $this->container['headers'];
}
/**
* Sets headers
*
* @param array<string,string> $headers headers
*
* @return self
*/
public function setHeaders($headers)
{
if (is_null($headers)) {
throw new \InvalidArgumentException('non-nullable headers cannot be null');
}
$this->container['headers'] = $headers;
return $this;
}
/**
* Gets payload
*
* @return string|null
*/
public function getPayload()
{
return $this->container['payload'];
}
/**
* Sets payload
*
* @param string|null $payload payload
*
* @return self
*/
public function setPayload($payload)
{
if (is_null($payload)) {
array_push($this->openAPINullablesSetToNull, 'payload');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('payload', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['payload'] = $payload;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookResultDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookResultDto Class Doc Comment
*
* @category Class
* @description Result of a webhook notification
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookResultDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookResultDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'webhook_id' => 'string',
'webhook_url' => 'string',
'message_id' => 'string',
'redrive_id' => 'string',
'http_method' => 'string',
'webhook_event' => 'string',
'response_status' => 'int',
'response_time_millis' => 'int',
'response_body_extract' => 'string',
'result_type' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'seen' => 'bool',
'inbox_id' => 'string',
'email_id' => 'string',
'attachment_id' => 'string',
'phone_id' => 'string',
'sms_id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'webhook_id' => 'uuid',
'webhook_url' => null,
'message_id' => null,
'redrive_id' => 'uuid',
'http_method' => null,
'webhook_event' => null,
'response_status' => 'int32',
'response_time_millis' => 'int64',
'response_body_extract' => null,
'result_type' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time',
'seen' => null,
'inbox_id' => 'uuid',
'email_id' => 'uuid',
'attachment_id' => 'uuid',
'phone_id' => 'uuid',
'sms_id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => true,
'user_id' => false,
'webhook_id' => false,
'webhook_url' => false,
'message_id' => false,
'redrive_id' => true,
'http_method' => false,
'webhook_event' => false,
'response_status' => true,
'response_time_millis' => false,
'response_body_extract' => true,
'result_type' => true,
'created_at' => false,
'updated_at' => false,
'seen' => false,
'inbox_id' => true,
'email_id' => true,
'attachment_id' => true,
'phone_id' => true,
'sms_id' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'webhook_id' => 'webhookId',
'webhook_url' => 'webhookUrl',
'message_id' => 'messageId',
'redrive_id' => 'redriveId',
'http_method' => 'httpMethod',
'webhook_event' => 'webhookEvent',
'response_status' => 'responseStatus',
'response_time_millis' => 'responseTimeMillis',
'response_body_extract' => 'responseBodyExtract',
'result_type' => 'resultType',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'seen' => 'seen',
'inbox_id' => 'inboxId',
'email_id' => 'emailId',
'attachment_id' => 'attachmentId',
'phone_id' => 'phoneId',
'sms_id' => 'smsId'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'webhook_id' => 'setWebhookId',
'webhook_url' => 'setWebhookUrl',
'message_id' => 'setMessageId',
'redrive_id' => 'setRedriveId',
'http_method' => 'setHttpMethod',
'webhook_event' => 'setWebhookEvent',
'response_status' => 'setResponseStatus',
'response_time_millis' => 'setResponseTimeMillis',
'response_body_extract' => 'setResponseBodyExtract',
'result_type' => 'setResultType',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'seen' => 'setSeen',
'inbox_id' => 'setInboxId',
'email_id' => 'setEmailId',
'attachment_id' => 'setAttachmentId',
'phone_id' => 'setPhoneId',
'sms_id' => 'setSmsId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'webhook_id' => 'getWebhookId',
'webhook_url' => 'getWebhookUrl',
'message_id' => 'getMessageId',
'redrive_id' => 'getRedriveId',
'http_method' => 'getHttpMethod',
'webhook_event' => 'getWebhookEvent',
'response_status' => 'getResponseStatus',
'response_time_millis' => 'getResponseTimeMillis',
'response_body_extract' => 'getResponseBodyExtract',
'result_type' => 'getResultType',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'seen' => 'getSeen',
'inbox_id' => 'getInboxId',
'email_id' => 'getEmailId',
'attachment_id' => 'getAttachmentId',
'phone_id' => 'getPhoneId',
'sms_id' => 'getSmsId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const HTTP_METHOD_POST = 'POST';
public const HTTP_METHOD_DELETE = 'DELETE';
public const HTTP_METHOD_GET = 'GET';
public const HTTP_METHOD_PUT = 'PUT';
public const HTTP_METHOD_PATCH = 'PATCH';
public const HTTP_METHOD_HEAD = 'HEAD';
public const HTTP_METHOD_OPTIONS = 'OPTIONS';
public const HTTP_METHOD_TRACE = 'TRACE';
public const WEBHOOK_EVENT_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const WEBHOOK_EVENT_NEW_EMAIL = 'NEW_EMAIL';
public const WEBHOOK_EVENT_NEW_CONTACT = 'NEW_CONTACT';
public const WEBHOOK_EVENT_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const WEBHOOK_EVENT_EMAIL_OPENED = 'EMAIL_OPENED';
public const WEBHOOK_EVENT_EMAIL_READ = 'EMAIL_READ';
public const WEBHOOK_EVENT_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const WEBHOOK_EVENT_BOUNCE = 'BOUNCE';
public const WEBHOOK_EVENT_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const WEBHOOK_EVENT_NEW_SMS = 'NEW_SMS';
public const RESULT_TYPE_BAD_RESPONSE = 'BAD_RESPONSE';
public const RESULT_TYPE_EXCEPTION = 'EXCEPTION';
public const RESULT_TYPE_SUCCESS = 'SUCCESS';
public const RESULT_TYPE_REDRIVEN = 'REDRIVEN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getHttpMethodAllowableValues()
{
return [
self::HTTP_METHOD_POST,
self::HTTP_METHOD_DELETE,
self::HTTP_METHOD_GET,
self::HTTP_METHOD_PUT,
self::HTTP_METHOD_PATCH,
self::HTTP_METHOD_HEAD,
self::HTTP_METHOD_OPTIONS,
self::HTTP_METHOD_TRACE,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getWebhookEventAllowableValues()
{
return [
self::WEBHOOK_EVENT_EMAIL_RECEIVED,
self::WEBHOOK_EVENT_NEW_EMAIL,
self::WEBHOOK_EVENT_NEW_CONTACT,
self::WEBHOOK_EVENT_NEW_ATTACHMENT,
self::WEBHOOK_EVENT_EMAIL_OPENED,
self::WEBHOOK_EVENT_EMAIL_READ,
self::WEBHOOK_EVENT_DELIVERY_STATUS,
self::WEBHOOK_EVENT_BOUNCE,
self::WEBHOOK_EVENT_BOUNCE_RECIPIENT,
self::WEBHOOK_EVENT_NEW_SMS,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getResultTypeAllowableValues()
{
return [
self::RESULT_TYPE_BAD_RESPONSE,
self::RESULT_TYPE_EXCEPTION,
self::RESULT_TYPE_SUCCESS,
self::RESULT_TYPE_REDRIVEN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('webhook_url', $data ?? [], null);
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('redrive_id', $data ?? [], null);
$this->setIfExists('http_method', $data ?? [], null);
$this->setIfExists('webhook_event', $data ?? [], null);
$this->setIfExists('response_status', $data ?? [], null);
$this->setIfExists('response_time_millis', $data ?? [], null);
$this->setIfExists('response_body_extract', $data ?? [], null);
$this->setIfExists('result_type', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('seen', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('email_id', $data ?? [], null);
$this->setIfExists('attachment_id', $data ?? [], null);
$this->setIfExists('phone_id', $data ?? [], null);
$this->setIfExists('sms_id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['webhook_url'] === null) {
$invalidProperties[] = "'webhook_url' can't be null";
}
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['http_method'] === null) {
$invalidProperties[] = "'http_method' can't be null";
}
$allowedValues = $this->getHttpMethodAllowableValues();
if (!is_null($this->container['http_method']) && !in_array($this->container['http_method'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'http_method', must be one of '%s'",
$this->container['http_method'],
implode("', '", $allowedValues)
);
}
if ($this->container['webhook_event'] === null) {
$invalidProperties[] = "'webhook_event' can't be null";
}
$allowedValues = $this->getWebhookEventAllowableValues();
if (!is_null($this->container['webhook_event']) && !in_array($this->container['webhook_event'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'webhook_event', must be one of '%s'",
$this->container['webhook_event'],
implode("', '", $allowedValues)
);
}
if ($this->container['response_time_millis'] === null) {
$invalidProperties[] = "'response_time_millis' can't be null";
}
$allowedValues = $this->getResultTypeAllowableValues();
if (!is_null($this->container['result_type']) && !in_array($this->container['result_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'result_type', must be one of '%s'",
$this->container['result_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['seen'] === null) {
$invalidProperties[] = "'seen' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
array_push($this->openAPINullablesSetToNull, 'id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id webhook_id
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets webhook_url
*
* @return string
*/
public function getWebhookUrl()
{
return $this->container['webhook_url'];
}
/**
* Sets webhook_url
*
* @param string $webhook_url webhook_url
*
* @return self
*/
public function setWebhookUrl($webhook_url)
{
if (is_null($webhook_url)) {
throw new \InvalidArgumentException('non-nullable webhook_url cannot be null');
}
$this->container['webhook_url'] = $webhook_url;
return $this;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id message_id
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets redrive_id
*
* @return string|null
*/
public function getRedriveId()
{
return $this->container['redrive_id'];
}
/**
* Sets redrive_id
*
* @param string|null $redrive_id redrive_id
*
* @return self
*/
public function setRedriveId($redrive_id)
{
if (is_null($redrive_id)) {
array_push($this->openAPINullablesSetToNull, 'redrive_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('redrive_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['redrive_id'] = $redrive_id;
return $this;
}
/**
* Gets http_method
*
* @return string
*/
public function getHttpMethod()
{
return $this->container['http_method'];
}
/**
* Sets http_method
*
* @param string $http_method http_method
*
* @return self
*/
public function setHttpMethod($http_method)
{
$allowedValues = $this->getHttpMethodAllowableValues();
if (!in_array($http_method, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'http_method', must be one of '%s'",
$http_method,
implode("', '", $allowedValues)
)
);
}
if (is_null($http_method)) {
throw new \InvalidArgumentException('non-nullable http_method cannot be null');
}
$this->container['http_method'] = $http_method;
return $this;
}
/**
* Gets webhook_event
*
* @return string
*/
public function getWebhookEvent()
{
return $this->container['webhook_event'];
}
/**
* Sets webhook_event
*
* @param string $webhook_event webhook_event
*
* @return self
*/
public function setWebhookEvent($webhook_event)
{
$allowedValues = $this->getWebhookEventAllowableValues();
if (!in_array($webhook_event, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'webhook_event', must be one of '%s'",
$webhook_event,
implode("', '", $allowedValues)
)
);
}
if (is_null($webhook_event)) {
throw new \InvalidArgumentException('non-nullable webhook_event cannot be null');
}
$this->container['webhook_event'] = $webhook_event;
return $this;
}
/**
* Gets response_status
*
* @return int|null
*/
public function getResponseStatus()
{
return $this->container['response_status'];
}
/**
* Sets response_status
*
* @param int|null $response_status response_status
*
* @return self
*/
public function setResponseStatus($response_status)
{
if (is_null($response_status)) {
array_push($this->openAPINullablesSetToNull, 'response_status');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('response_status', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['response_status'] = $response_status;
return $this;
}
/**
* Gets response_time_millis
*
* @return int
*/
public function getResponseTimeMillis()
{
return $this->container['response_time_millis'];
}
/**
* Sets response_time_millis
*
* @param int $response_time_millis response_time_millis
*
* @return self
*/
public function setResponseTimeMillis($response_time_millis)
{
if (is_null($response_time_millis)) {
throw new \InvalidArgumentException('non-nullable response_time_millis cannot be null');
}
$this->container['response_time_millis'] = $response_time_millis;
return $this;
}
/**
* Gets response_body_extract
*
* @return string|null
*/
public function getResponseBodyExtract()
{
return $this->container['response_body_extract'];
}
/**
* Sets response_body_extract
*
* @param string|null $response_body_extract response_body_extract
*
* @return self
*/
public function setResponseBodyExtract($response_body_extract)
{
if (is_null($response_body_extract)) {
array_push($this->openAPINullablesSetToNull, 'response_body_extract');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('response_body_extract', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['response_body_extract'] = $response_body_extract;
return $this;
}
/**
* Gets result_type
*
* @return string|null
*/
public function getResultType()
{
return $this->container['result_type'];
}
/**
* Sets result_type
*
* @param string|null $result_type result_type
*
* @return self
*/
public function setResultType($result_type)
{
$allowedValues = $this->getResultTypeAllowableValues();
if (!is_null($result_type) && !in_array($result_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'result_type', must be one of '%s'",
$result_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($result_type)) {
array_push($this->openAPINullablesSetToNull, 'result_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('result_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['result_type'] = $result_type;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets seen
*
* @return bool
*/
public function getSeen()
{
return $this->container['seen'];
}
/**
* Sets seen
*
* @param bool $seen seen
*
* @return self
*/
public function setSeen($seen)
{
if (is_null($seen)) {
throw new \InvalidArgumentException('non-nullable seen cannot be null');
}
$this->container['seen'] = $seen;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets email_id
*
* @return string|null
*/
public function getEmailId()
{
return $this->container['email_id'];
}
/**
* Sets email_id
*
* @param string|null $email_id email_id
*
* @return self
*/
public function setEmailId($email_id)
{
if (is_null($email_id)) {
array_push($this->openAPINullablesSetToNull, 'email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_id'] = $email_id;
return $this;
}
/**
* Gets attachment_id
*
* @return string|null
*/
public function getAttachmentId()
{
return $this->container['attachment_id'];
}
/**
* Sets attachment_id
*
* @param string|null $attachment_id attachment_id
*
* @return self
*/
public function setAttachmentId($attachment_id)
{
if (is_null($attachment_id)) {
array_push($this->openAPINullablesSetToNull, 'attachment_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachment_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachment_id'] = $attachment_id;
return $this;
}
/**
* Gets phone_id
*
* @return string|null
*/
public function getPhoneId()
{
return $this->container['phone_id'];
}
/**
* Sets phone_id
*
* @param string|null $phone_id phone_id
*
* @return self
*/
public function setPhoneId($phone_id)
{
if (is_null($phone_id)) {
array_push($this->openAPINullablesSetToNull, 'phone_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('phone_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['phone_id'] = $phone_id;
return $this;
}
/**
* Gets sms_id
*
* @return string|null
*/
public function getSmsId()
{
return $this->container['sms_id'];
}
/**
* Sets sms_id
*
* @param string|null $sms_id sms_id
*
* @return self
*/
public function setSmsId($sms_id)
{
if (is_null($sms_id)) {
array_push($this->openAPINullablesSetToNull, 'sms_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sms_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sms_id'] = $sms_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookRedriveResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookRedriveResult Class Doc Comment
*
* @category Class
* @description Result of retrying webhook
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookRedriveResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookRedriveResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'webhook_result_id' => 'string',
'success' => 'bool',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'webhook_result_id' => 'uuid',
'success' => null,
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'webhook_result_id' => false,
'success' => false,
'message' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'webhook_result_id' => 'webhookResultId',
'success' => 'success',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'webhook_result_id' => 'setWebhookResultId',
'success' => 'setSuccess',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'webhook_result_id' => 'getWebhookResultId',
'success' => 'getSuccess',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('webhook_result_id', $data ?? [], null);
$this->setIfExists('success', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['webhook_result_id'] === null) {
$invalidProperties[] = "'webhook_result_id' can't be null";
}
if ($this->container['success'] === null) {
$invalidProperties[] = "'success' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets webhook_result_id
*
* @return string
*/
public function getWebhookResultId()
{
return $this->container['webhook_result_id'];
}
/**
* Sets webhook_result_id
*
* @param string $webhook_result_id webhook_result_id
*
* @return self
*/
public function setWebhookResultId($webhook_result_id)
{
if (is_null($webhook_result_id)) {
throw new \InvalidArgumentException('non-nullable webhook_result_id cannot be null');
}
$this->container['webhook_result_id'] = $webhook_result_id;
return $this;
}
/**
* Gets success
*
* @return bool
*/
public function getSuccess()
{
return $this->container['success'];
}
/**
* Sets success
*
* @param bool $success success
*
* @return self
*/
public function setSuccess($success)
{
if (is_null($success)) {
throw new \InvalidArgumentException('non-nullable success cannot be null');
}
$this->container['success'] = $success;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookRedriveAllResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookRedriveAllResult Class Doc Comment
*
* @category Class
* @description Result of retrying all failed webhook
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookRedriveAllResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookRedriveAllResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'success' => 'bool',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'success' => null,
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'success' => false,
'message' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'success' => 'success',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'success' => 'setSuccess',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'success' => 'getSuccess',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('success', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['success'] === null) {
$invalidProperties[] = "'success' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets success
*
* @return bool
*/
public function getSuccess()
{
return $this->container['success'];
}
/**
* Sets success
*
* @param bool $success success
*
* @return self
*/
public function setSuccess($success)
{
if (is_null($success)) {
throw new \InvalidArgumentException('non-nullable success cannot be null');
}
$this->container['success'] = $success;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookProjection Class Doc Comment
*
* @category Class
* @description Representation of a webhook
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'url' => 'string',
'inbox_id' => 'string',
'event_name' => 'string',
'phone_number_id' => 'string',
'name' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'updated_at' => 'date-time',
'url' => null,
'inbox_id' => 'uuid',
'event_name' => null,
'phone_number_id' => 'uuid',
'name' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'updated_at' => false,
'url' => false,
'inbox_id' => false,
'event_name' => false,
'phone_number_id' => false,
'name' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'url' => 'url',
'inbox_id' => 'inboxId',
'event_name' => 'eventName',
'phone_number_id' => 'phoneNumberId',
'name' => 'name',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'url' => 'setUrl',
'inbox_id' => 'setInboxId',
'event_name' => 'setEventName',
'phone_number_id' => 'setPhoneNumberId',
'name' => 'setName',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'url' => 'getUrl',
'inbox_id' => 'getInboxId',
'event_name' => 'getEventName',
'phone_number_id' => 'getPhoneNumberId',
'name' => 'getName',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('phone_number_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url url
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets event_name
*
* @return string|null
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string|null $event_name event_name
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($event_name) && !in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets phone_number_id
*
* @return string|null
*/
public function getPhoneNumberId()
{
return $this->container['phone_number_id'];
}
/**
* Sets phone_number_id
*
* @param string|null $phone_number_id phone_number_id
*
* @return self
*/
public function setPhoneNumberId($phone_number_id)
{
if (is_null($phone_number_id)) {
throw new \InvalidArgumentException('non-nullable phone_number_id cannot be null');
}
$this->container['phone_number_id'] = $phone_number_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookNewSmsPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookNewSmsPayload Class Doc Comment
*
* @category Class
* @description NEW_SMS webhook payload. Sent to your webhook url endpoint via HTTP POST when an sms is received by the phone number that your webhook is attached to. Use the SMS ID to fetch the full SMS details.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookNewSmsPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookNewSmsPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'event_name' => 'string',
'webhook_name' => 'string',
'sms_id' => 'string',
'user_id' => 'string',
'phone_number' => 'string',
'to_number' => 'string',
'from_number' => 'string',
'body' => 'string',
'read' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'event_name' => null,
'webhook_name' => null,
'sms_id' => 'uuid',
'user_id' => 'uuid',
'phone_number' => 'uuid',
'to_number' => null,
'from_number' => null,
'body' => null,
'read' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'event_name' => false,
'webhook_name' => true,
'sms_id' => false,
'user_id' => false,
'phone_number' => false,
'to_number' => false,
'from_number' => false,
'body' => false,
'read' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'event_name' => 'eventName',
'webhook_name' => 'webhookName',
'sms_id' => 'smsId',
'user_id' => 'userId',
'phone_number' => 'phoneNumber',
'to_number' => 'toNumber',
'from_number' => 'fromNumber',
'body' => 'body',
'read' => 'read'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'event_name' => 'setEventName',
'webhook_name' => 'setWebhookName',
'sms_id' => 'setSmsId',
'user_id' => 'setUserId',
'phone_number' => 'setPhoneNumber',
'to_number' => 'setToNumber',
'from_number' => 'setFromNumber',
'body' => 'setBody',
'read' => 'setRead'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'event_name' => 'getEventName',
'webhook_name' => 'getWebhookName',
'sms_id' => 'getSmsId',
'user_id' => 'getUserId',
'phone_number' => 'getPhoneNumber',
'to_number' => 'getToNumber',
'from_number' => 'getFromNumber',
'body' => 'getBody',
'read' => 'getRead'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('sms_id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('phone_number', $data ?? [], null);
$this->setIfExists('to_number', $data ?? [], null);
$this->setIfExists('from_number', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['sms_id'] === null) {
$invalidProperties[] = "'sms_id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['phone_number'] === null) {
$invalidProperties[] = "'phone_number' can't be null";
}
if ($this->container['to_number'] === null) {
$invalidProperties[] = "'to_number' can't be null";
}
if ($this->container['from_number'] === null) {
$invalidProperties[] = "'from_number' can't be null";
}
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['read'] === null) {
$invalidProperties[] = "'read' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets sms_id
*
* @return string
*/
public function getSmsId()
{
return $this->container['sms_id'];
}
/**
* Sets sms_id
*
* @param string $sms_id ID of SMS message
*
* @return self
*/
public function setSmsId($sms_id)
{
if (is_null($sms_id)) {
throw new \InvalidArgumentException('non-nullable sms_id cannot be null');
}
$this->container['sms_id'] = $sms_id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id User ID of event
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets phone_number
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number
*
* @param string $phone_number ID of phone number receiving SMS
*
* @return self
*/
public function setPhoneNumber($phone_number)
{
if (is_null($phone_number)) {
throw new \InvalidArgumentException('non-nullable phone_number cannot be null');
}
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Gets to_number
*
* @return string
*/
public function getToNumber()
{
return $this->container['to_number'];
}
/**
* Sets to_number
*
* @param string $to_number Recipient phone number
*
* @return self
*/
public function setToNumber($to_number)
{
if (is_null($to_number)) {
throw new \InvalidArgumentException('non-nullable to_number cannot be null');
}
$this->container['to_number'] = $to_number;
return $this;
}
/**
* Gets from_number
*
* @return string
*/
public function getFromNumber()
{
return $this->container['from_number'];
}
/**
* Sets from_number
*
* @param string $from_number Sender phone number
*
* @return self
*/
public function setFromNumber($from_number)
{
if (is_null($from_number)) {
throw new \InvalidArgumentException('non-nullable from_number cannot be null');
}
$this->container['from_number'] = $from_number;
return $this;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body SMS message body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets read
*
* @return bool
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool $read SMS has been read
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
throw new \InvalidArgumentException('non-nullable read cannot be null');
}
$this->container['read'] = $read;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookNewEmailPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookNewEmailPayload Class Doc Comment
*
* @category Class
* @description NEW_EMAIL webhook payload. Sent to your webhook url endpoint via HTTP POST when an email is received by the inbox that your webhook is attached to. Use the email ID to fetch the full email body or attachments.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookNewEmailPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookNewEmailPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'event_name' => 'string',
'webhook_name' => 'string',
'inbox_id' => 'string',
'domain_id' => 'string',
'email_id' => 'string',
'created_at' => '\DateTime',
'to' => 'string[]',
'from' => 'string',
'cc' => 'string[]',
'bcc' => 'string[]',
'subject' => 'string',
'attachment_meta_datas' => '\MailSlurp\Models\AttachmentMetaData[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'event_name' => null,
'webhook_name' => null,
'inbox_id' => 'uuid',
'domain_id' => 'uuid',
'email_id' => 'uuid',
'created_at' => 'date-time',
'to' => null,
'from' => null,
'cc' => null,
'bcc' => null,
'subject' => null,
'attachment_meta_datas' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'event_name' => false,
'webhook_name' => true,
'inbox_id' => false,
'domain_id' => true,
'email_id' => false,
'created_at' => false,
'to' => false,
'from' => false,
'cc' => false,
'bcc' => false,
'subject' => true,
'attachment_meta_datas' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'event_name' => 'eventName',
'webhook_name' => 'webhookName',
'inbox_id' => 'inboxId',
'domain_id' => 'domainId',
'email_id' => 'emailId',
'created_at' => 'createdAt',
'to' => 'to',
'from' => 'from',
'cc' => 'cc',
'bcc' => 'bcc',
'subject' => 'subject',
'attachment_meta_datas' => 'attachmentMetaDatas'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'event_name' => 'setEventName',
'webhook_name' => 'setWebhookName',
'inbox_id' => 'setInboxId',
'domain_id' => 'setDomainId',
'email_id' => 'setEmailId',
'created_at' => 'setCreatedAt',
'to' => 'setTo',
'from' => 'setFrom',
'cc' => 'setCc',
'bcc' => 'setBcc',
'subject' => 'setSubject',
'attachment_meta_datas' => 'setAttachmentMetaDatas'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'event_name' => 'getEventName',
'webhook_name' => 'getWebhookName',
'inbox_id' => 'getInboxId',
'domain_id' => 'getDomainId',
'email_id' => 'getEmailId',
'created_at' => 'getCreatedAt',
'to' => 'getTo',
'from' => 'getFrom',
'cc' => 'getCc',
'bcc' => 'getBcc',
'subject' => 'getSubject',
'attachment_meta_datas' => 'getAttachmentMetaDatas'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('email_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('attachment_meta_datas', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['email_id'] === null) {
$invalidProperties[] = "'email_id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
if ($this->container['from'] === null) {
$invalidProperties[] = "'from' can't be null";
}
if ($this->container['cc'] === null) {
$invalidProperties[] = "'cc' can't be null";
}
if ($this->container['bcc'] === null) {
$invalidProperties[] = "'bcc' can't be null";
}
if ($this->container['attachment_meta_datas'] === null) {
$invalidProperties[] = "'attachment_meta_datas' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Id of the inbox
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id Id of the domain that received an email
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets email_id
*
* @return string
*/
public function getEmailId()
{
return $this->container['email_id'];
}
/**
* Sets email_id
*
* @param string $email_id ID of the email that was received. Use this ID for fetching the email with the `EmailController`.
*
* @return self
*/
public function setEmailId($email_id)
{
if (is_null($email_id)) {
throw new \InvalidArgumentException('non-nullable email_id cannot be null');
}
$this->container['email_id'] = $email_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at Date time of event creation
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to List of `To` recipient email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets from
*
* @return string
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string $from Who the email was sent from. An email address - see fromName for the sender name.
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
throw new \InvalidArgumentException('non-nullable from cannot be null');
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets cc
*
* @return string[]
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[] $cc List of `CC` recipients email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
throw new \InvalidArgumentException('non-nullable cc cannot be null');
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets bcc
*
* @return string[]
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[] $bcc List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
throw new \InvalidArgumentException('non-nullable bcc cannot be null');
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject The subject line of the email message as specified by SMTP subject header
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets attachment_meta_datas
*
* @return \MailSlurp\Models\AttachmentMetaData[]
*/
public function getAttachmentMetaDatas()
{
return $this->container['attachment_meta_datas'];
}
/**
* Sets attachment_meta_datas
*
* @param \MailSlurp\Models\AttachmentMetaData[] $attachment_meta_datas List of attachment meta data objects if attachments present
*
* @return self
*/
public function setAttachmentMetaDatas($attachment_meta_datas)
{
if (is_null($attachment_meta_datas)) {
throw new \InvalidArgumentException('non-nullable attachment_meta_datas cannot be null');
}
$this->container['attachment_meta_datas'] = $attachment_meta_datas;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookNewContactPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookNewContactPayload Class Doc Comment
*
* @category Class
* @description NEW_CONTACT webhook payload. Sent to your webhook url endpoint via HTTP POST when an email is received by the inbox that your webhook is attached to that contains a recipient that has not been saved as a contact.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookNewContactPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookNewContactPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'webhook_name' => 'string',
'event_name' => 'string',
'contact_id' => 'string',
'group_id' => 'string',
'first_name' => 'string',
'last_name' => 'string',
'company' => 'string',
'primary_email_address' => 'string',
'email_addresses' => 'string[]',
'tags' => 'string[]',
'meta_data' => 'object',
'opt_out' => 'bool',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'webhook_name' => null,
'event_name' => null,
'contact_id' => 'uuid',
'group_id' => 'uuid',
'first_name' => null,
'last_name' => null,
'company' => null,
'primary_email_address' => null,
'email_addresses' => null,
'tags' => null,
'meta_data' => null,
'opt_out' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'webhook_name' => true,
'event_name' => false,
'contact_id' => false,
'group_id' => true,
'first_name' => true,
'last_name' => true,
'company' => true,
'primary_email_address' => true,
'email_addresses' => false,
'tags' => false,
'meta_data' => true,
'opt_out' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'webhook_name' => 'webhookName',
'event_name' => 'eventName',
'contact_id' => 'contactId',
'group_id' => 'groupId',
'first_name' => 'firstName',
'last_name' => 'lastName',
'company' => 'company',
'primary_email_address' => 'primaryEmailAddress',
'email_addresses' => 'emailAddresses',
'tags' => 'tags',
'meta_data' => 'metaData',
'opt_out' => 'optOut',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'webhook_name' => 'setWebhookName',
'event_name' => 'setEventName',
'contact_id' => 'setContactId',
'group_id' => 'setGroupId',
'first_name' => 'setFirstName',
'last_name' => 'setLastName',
'company' => 'setCompany',
'primary_email_address' => 'setPrimaryEmailAddress',
'email_addresses' => 'setEmailAddresses',
'tags' => 'setTags',
'meta_data' => 'setMetaData',
'opt_out' => 'setOptOut',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'webhook_name' => 'getWebhookName',
'event_name' => 'getEventName',
'contact_id' => 'getContactId',
'group_id' => 'getGroupId',
'first_name' => 'getFirstName',
'last_name' => 'getLastName',
'company' => 'getCompany',
'primary_email_address' => 'getPrimaryEmailAddress',
'email_addresses' => 'getEmailAddresses',
'tags' => 'getTags',
'meta_data' => 'getMetaData',
'opt_out' => 'getOptOut',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('contact_id', $data ?? [], null);
$this->setIfExists('group_id', $data ?? [], null);
$this->setIfExists('first_name', $data ?? [], null);
$this->setIfExists('last_name', $data ?? [], null);
$this->setIfExists('company', $data ?? [], null);
$this->setIfExists('primary_email_address', $data ?? [], null);
$this->setIfExists('email_addresses', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('meta_data', $data ?? [], null);
$this->setIfExists('opt_out', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['contact_id'] === null) {
$invalidProperties[] = "'contact_id' can't be null";
}
if ($this->container['email_addresses'] === null) {
$invalidProperties[] = "'email_addresses' can't be null";
}
if ($this->container['tags'] === null) {
$invalidProperties[] = "'tags' can't be null";
}
if ($this->container['opt_out'] === null) {
$invalidProperties[] = "'opt_out' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets contact_id
*
* @return string
*/
public function getContactId()
{
return $this->container['contact_id'];
}
/**
* Sets contact_id
*
* @param string $contact_id Contact ID
*
* @return self
*/
public function setContactId($contact_id)
{
if (is_null($contact_id)) {
throw new \InvalidArgumentException('non-nullable contact_id cannot be null');
}
$this->container['contact_id'] = $contact_id;
return $this;
}
/**
* Gets group_id
*
* @return string|null
*/
public function getGroupId()
{
return $this->container['group_id'];
}
/**
* Sets group_id
*
* @param string|null $group_id Contact group ID
*
* @return self
*/
public function setGroupId($group_id)
{
if (is_null($group_id)) {
array_push($this->openAPINullablesSetToNull, 'group_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('group_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['group_id'] = $group_id;
return $this;
}
/**
* Gets first_name
*
* @return string|null
*/
public function getFirstName()
{
return $this->container['first_name'];
}
/**
* Sets first_name
*
* @param string|null $first_name Contact first name
*
* @return self
*/
public function setFirstName($first_name)
{
if (is_null($first_name)) {
array_push($this->openAPINullablesSetToNull, 'first_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('first_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['first_name'] = $first_name;
return $this;
}
/**
* Gets last_name
*
* @return string|null
*/
public function getLastName()
{
return $this->container['last_name'];
}
/**
* Sets last_name
*
* @param string|null $last_name Contact last name
*
* @return self
*/
public function setLastName($last_name)
{
if (is_null($last_name)) {
array_push($this->openAPINullablesSetToNull, 'last_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('last_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['last_name'] = $last_name;
return $this;
}
/**
* Gets company
*
* @return string|null
*/
public function getCompany()
{
return $this->container['company'];
}
/**
* Sets company
*
* @param string|null $company Contact company name
*
* @return self
*/
public function setCompany($company)
{
if (is_null($company)) {
array_push($this->openAPINullablesSetToNull, 'company');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('company', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['company'] = $company;
return $this;
}
/**
* Gets primary_email_address
*
* @return string|null
*/
public function getPrimaryEmailAddress()
{
return $this->container['primary_email_address'];
}
/**
* Sets primary_email_address
*
* @param string|null $primary_email_address Primary email address for contact
*
* @return self
*/
public function setPrimaryEmailAddress($primary_email_address)
{
if (is_null($primary_email_address)) {
array_push($this->openAPINullablesSetToNull, 'primary_email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('primary_email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['primary_email_address'] = $primary_email_address;
return $this;
}
/**
* Gets email_addresses
*
* @return string[]
*/
public function getEmailAddresses()
{
return $this->container['email_addresses'];
}
/**
* Sets email_addresses
*
* @param string[] $email_addresses Email addresses for contact
*
* @return self
*/
public function setEmailAddresses($email_addresses)
{
if (is_null($email_addresses)) {
throw new \InvalidArgumentException('non-nullable email_addresses cannot be null');
}
$this->container['email_addresses'] = $email_addresses;
return $this;
}
/**
* Gets tags
*
* @return string[]
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[] $tags Tags for contact
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
throw new \InvalidArgumentException('non-nullable tags cannot be null');
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets meta_data
*
* @return object|null
*/
public function getMetaData()
{
return $this->container['meta_data'];
}
/**
* Sets meta_data
*
* @param object|null $meta_data meta_data
*
* @return self
*/
public function setMetaData($meta_data)
{
if (is_null($meta_data)) {
array_push($this->openAPINullablesSetToNull, 'meta_data');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('meta_data', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['meta_data'] = $meta_data;
return $this;
}
/**
* Gets opt_out
*
* @return bool
*/
public function getOptOut()
{
return $this->container['opt_out'];
}
/**
* Sets opt_out
*
* @param bool $opt_out Has contact opted out of emails
*
* @return self
*/
public function setOptOut($opt_out)
{
if (is_null($opt_out)) {
throw new \InvalidArgumentException('non-nullable opt_out cannot be null');
}
$this->container['opt_out'] = $opt_out;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at Date time of event creation
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookNewAttachmentPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookNewAttachmentPayload Class Doc Comment
*
* @category Class
* @description NEW_ATTACHMENT webhook payload. Sent to your webhook url endpoint via HTTP POST when an email is received by the inbox that your webhook is attached to that contains an attachment. You can use the attachmentId to download the attachment.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookNewAttachmentPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookNewAttachmentPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'webhook_name' => 'string',
'event_name' => 'string',
'attachment_id' => 'string',
'name' => 'string',
'content_type' => 'string',
'content_length' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'webhook_name' => null,
'event_name' => null,
'attachment_id' => null,
'name' => null,
'content_type' => null,
'content_length' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'webhook_name' => true,
'event_name' => false,
'attachment_id' => false,
'name' => false,
'content_type' => false,
'content_length' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'webhook_name' => 'webhookName',
'event_name' => 'eventName',
'attachment_id' => 'attachmentId',
'name' => 'name',
'content_type' => 'contentType',
'content_length' => 'contentLength'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'webhook_name' => 'setWebhookName',
'event_name' => 'setEventName',
'attachment_id' => 'setAttachmentId',
'name' => 'setName',
'content_type' => 'setContentType',
'content_length' => 'setContentLength'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'webhook_name' => 'getWebhookName',
'event_name' => 'getEventName',
'attachment_id' => 'getAttachmentId',
'name' => 'getName',
'content_type' => 'getContentType',
'content_length' => 'getContentLength'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('attachment_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('content_type', $data ?? [], null);
$this->setIfExists('content_length', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['attachment_id'] === null) {
$invalidProperties[] = "'attachment_id' can't be null";
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['content_type'] === null) {
$invalidProperties[] = "'content_type' can't be null";
}
if ($this->container['content_length'] === null) {
$invalidProperties[] = "'content_length' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets attachment_id
*
* @return string
*/
public function getAttachmentId()
{
return $this->container['attachment_id'];
}
/**
* Sets attachment_id
*
* @param string $attachment_id ID of attachment. Use the `AttachmentController` to
*
* @return self
*/
public function setAttachmentId($attachment_id)
{
if (is_null($attachment_id)) {
throw new \InvalidArgumentException('non-nullable attachment_id cannot be null');
}
$this->container['attachment_id'] = $attachment_id;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name Filename of the attachment if present
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets content_type
*
* @return string
*/
public function getContentType()
{
return $this->container['content_type'];
}
/**
* Sets content_type
*
* @param string $content_type Content type of attachment such as 'image/png' or 'application/pdf
*
* @return self
*/
public function setContentType($content_type)
{
if (is_null($content_type)) {
throw new \InvalidArgumentException('non-nullable content_type cannot be null');
}
$this->container['content_type'] = $content_type;
return $this;
}
/**
* Gets content_length
*
* @return int
*/
public function getContentLength()
{
return $this->container['content_length'];
}
/**
* Sets content_length
*
* @param int $content_length Size of attachment in bytes
*
* @return self
*/
public function setContentLength($content_length)
{
if (is_null($content_length)) {
throw new \InvalidArgumentException('non-nullable content_length cannot be null');
}
$this->container['content_length'] = $content_length;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookHeaders
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookHeaders Class Doc Comment
*
* @category Class
* @description Webhook HTTP headers to include with each request from MailSlurp to your server
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookHeaders implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookHeaders';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'headers' => '\MailSlurp\Models\WebhookHeaderNameValue[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'headers' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'headers' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'headers' => 'headers'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'headers' => 'setHeaders'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'headers' => 'getHeaders'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('headers', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['headers'] === null) {
$invalidProperties[] = "'headers' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets headers
*
* @return \MailSlurp\Models\WebhookHeaderNameValue[]
*/
public function getHeaders()
{
return $this->container['headers'];
}
/**
* Sets headers
*
* @param \MailSlurp\Models\WebhookHeaderNameValue[] $headers List of header name value pairs to include with webhook requests
*
* @return self
*/
public function setHeaders($headers)
{
if (is_null($headers)) {
throw new \InvalidArgumentException('non-nullable headers cannot be null');
}
$this->container['headers'] = $headers;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookHeaderNameValue
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookHeaderNameValue Class Doc Comment
*
* @category Class
* @description Name value pair for webhook header
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookHeaderNameValue implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookHeaderNameValue';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name Name of header
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value Value of header
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookEmailReadPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookEmailReadPayload Class Doc Comment
*
* @category Class
* @description EMAIL_READ webhook payload. Sent to your webhook url endpoint via HTTP POST when an email is read. This happens when an email is requested in full from the API or a user views the email in the dashboard.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookEmailReadPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookEmailReadPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'event_name' => 'string',
'webhook_name' => 'string',
'email_id' => 'string',
'inbox_id' => 'string',
'email_is_read' => 'bool',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'event_name' => null,
'webhook_name' => null,
'email_id' => 'uuid',
'inbox_id' => 'uuid',
'email_is_read' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'event_name' => false,
'webhook_name' => true,
'email_id' => false,
'inbox_id' => false,
'email_is_read' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'event_name' => 'eventName',
'webhook_name' => 'webhookName',
'email_id' => 'emailId',
'inbox_id' => 'inboxId',
'email_is_read' => 'emailIsRead',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'event_name' => 'setEventName',
'webhook_name' => 'setWebhookName',
'email_id' => 'setEmailId',
'inbox_id' => 'setInboxId',
'email_is_read' => 'setEmailIsRead',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'event_name' => 'getEventName',
'webhook_name' => 'getWebhookName',
'email_id' => 'getEmailId',
'inbox_id' => 'getInboxId',
'email_is_read' => 'getEmailIsRead',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('email_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('email_is_read', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['email_id'] === null) {
$invalidProperties[] = "'email_id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['email_is_read'] === null) {
$invalidProperties[] = "'email_is_read' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets email_id
*
* @return string
*/
public function getEmailId()
{
return $this->container['email_id'];
}
/**
* Sets email_id
*
* @param string $email_id ID of the email that was received. Use this ID for fetching the email with the `EmailController`.
*
* @return self
*/
public function setEmailId($email_id)
{
if (is_null($email_id)) {
throw new \InvalidArgumentException('non-nullable email_id cannot be null');
}
$this->container['email_id'] = $email_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Id of the inbox
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets email_is_read
*
* @return bool
*/
public function getEmailIsRead()
{
return $this->container['email_is_read'];
}
/**
* Sets email_is_read
*
* @param bool $email_is_read Is the email read
*
* @return self
*/
public function setEmailIsRead($email_is_read)
{
if (is_null($email_is_read)) {
throw new \InvalidArgumentException('non-nullable email_is_read cannot be null');
}
$this->container['email_is_read'] = $email_is_read;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at Date time of event creation
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookEmailOpenedPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookEmailOpenedPayload Class Doc Comment
*
* @category Class
* @description EMAIL_OPENED webhook payload. Sent to your webhook url endpoint via HTTP POST when an email containing a tracking pixel is opened and the pixel image is loaded by a reader.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookEmailOpenedPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookEmailOpenedPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'event_name' => 'string',
'webhook_name' => 'string',
'inbox_id' => 'string',
'pixel_id' => 'string',
'sent_email_id' => 'string',
'recipient' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'event_name' => null,
'webhook_name' => null,
'inbox_id' => 'uuid',
'pixel_id' => 'uuid',
'sent_email_id' => 'uuid',
'recipient' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'event_name' => false,
'webhook_name' => true,
'inbox_id' => false,
'pixel_id' => false,
'sent_email_id' => false,
'recipient' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'event_name' => 'eventName',
'webhook_name' => 'webhookName',
'inbox_id' => 'inboxId',
'pixel_id' => 'pixelId',
'sent_email_id' => 'sentEmailId',
'recipient' => 'recipient',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'event_name' => 'setEventName',
'webhook_name' => 'setWebhookName',
'inbox_id' => 'setInboxId',
'pixel_id' => 'setPixelId',
'sent_email_id' => 'setSentEmailId',
'recipient' => 'setRecipient',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'event_name' => 'getEventName',
'webhook_name' => 'getWebhookName',
'inbox_id' => 'getInboxId',
'pixel_id' => 'getPixelId',
'sent_email_id' => 'getSentEmailId',
'recipient' => 'getRecipient',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('pixel_id', $data ?? [], null);
$this->setIfExists('sent_email_id', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['pixel_id'] === null) {
$invalidProperties[] = "'pixel_id' can't be null";
}
if ($this->container['sent_email_id'] === null) {
$invalidProperties[] = "'sent_email_id' can't be null";
}
if ($this->container['recipient'] === null) {
$invalidProperties[] = "'recipient' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Id of the inbox
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets pixel_id
*
* @return string
*/
public function getPixelId()
{
return $this->container['pixel_id'];
}
/**
* Sets pixel_id
*
* @param string $pixel_id ID of the tracking pixel
*
* @return self
*/
public function setPixelId($pixel_id)
{
if (is_null($pixel_id)) {
throw new \InvalidArgumentException('non-nullable pixel_id cannot be null');
}
$this->container['pixel_id'] = $pixel_id;
return $this;
}
/**
* Gets sent_email_id
*
* @return string
*/
public function getSentEmailId()
{
return $this->container['sent_email_id'];
}
/**
* Sets sent_email_id
*
* @param string $sent_email_id ID of sent email
*
* @return self
*/
public function setSentEmailId($sent_email_id)
{
if (is_null($sent_email_id)) {
throw new \InvalidArgumentException('non-nullable sent_email_id cannot be null');
}
$this->container['sent_email_id'] = $sent_email_id;
return $this;
}
/**
* Gets recipient
*
* @return string
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string $recipient Email address for the recipient of the tracking pixel
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
throw new \InvalidArgumentException('non-nullable recipient cannot be null');
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at Date time of event creation
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookDto Class Doc Comment
*
* @category Class
* @description Representation of a webhook for an inbox. The URL specified will be using by MailSlurp whenever an email is received by the attached inbox. A webhook entity should have a URL that points to your server. Your server should accept HTTP/S POST requests and return a success 200. MailSlurp will retry your webhooks if they fail. See https://php.api.mailslurp.com/schemas/webhook-payload for the payload schema.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'basic_auth' => 'bool',
'name' => 'string',
'phone_id' => 'string',
'inbox_id' => 'string',
'request_body_template' => 'string',
'url' => 'string',
'method' => 'string',
'payload_json_schema' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'event_name' => 'string',
'request_headers' => '\MailSlurp\Models\WebhookHeaders',
'ignore_insecure_ssl_certificates' => 'bool',
'use_static_ip_range' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'basic_auth' => null,
'name' => null,
'phone_id' => 'uuid',
'inbox_id' => 'uuid',
'request_body_template' => null,
'url' => null,
'method' => null,
'payload_json_schema' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time',
'event_name' => null,
'request_headers' => null,
'ignore_insecure_ssl_certificates' => null,
'use_static_ip_range' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'basic_auth' => false,
'name' => true,
'phone_id' => true,
'inbox_id' => true,
'request_body_template' => true,
'url' => false,
'method' => false,
'payload_json_schema' => false,
'created_at' => true,
'updated_at' => false,
'event_name' => true,
'request_headers' => false,
'ignore_insecure_ssl_certificates' => true,
'use_static_ip_range' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'basic_auth' => 'basicAuth',
'name' => 'name',
'phone_id' => 'phoneId',
'inbox_id' => 'inboxId',
'request_body_template' => 'requestBodyTemplate',
'url' => 'url',
'method' => 'method',
'payload_json_schema' => 'payloadJsonSchema',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'event_name' => 'eventName',
'request_headers' => 'requestHeaders',
'ignore_insecure_ssl_certificates' => 'ignoreInsecureSslCertificates',
'use_static_ip_range' => 'useStaticIpRange'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'basic_auth' => 'setBasicAuth',
'name' => 'setName',
'phone_id' => 'setPhoneId',
'inbox_id' => 'setInboxId',
'request_body_template' => 'setRequestBodyTemplate',
'url' => 'setUrl',
'method' => 'setMethod',
'payload_json_schema' => 'setPayloadJsonSchema',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'event_name' => 'setEventName',
'request_headers' => 'setRequestHeaders',
'ignore_insecure_ssl_certificates' => 'setIgnoreInsecureSslCertificates',
'use_static_ip_range' => 'setUseStaticIpRange'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'basic_auth' => 'getBasicAuth',
'name' => 'getName',
'phone_id' => 'getPhoneId',
'inbox_id' => 'getInboxId',
'request_body_template' => 'getRequestBodyTemplate',
'url' => 'getUrl',
'method' => 'getMethod',
'payload_json_schema' => 'getPayloadJsonSchema',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'event_name' => 'getEventName',
'request_headers' => 'getRequestHeaders',
'ignore_insecure_ssl_certificates' => 'getIgnoreInsecureSslCertificates',
'use_static_ip_range' => 'getUseStaticIpRange'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const METHOD_POST = 'POST';
public const METHOD_DELETE = 'DELETE';
public const METHOD_GET = 'GET';
public const METHOD_PUT = 'PUT';
public const METHOD_PATCH = 'PATCH';
public const METHOD_HEAD = 'HEAD';
public const METHOD_OPTIONS = 'OPTIONS';
public const METHOD_TRACE = 'TRACE';
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getMethodAllowableValues()
{
return [
self::METHOD_POST,
self::METHOD_DELETE,
self::METHOD_GET,
self::METHOD_PUT,
self::METHOD_PATCH,
self::METHOD_HEAD,
self::METHOD_OPTIONS,
self::METHOD_TRACE,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('basic_auth', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('phone_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('request_body_template', $data ?? [], null);
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('method', $data ?? [], null);
$this->setIfExists('payload_json_schema', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('request_headers', $data ?? [], null);
$this->setIfExists('ignore_insecure_ssl_certificates', $data ?? [], null);
$this->setIfExists('use_static_ip_range', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['basic_auth'] === null) {
$invalidProperties[] = "'basic_auth' can't be null";
}
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
if ($this->container['method'] === null) {
$invalidProperties[] = "'method' can't be null";
}
$allowedValues = $this->getMethodAllowableValues();
if (!is_null($this->container['method']) && !in_array($this->container['method'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'method', must be one of '%s'",
$this->container['method'],
implode("', '", $allowedValues)
);
}
if ($this->container['payload_json_schema'] === null) {
$invalidProperties[] = "'payload_json_schema' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of the Webhook
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id User ID of the Webhook
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets basic_auth
*
* @return bool
*/
public function getBasicAuth()
{
return $this->container['basic_auth'];
}
/**
* Sets basic_auth
*
* @param bool $basic_auth Does webhook expect basic authentication? If true it means you created this webhook with a username and password. MailSlurp will use these in the URL to authenticate itself.
*
* @return self
*/
public function setBasicAuth($basic_auth)
{
if (is_null($basic_auth)) {
throw new \InvalidArgumentException('non-nullable basic_auth cannot be null');
}
$this->container['basic_auth'] = $basic_auth;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of the webhook
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets phone_id
*
* @return string|null
*/
public function getPhoneId()
{
return $this->container['phone_id'];
}
/**
* Sets phone_id
*
* @param string|null $phone_id The phoneNumberId that the Webhook will be triggered by. If null then webhook triggered at account level or inbox level if inboxId set
*
* @return self
*/
public function setPhoneId($phone_id)
{
if (is_null($phone_id)) {
array_push($this->openAPINullablesSetToNull, 'phone_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('phone_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['phone_id'] = $phone_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id The inbox that the Webhook will be triggered by. If null then webhook triggered at account level or phone level if phoneId set
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets request_body_template
*
* @return string|null
*/
public function getRequestBodyTemplate()
{
return $this->container['request_body_template'];
}
/**
* Sets request_body_template
*
* @param string|null $request_body_template Request body template for HTTP request that will be sent for the webhook. Use Moustache style template variables to insert values from the original event payload.
*
* @return self
*/
public function setRequestBodyTemplate($request_body_template)
{
if (is_null($request_body_template)) {
array_push($this->openAPINullablesSetToNull, 'request_body_template');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('request_body_template', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['request_body_template'] = $request_body_template;
return $this;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url URL of your server that the webhook will be sent to. The schema of the JSON that is sent is described by the payloadJsonSchema.
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets method
*
* @return string
*/
public function getMethod()
{
return $this->container['method'];
}
/**
* Sets method
*
* @param string $method HTTP method that your server endpoint must listen for
*
* @return self
*/
public function setMethod($method)
{
$allowedValues = $this->getMethodAllowableValues();
if (!in_array($method, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'method', must be one of '%s'",
$method,
implode("', '", $allowedValues)
)
);
}
if (is_null($method)) {
throw new \InvalidArgumentException('non-nullable method cannot be null');
}
$this->container['method'] = $method;
return $this;
}
/**
* Gets payload_json_schema
*
* @return string
*/
public function getPayloadJsonSchema()
{
return $this->container['payload_json_schema'];
}
/**
* Sets payload_json_schema
*
* @param string $payload_json_schema Deprecated. Fetch JSON Schema for webhook using the getJsonSchemaForWebhookPayload method
*
* @return self
*/
public function setPayloadJsonSchema($payload_json_schema)
{
if (is_null($payload_json_schema)) {
throw new \InvalidArgumentException('non-nullable payload_json_schema cannot be null');
}
$this->container['payload_json_schema'] = $payload_json_schema;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at When the webhook was created
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
array_push($this->openAPINullablesSetToNull, 'created_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('created_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets event_name
*
* @return string|null
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string|null $event_name Webhook trigger event name
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($event_name) && !in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
array_push($this->openAPINullablesSetToNull, 'event_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('event_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets request_headers
*
* @return \MailSlurp\Models\WebhookHeaders|null
*/
public function getRequestHeaders()
{
return $this->container['request_headers'];
}
/**
* Sets request_headers
*
* @param \MailSlurp\Models\WebhookHeaders|null $request_headers request_headers
*
* @return self
*/
public function setRequestHeaders($request_headers)
{
if (is_null($request_headers)) {
throw new \InvalidArgumentException('non-nullable request_headers cannot be null');
}
$this->container['request_headers'] = $request_headers;
return $this;
}
/**
* Gets ignore_insecure_ssl_certificates
*
* @return bool|null
*/
public function getIgnoreInsecureSslCertificates()
{
return $this->container['ignore_insecure_ssl_certificates'];
}
/**
* Sets ignore_insecure_ssl_certificates
*
* @param bool|null $ignore_insecure_ssl_certificates Should notifier ignore insecure SSL certificates
*
* @return self
*/
public function setIgnoreInsecureSslCertificates($ignore_insecure_ssl_certificates)
{
if (is_null($ignore_insecure_ssl_certificates)) {
array_push($this->openAPINullablesSetToNull, 'ignore_insecure_ssl_certificates');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('ignore_insecure_ssl_certificates', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['ignore_insecure_ssl_certificates'] = $ignore_insecure_ssl_certificates;
return $this;
}
/**
* Gets use_static_ip_range
*
* @return bool|null
*/
public function getUseStaticIpRange()
{
return $this->container['use_static_ip_range'];
}
/**
* Sets use_static_ip_range
*
* @param bool|null $use_static_ip_range Should notifier use static IP range when sending webhook payload
*
* @return self
*/
public function setUseStaticIpRange($use_static_ip_range)
{
if (is_null($use_static_ip_range)) {
array_push($this->openAPINullablesSetToNull, 'use_static_ip_range');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_static_ip_range', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_static_ip_range'] = $use_static_ip_range;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookDeliveryStatusPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookDeliveryStatusPayload Class Doc Comment
*
* @category Class
* @description DELIVERY_STATUS webhook payload. Sent to your webhook url endpoint via HTTP POST when an email delivery status is created. This could be a successful delivery or a delivery failure.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookDeliveryStatusPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookDeliveryStatusPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'event_name' => 'string',
'webhook_name' => 'string',
'id' => 'string',
'user_id' => 'string',
'sent_id' => 'string',
'remote_mta_ip' => 'string',
'inbox_id' => 'string',
'reporting_mta' => 'string',
'recipients' => 'string[]',
'smtp_response' => 'string',
'smtp_status_code' => 'int',
'processing_time_millis' => 'int',
'received' => '\DateTime',
'subject' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'event_name' => null,
'webhook_name' => null,
'id' => 'uuid',
'user_id' => 'uuid',
'sent_id' => 'uuid',
'remote_mta_ip' => null,
'inbox_id' => 'uuid',
'reporting_mta' => null,
'recipients' => null,
'smtp_response' => null,
'smtp_status_code' => 'int32',
'processing_time_millis' => 'int64',
'received' => 'date-time',
'subject' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'event_name' => false,
'webhook_name' => true,
'id' => false,
'user_id' => false,
'sent_id' => true,
'remote_mta_ip' => true,
'inbox_id' => true,
'reporting_mta' => true,
'recipients' => true,
'smtp_response' => true,
'smtp_status_code' => true,
'processing_time_millis' => true,
'received' => true,
'subject' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'event_name' => 'eventName',
'webhook_name' => 'webhookName',
'id' => 'id',
'user_id' => 'userId',
'sent_id' => 'sentId',
'remote_mta_ip' => 'remoteMtaIp',
'inbox_id' => 'inboxId',
'reporting_mta' => 'reportingMta',
'recipients' => 'recipients',
'smtp_response' => 'smtpResponse',
'smtp_status_code' => 'smtpStatusCode',
'processing_time_millis' => 'processingTimeMillis',
'received' => 'received',
'subject' => 'subject'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'event_name' => 'setEventName',
'webhook_name' => 'setWebhookName',
'id' => 'setId',
'user_id' => 'setUserId',
'sent_id' => 'setSentId',
'remote_mta_ip' => 'setRemoteMtaIp',
'inbox_id' => 'setInboxId',
'reporting_mta' => 'setReportingMta',
'recipients' => 'setRecipients',
'smtp_response' => 'setSmtpResponse',
'smtp_status_code' => 'setSmtpStatusCode',
'processing_time_millis' => 'setProcessingTimeMillis',
'received' => 'setReceived',
'subject' => 'setSubject'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'event_name' => 'getEventName',
'webhook_name' => 'getWebhookName',
'id' => 'getId',
'user_id' => 'getUserId',
'sent_id' => 'getSentId',
'remote_mta_ip' => 'getRemoteMtaIp',
'inbox_id' => 'getInboxId',
'reporting_mta' => 'getReportingMta',
'recipients' => 'getRecipients',
'smtp_response' => 'getSmtpResponse',
'smtp_status_code' => 'getSmtpStatusCode',
'processing_time_millis' => 'getProcessingTimeMillis',
'received' => 'getReceived',
'subject' => 'getSubject'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('sent_id', $data ?? [], null);
$this->setIfExists('remote_mta_ip', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('reporting_mta', $data ?? [], null);
$this->setIfExists('recipients', $data ?? [], null);
$this->setIfExists('smtp_response', $data ?? [], null);
$this->setIfExists('smtp_status_code', $data ?? [], null);
$this->setIfExists('processing_time_millis', $data ?? [], null);
$this->setIfExists('received', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of delivery status
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id User ID of event
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets sent_id
*
* @return string|null
*/
public function getSentId()
{
return $this->container['sent_id'];
}
/**
* Sets sent_id
*
* @param string|null $sent_id ID of sent email
*
* @return self
*/
public function setSentId($sent_id)
{
if (is_null($sent_id)) {
array_push($this->openAPINullablesSetToNull, 'sent_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_id'] = $sent_id;
return $this;
}
/**
* Gets remote_mta_ip
*
* @return string|null
*/
public function getRemoteMtaIp()
{
return $this->container['remote_mta_ip'];
}
/**
* Sets remote_mta_ip
*
* @param string|null $remote_mta_ip IP address of the remote Mail Transfer Agent
*
* @return self
*/
public function setRemoteMtaIp($remote_mta_ip)
{
if (is_null($remote_mta_ip)) {
array_push($this->openAPINullablesSetToNull, 'remote_mta_ip');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('remote_mta_ip', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['remote_mta_ip'] = $remote_mta_ip;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id Id of the inbox
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets reporting_mta
*
* @return string|null
*/
public function getReportingMta()
{
return $this->container['reporting_mta'];
}
/**
* Sets reporting_mta
*
* @param string|null $reporting_mta Mail Transfer Agent reporting delivery status
*
* @return self
*/
public function setReportingMta($reporting_mta)
{
if (is_null($reporting_mta)) {
array_push($this->openAPINullablesSetToNull, 'reporting_mta');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reporting_mta', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reporting_mta'] = $reporting_mta;
return $this;
}
/**
* Gets recipients
*
* @return string[]|null
*/
public function getRecipients()
{
return $this->container['recipients'];
}
/**
* Sets recipients
*
* @param string[]|null $recipients Recipients for delivery
*
* @return self
*/
public function setRecipients($recipients)
{
if (is_null($recipients)) {
array_push($this->openAPINullablesSetToNull, 'recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['recipients'] = $recipients;
return $this;
}
/**
* Gets smtp_response
*
* @return string|null
*/
public function getSmtpResponse()
{
return $this->container['smtp_response'];
}
/**
* Sets smtp_response
*
* @param string|null $smtp_response SMTP server response message
*
* @return self
*/
public function setSmtpResponse($smtp_response)
{
if (is_null($smtp_response)) {
array_push($this->openAPINullablesSetToNull, 'smtp_response');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('smtp_response', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['smtp_response'] = $smtp_response;
return $this;
}
/**
* Gets smtp_status_code
*
* @return int|null
*/
public function getSmtpStatusCode()
{
return $this->container['smtp_status_code'];
}
/**
* Sets smtp_status_code
*
* @param int|null $smtp_status_code SMTP server status
*
* @return self
*/
public function setSmtpStatusCode($smtp_status_code)
{
if (is_null($smtp_status_code)) {
array_push($this->openAPINullablesSetToNull, 'smtp_status_code');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('smtp_status_code', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['smtp_status_code'] = $smtp_status_code;
return $this;
}
/**
* Gets processing_time_millis
*
* @return int|null
*/
public function getProcessingTimeMillis()
{
return $this->container['processing_time_millis'];
}
/**
* Sets processing_time_millis
*
* @param int|null $processing_time_millis Time in milliseconds for delivery processing
*
* @return self
*/
public function setProcessingTimeMillis($processing_time_millis)
{
if (is_null($processing_time_millis)) {
array_push($this->openAPINullablesSetToNull, 'processing_time_millis');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('processing_time_millis', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['processing_time_millis'] = $processing_time_millis;
return $this;
}
/**
* Gets received
*
* @return \DateTime|null
*/
public function getReceived()
{
return $this->container['received'];
}
/**
* Sets received
*
* @param \DateTime|null $received Time event was received
*
* @return self
*/
public function setReceived($received)
{
if (is_null($received)) {
array_push($this->openAPINullablesSetToNull, 'received');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('received', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['received'] = $received;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject Email subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookBounceRecipientPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookBounceRecipientPayload Class Doc Comment
*
* @category Class
* @description BOUNCE_RECIPIENT webhook payload. Sent to your webhook url endpoint via HTTP POST when an email caused a bounce to occur for a recipient. Save the recipient to a ban list of your server and avoid email them again.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookBounceRecipientPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookBounceRecipientPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'event_name' => 'string',
'webhook_name' => 'string',
'recipient' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'event_name' => null,
'webhook_name' => null,
'recipient' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'event_name' => false,
'webhook_name' => true,
'recipient' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'event_name' => 'eventName',
'webhook_name' => 'webhookName',
'recipient' => 'recipient'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'event_name' => 'setEventName',
'webhook_name' => 'setWebhookName',
'recipient' => 'setRecipient'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'event_name' => 'getEventName',
'webhook_name' => 'getWebhookName',
'recipient' => 'getRecipient'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['recipient'] === null) {
$invalidProperties[] = "'recipient' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets recipient
*
* @return string
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string $recipient Email address that caused a bounce. Make note of the address and try not to message it again to preserve your reputation.
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
throw new \InvalidArgumentException('non-nullable recipient cannot be null');
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WebhookBouncePayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WebhookBouncePayload Class Doc Comment
*
* @category Class
* @description BOUNCE webhook payload. Sent to your webhook url endpoint via HTTP POST when an email bounced or was rejected by a recipient. Save the recipients to a ban list on your server and avoid emailing them again. It is recommended you also listen to the BOUNCE_RECIPIENT payload.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WebhookBouncePayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WebhookBouncePayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'webhook_id' => 'string',
'event_name' => 'string',
'webhook_name' => 'string',
'bounce_id' => 'string',
'sent_to_recipients' => 'string[]',
'sender' => 'string',
'bounce_recipients' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'webhook_id' => 'uuid',
'event_name' => null,
'webhook_name' => null,
'bounce_id' => 'uuid',
'sent_to_recipients' => null,
'sender' => null,
'bounce_recipients' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'webhook_id' => false,
'event_name' => false,
'webhook_name' => true,
'bounce_id' => false,
'sent_to_recipients' => true,
'sender' => false,
'bounce_recipients' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'event_name' => 'eventName',
'webhook_name' => 'webhookName',
'bounce_id' => 'bounceId',
'sent_to_recipients' => 'sentToRecipients',
'sender' => 'sender',
'bounce_recipients' => 'bounceRecipients'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'event_name' => 'setEventName',
'webhook_name' => 'setWebhookName',
'bounce_id' => 'setBounceId',
'sent_to_recipients' => 'setSentToRecipients',
'sender' => 'setSender',
'bounce_recipients' => 'setBounceRecipients'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'event_name' => 'getEventName',
'webhook_name' => 'getWebhookName',
'bounce_id' => 'getBounceId',
'sent_to_recipients' => 'getSentToRecipients',
'sender' => 'getSender',
'bounce_recipients' => 'getBounceRecipients'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
$this->setIfExists('bounce_id', $data ?? [], null);
$this->setIfExists('sent_to_recipients', $data ?? [], null);
$this->setIfExists('sender', $data ?? [], null);
$this->setIfExists('bounce_recipients', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['bounce_id'] === null) {
$invalidProperties[] = "'bounce_id' can't be null";
}
if ($this->container['sender'] === null) {
$invalidProperties[] = "'sender' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id Idempotent message ID. Store this ID locally or in a database to prevent message duplication.
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id ID of webhook entity being triggered
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name Name of the event type webhook is being triggered for.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name Name of the webhook being triggered
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
array_push($this->openAPINullablesSetToNull, 'webhook_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('webhook_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Gets bounce_id
*
* @return string
*/
public function getBounceId()
{
return $this->container['bounce_id'];
}
/**
* Sets bounce_id
*
* @param string $bounce_id ID of the bounce email record. Use the ID with the bounce controller to view more information
*
* @return self
*/
public function setBounceId($bounce_id)
{
if (is_null($bounce_id)) {
throw new \InvalidArgumentException('non-nullable bounce_id cannot be null');
}
$this->container['bounce_id'] = $bounce_id;
return $this;
}
/**
* Gets sent_to_recipients
*
* @return string[]|null
*/
public function getSentToRecipients()
{
return $this->container['sent_to_recipients'];
}
/**
* Sets sent_to_recipients
*
* @param string[]|null $sent_to_recipients Email sent to recipients
*
* @return self
*/
public function setSentToRecipients($sent_to_recipients)
{
if (is_null($sent_to_recipients)) {
array_push($this->openAPINullablesSetToNull, 'sent_to_recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_to_recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_to_recipients'] = $sent_to_recipients;
return $this;
}
/**
* Gets sender
*
* @return string
*/
public function getSender()
{
return $this->container['sender'];
}
/**
* Sets sender
*
* @param string $sender Sender causing bounce
*
* @return self
*/
public function setSender($sender)
{
if (is_null($sender)) {
throw new \InvalidArgumentException('non-nullable sender cannot be null');
}
$this->container['sender'] = $sender;
return $this;
}
/**
* Gets bounce_recipients
*
* @return string[]|null
*/
public function getBounceRecipients()
{
return $this->container['bounce_recipients'];
}
/**
* Sets bounce_recipients
*
* @param string[]|null $bounce_recipients Email addresses that resulted in a bounce or email being rejected. Please save these recipients and avoid emailing them in the future to maintain your reputation.
*
* @return self
*/
public function setBounceRecipients($bounce_recipients)
{
if (is_null($bounce_recipients)) {
array_push($this->openAPINullablesSetToNull, 'bounce_recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_recipients'] = $bounce_recipients;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WaitForSmsConditions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WaitForSmsConditions Class Doc Comment
*
* @category Class
* @description Conditions to apply to emails that you are waiting for
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WaitForSmsConditions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WaitForSmsConditions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'phone_number_id' => 'string',
'limit' => 'int',
'count' => 'int',
'delay_timeout' => 'int',
'timeout' => 'int',
'unread_only' => 'bool',
'count_type' => 'string',
'matches' => '\MailSlurp\Models\SmsMatchOption[]',
'sort_direction' => 'string',
'since' => '\DateTime',
'before' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'phone_number_id' => 'uuid',
'limit' => 'int32',
'count' => 'int64',
'delay_timeout' => 'int64',
'timeout' => 'int64',
'unread_only' => null,
'count_type' => null,
'matches' => null,
'sort_direction' => null,
'since' => 'date-time',
'before' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'phone_number_id' => false,
'limit' => true,
'count' => false,
'delay_timeout' => true,
'timeout' => false,
'unread_only' => true,
'count_type' => true,
'matches' => true,
'sort_direction' => true,
'since' => true,
'before' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'phone_number_id' => 'phoneNumberId',
'limit' => 'limit',
'count' => 'count',
'delay_timeout' => 'delayTimeout',
'timeout' => 'timeout',
'unread_only' => 'unreadOnly',
'count_type' => 'countType',
'matches' => 'matches',
'sort_direction' => 'sortDirection',
'since' => 'since',
'before' => 'before'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'phone_number_id' => 'setPhoneNumberId',
'limit' => 'setLimit',
'count' => 'setCount',
'delay_timeout' => 'setDelayTimeout',
'timeout' => 'setTimeout',
'unread_only' => 'setUnreadOnly',
'count_type' => 'setCountType',
'matches' => 'setMatches',
'sort_direction' => 'setSortDirection',
'since' => 'setSince',
'before' => 'setBefore'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'phone_number_id' => 'getPhoneNumberId',
'limit' => 'getLimit',
'count' => 'getCount',
'delay_timeout' => 'getDelayTimeout',
'timeout' => 'getTimeout',
'unread_only' => 'getUnreadOnly',
'count_type' => 'getCountType',
'matches' => 'getMatches',
'sort_direction' => 'getSortDirection',
'since' => 'getSince',
'before' => 'getBefore'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const COUNT_TYPE_EXACTLY = 'EXACTLY';
public const COUNT_TYPE_ATLEAST = 'ATLEAST';
public const SORT_DIRECTION_ASC = 'ASC';
public const SORT_DIRECTION_DESC = 'DESC';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getCountTypeAllowableValues()
{
return [
self::COUNT_TYPE_EXACTLY,
self::COUNT_TYPE_ATLEAST,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSortDirectionAllowableValues()
{
return [
self::SORT_DIRECTION_ASC,
self::SORT_DIRECTION_DESC,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('phone_number_id', $data ?? [], null);
$this->setIfExists('limit', $data ?? [], null);
$this->setIfExists('count', $data ?? [], null);
$this->setIfExists('delay_timeout', $data ?? [], null);
$this->setIfExists('timeout', $data ?? [], null);
$this->setIfExists('unread_only', $data ?? [], null);
$this->setIfExists('count_type', $data ?? [], null);
$this->setIfExists('matches', $data ?? [], null);
$this->setIfExists('sort_direction', $data ?? [], null);
$this->setIfExists('since', $data ?? [], null);
$this->setIfExists('before', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['phone_number_id'] === null) {
$invalidProperties[] = "'phone_number_id' can't be null";
}
if ($this->container['count'] === null) {
$invalidProperties[] = "'count' can't be null";
}
if ($this->container['timeout'] === null) {
$invalidProperties[] = "'timeout' can't be null";
}
$allowedValues = $this->getCountTypeAllowableValues();
if (!is_null($this->container['count_type']) && !in_array($this->container['count_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'count_type', must be one of '%s'",
$this->container['count_type'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sort_direction', must be one of '%s'",
$this->container['sort_direction'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets phone_number_id
*
* @return string
*/
public function getPhoneNumberId()
{
return $this->container['phone_number_id'];
}
/**
* Sets phone_number_id
*
* @param string $phone_number_id ID of phone number to search within and apply conditions to. Essentially filtering the SMS found to give a count.
*
* @return self
*/
public function setPhoneNumberId($phone_number_id)
{
if (is_null($phone_number_id)) {
throw new \InvalidArgumentException('non-nullable phone_number_id cannot be null');
}
$this->container['phone_number_id'] = $phone_number_id;
return $this;
}
/**
* Gets limit
*
* @return int|null
*/
public function getLimit()
{
return $this->container['limit'];
}
/**
* Sets limit
*
* @param int|null $limit Limit results
*
* @return self
*/
public function setLimit($limit)
{
if (is_null($limit)) {
array_push($this->openAPINullablesSetToNull, 'limit');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('limit', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['limit'] = $limit;
return $this;
}
/**
* Gets count
*
* @return int
*/
public function getCount()
{
return $this->container['count'];
}
/**
* Sets count
*
* @param int $count Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation.
*
* @return self
*/
public function setCount($count)
{
if (is_null($count)) {
throw new \InvalidArgumentException('non-nullable count cannot be null');
}
$this->container['count'] = $count;
return $this;
}
/**
* Gets delay_timeout
*
* @return int|null
*/
public function getDelayTimeout()
{
return $this->container['delay_timeout'];
}
/**
* Sets delay_timeout
*
* @param int|null $delay_timeout Max time in milliseconds to wait between retries if a `timeout` is specified.
*
* @return self
*/
public function setDelayTimeout($delay_timeout)
{
if (is_null($delay_timeout)) {
array_push($this->openAPINullablesSetToNull, 'delay_timeout');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('delay_timeout', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['delay_timeout'] = $delay_timeout;
return $this;
}
/**
* Gets timeout
*
* @return int
*/
public function getTimeout()
{
return $this->container['timeout'];
}
/**
* Sets timeout
*
* @param int $timeout Max time in milliseconds to retry the `waitFor` operation until conditions are met.
*
* @return self
*/
public function setTimeout($timeout)
{
if (is_null($timeout)) {
throw new \InvalidArgumentException('non-nullable timeout cannot be null');
}
$this->container['timeout'] = $timeout;
return $this;
}
/**
* Gets unread_only
*
* @return bool|null
*/
public function getUnreadOnly()
{
return $this->container['unread_only'];
}
/**
* Sets unread_only
*
* @param bool|null $unread_only Apply conditions only to **unread** SMS. All SMS messages begin with `read=false`. An SMS is marked `read=true` when an `SMS` has been returned to the user at least once. For example you have called `getSms` or `waitForSms` etc., or you have viewed the SMS in the dashboard.
*
* @return self
*/
public function setUnreadOnly($unread_only)
{
if (is_null($unread_only)) {
array_push($this->openAPINullablesSetToNull, 'unread_only');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('unread_only', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['unread_only'] = $unread_only;
return $this;
}
/**
* Gets count_type
*
* @return string|null
*/
public function getCountType()
{
return $this->container['count_type'];
}
/**
* Sets count_type
*
* @param string|null $count_type How result size should be compared with the expected size. Exactly or at-least matching result?
*
* @return self
*/
public function setCountType($count_type)
{
$allowedValues = $this->getCountTypeAllowableValues();
if (!is_null($count_type) && !in_array($count_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'count_type', must be one of '%s'",
$count_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($count_type)) {
array_push($this->openAPINullablesSetToNull, 'count_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('count_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['count_type'] = $count_type;
return $this;
}
/**
* Gets matches
*
* @return \MailSlurp\Models\SmsMatchOption[]|null
*/
public function getMatches()
{
return $this->container['matches'];
}
/**
* Sets matches
*
* @param \MailSlurp\Models\SmsMatchOption[]|null $matches Conditions that should be matched for an SMS to qualify for results. Each condition will be applied in order to each SMS within a phone number to filter a result list of matching SMSs you are waiting for.
*
* @return self
*/
public function setMatches($matches)
{
if (is_null($matches)) {
array_push($this->openAPINullablesSetToNull, 'matches');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('matches', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['matches'] = $matches;
return $this;
}
/**
* Gets sort_direction
*
* @return string|null
*/
public function getSortDirection()
{
return $this->container['sort_direction'];
}
/**
* Sets sort_direction
*
* @param string|null $sort_direction Direction to sort matching SMSs by created time
*
* @return self
*/
public function setSortDirection($sort_direction)
{
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sort_direction', must be one of '%s'",
$sort_direction,
implode("', '", $allowedValues)
)
);
}
if (is_null($sort_direction)) {
array_push($this->openAPINullablesSetToNull, 'sort_direction');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sort_direction', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sort_direction'] = $sort_direction;
return $this;
}
/**
* Gets since
*
* @return \DateTime|null
*/
public function getSince()
{
return $this->container['since'];
}
/**
* Sets since
*
* @param \DateTime|null $since ISO Date Time earliest time of SMS to consider. Filter for matching SMSs that were received after this date
*
* @return self
*/
public function setSince($since)
{
if (is_null($since)) {
array_push($this->openAPINullablesSetToNull, 'since');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('since', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['since'] = $since;
return $this;
}
/**
* Gets before
*
* @return \DateTime|null
*/
public function getBefore()
{
return $this->container['before'];
}
/**
* Sets before
*
* @param \DateTime|null $before ISO Date Time latest time of SMS to consider. Filter for matching SMSs that were received before this date
*
* @return self
*/
public function setBefore($before)
{
if (is_null($before)) {
array_push($this->openAPINullablesSetToNull, 'before');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('before', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['before'] = $before;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WaitForSingleSmsOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WaitForSingleSmsOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WaitForSingleSmsOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WaitForSingleSmsOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'phone_number_id' => 'string',
'timeout' => 'int',
'unread_only' => 'bool',
'before' => '\DateTime',
'since' => '\DateTime',
'sort_direction' => 'string',
'delay' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'phone_number_id' => 'uuid',
'timeout' => 'int64',
'unread_only' => null,
'before' => 'date-time',
'since' => 'date-time',
'sort_direction' => null,
'delay' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'phone_number_id' => false,
'timeout' => false,
'unread_only' => false,
'before' => false,
'since' => false,
'sort_direction' => false,
'delay' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'phone_number_id' => 'phoneNumberId',
'timeout' => 'timeout',
'unread_only' => 'unreadOnly',
'before' => 'before',
'since' => 'since',
'sort_direction' => 'sortDirection',
'delay' => 'delay'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'phone_number_id' => 'setPhoneNumberId',
'timeout' => 'setTimeout',
'unread_only' => 'setUnreadOnly',
'before' => 'setBefore',
'since' => 'setSince',
'sort_direction' => 'setSortDirection',
'delay' => 'setDelay'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'phone_number_id' => 'getPhoneNumberId',
'timeout' => 'getTimeout',
'unread_only' => 'getUnreadOnly',
'before' => 'getBefore',
'since' => 'getSince',
'sort_direction' => 'getSortDirection',
'delay' => 'getDelay'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SORT_DIRECTION_ASC = 'ASC';
public const SORT_DIRECTION_DESC = 'DESC';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSortDirectionAllowableValues()
{
return [
self::SORT_DIRECTION_ASC,
self::SORT_DIRECTION_DESC,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('phone_number_id', $data ?? [], null);
$this->setIfExists('timeout', $data ?? [], null);
$this->setIfExists('unread_only', $data ?? [], null);
$this->setIfExists('before', $data ?? [], null);
$this->setIfExists('since', $data ?? [], null);
$this->setIfExists('sort_direction', $data ?? [], null);
$this->setIfExists('delay', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['phone_number_id'] === null) {
$invalidProperties[] = "'phone_number_id' can't be null";
}
if ($this->container['timeout'] === null) {
$invalidProperties[] = "'timeout' can't be null";
}
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sort_direction', must be one of '%s'",
$this->container['sort_direction'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets phone_number_id
*
* @return string
*/
public function getPhoneNumberId()
{
return $this->container['phone_number_id'];
}
/**
* Sets phone_number_id
*
* @param string $phone_number_id phone_number_id
*
* @return self
*/
public function setPhoneNumberId($phone_number_id)
{
if (is_null($phone_number_id)) {
throw new \InvalidArgumentException('non-nullable phone_number_id cannot be null');
}
$this->container['phone_number_id'] = $phone_number_id;
return $this;
}
/**
* Gets timeout
*
* @return int
*/
public function getTimeout()
{
return $this->container['timeout'];
}
/**
* Sets timeout
*
* @param int $timeout timeout
*
* @return self
*/
public function setTimeout($timeout)
{
if (is_null($timeout)) {
throw new \InvalidArgumentException('non-nullable timeout cannot be null');
}
$this->container['timeout'] = $timeout;
return $this;
}
/**
* Gets unread_only
*
* @return bool|null
*/
public function getUnreadOnly()
{
return $this->container['unread_only'];
}
/**
* Sets unread_only
*
* @param bool|null $unread_only unread_only
*
* @return self
*/
public function setUnreadOnly($unread_only)
{
if (is_null($unread_only)) {
throw new \InvalidArgumentException('non-nullable unread_only cannot be null');
}
$this->container['unread_only'] = $unread_only;
return $this;
}
/**
* Gets before
*
* @return \DateTime|null
*/
public function getBefore()
{
return $this->container['before'];
}
/**
* Sets before
*
* @param \DateTime|null $before before
*
* @return self
*/
public function setBefore($before)
{
if (is_null($before)) {
throw new \InvalidArgumentException('non-nullable before cannot be null');
}
$this->container['before'] = $before;
return $this;
}
/**
* Gets since
*
* @return \DateTime|null
*/
public function getSince()
{
return $this->container['since'];
}
/**
* Sets since
*
* @param \DateTime|null $since since
*
* @return self
*/
public function setSince($since)
{
if (is_null($since)) {
throw new \InvalidArgumentException('non-nullable since cannot be null');
}
$this->container['since'] = $since;
return $this;
}
/**
* Gets sort_direction
*
* @return string|null
*/
public function getSortDirection()
{
return $this->container['sort_direction'];
}
/**
* Sets sort_direction
*
* @param string|null $sort_direction sort_direction
*
* @return self
*/
public function setSortDirection($sort_direction)
{
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sort_direction', must be one of '%s'",
$sort_direction,
implode("', '", $allowedValues)
)
);
}
if (is_null($sort_direction)) {
throw new \InvalidArgumentException('non-nullable sort_direction cannot be null');
}
$this->container['sort_direction'] = $sort_direction;
return $this;
}
/**
* Gets delay
*
* @return int|null
*/
public function getDelay()
{
return $this->container['delay'];
}
/**
* Sets delay
*
* @param int|null $delay delay
*
* @return self
*/
public function setDelay($delay)
{
if (is_null($delay)) {
throw new \InvalidArgumentException('non-nullable delay cannot be null');
}
$this->container['delay'] = $delay;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* WaitForConditions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* WaitForConditions Class Doc Comment
*
* @category Class
* @description Conditions to apply to emails that you are waiting for
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class WaitForConditions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'WaitForConditions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_id' => 'string',
'count' => 'int',
'delay_timeout' => 'int',
'timeout' => 'int',
'unread_only' => 'bool',
'count_type' => 'string',
'matches' => '\MailSlurp\Models\MatchOption[]',
'sort_direction' => 'string',
'since' => '\DateTime',
'before' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_id' => 'uuid',
'count' => 'int32',
'delay_timeout' => 'int64',
'timeout' => 'int64',
'unread_only' => null,
'count_type' => null,
'matches' => null,
'sort_direction' => null,
'since' => 'date-time',
'before' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_id' => false,
'count' => true,
'delay_timeout' => true,
'timeout' => false,
'unread_only' => true,
'count_type' => true,
'matches' => true,
'sort_direction' => true,
'since' => true,
'before' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_id' => 'inboxId',
'count' => 'count',
'delay_timeout' => 'delayTimeout',
'timeout' => 'timeout',
'unread_only' => 'unreadOnly',
'count_type' => 'countType',
'matches' => 'matches',
'sort_direction' => 'sortDirection',
'since' => 'since',
'before' => 'before'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_id' => 'setInboxId',
'count' => 'setCount',
'delay_timeout' => 'setDelayTimeout',
'timeout' => 'setTimeout',
'unread_only' => 'setUnreadOnly',
'count_type' => 'setCountType',
'matches' => 'setMatches',
'sort_direction' => 'setSortDirection',
'since' => 'setSince',
'before' => 'setBefore'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_id' => 'getInboxId',
'count' => 'getCount',
'delay_timeout' => 'getDelayTimeout',
'timeout' => 'getTimeout',
'unread_only' => 'getUnreadOnly',
'count_type' => 'getCountType',
'matches' => 'getMatches',
'sort_direction' => 'getSortDirection',
'since' => 'getSince',
'before' => 'getBefore'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const COUNT_TYPE_EXACTLY = 'EXACTLY';
public const COUNT_TYPE_ATLEAST = 'ATLEAST';
public const SORT_DIRECTION_ASC = 'ASC';
public const SORT_DIRECTION_DESC = 'DESC';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getCountTypeAllowableValues()
{
return [
self::COUNT_TYPE_EXACTLY,
self::COUNT_TYPE_ATLEAST,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSortDirectionAllowableValues()
{
return [
self::SORT_DIRECTION_ASC,
self::SORT_DIRECTION_DESC,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('count', $data ?? [], null);
$this->setIfExists('delay_timeout', $data ?? [], null);
$this->setIfExists('timeout', $data ?? [], null);
$this->setIfExists('unread_only', $data ?? [], null);
$this->setIfExists('count_type', $data ?? [], null);
$this->setIfExists('matches', $data ?? [], null);
$this->setIfExists('sort_direction', $data ?? [], null);
$this->setIfExists('since', $data ?? [], null);
$this->setIfExists('before', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['timeout'] === null) {
$invalidProperties[] = "'timeout' can't be null";
}
$allowedValues = $this->getCountTypeAllowableValues();
if (!is_null($this->container['count_type']) && !in_array($this->container['count_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'count_type', must be one of '%s'",
$this->container['count_type'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sort_direction', must be one of '%s'",
$this->container['sort_direction'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id ID of inbox to search within and apply conditions to. Essentially filtering the emails found to give a count.
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets count
*
* @return int|null
*/
public function getCount()
{
return $this->container['count'];
}
/**
* Sets count
*
* @param int|null $count Number of results that should match conditions. Either exactly or at least this amount based on the `countType`. If count condition is not met and the timeout has not been reached the `waitFor` method will retry the operation.
*
* @return self
*/
public function setCount($count)
{
if (is_null($count)) {
array_push($this->openAPINullablesSetToNull, 'count');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('count', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['count'] = $count;
return $this;
}
/**
* Gets delay_timeout
*
* @return int|null
*/
public function getDelayTimeout()
{
return $this->container['delay_timeout'];
}
/**
* Sets delay_timeout
*
* @param int|null $delay_timeout Max time in milliseconds to wait between retries if a `timeout` is specified.
*
* @return self
*/
public function setDelayTimeout($delay_timeout)
{
if (is_null($delay_timeout)) {
array_push($this->openAPINullablesSetToNull, 'delay_timeout');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('delay_timeout', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['delay_timeout'] = $delay_timeout;
return $this;
}
/**
* Gets timeout
*
* @return int
*/
public function getTimeout()
{
return $this->container['timeout'];
}
/**
* Sets timeout
*
* @param int $timeout Max time in milliseconds to retry the `waitFor` operation until conditions are met.
*
* @return self
*/
public function setTimeout($timeout)
{
if (is_null($timeout)) {
throw new \InvalidArgumentException('non-nullable timeout cannot be null');
}
$this->container['timeout'] = $timeout;
return $this;
}
/**
* Gets unread_only
*
* @return bool|null
*/
public function getUnreadOnly()
{
return $this->container['unread_only'];
}
/**
* Sets unread_only
*
* @param bool|null $unread_only Apply conditions only to **unread** emails. All emails begin with `read=false`. An email is marked `read=true` when an `EmailDto` representation of it has been returned to the user at least once. For example you have called `getEmail` or `waitForLatestEmail` etc., or you have viewed the email in the dashboard.
*
* @return self
*/
public function setUnreadOnly($unread_only)
{
if (is_null($unread_only)) {
array_push($this->openAPINullablesSetToNull, 'unread_only');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('unread_only', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['unread_only'] = $unread_only;
return $this;
}
/**
* Gets count_type
*
* @return string|null
*/
public function getCountType()
{
return $this->container['count_type'];
}
/**
* Sets count_type
*
* @param string|null $count_type How result size should be compared with the expected size. Exactly or at-least matching result?
*
* @return self
*/
public function setCountType($count_type)
{
$allowedValues = $this->getCountTypeAllowableValues();
if (!is_null($count_type) && !in_array($count_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'count_type', must be one of '%s'",
$count_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($count_type)) {
array_push($this->openAPINullablesSetToNull, 'count_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('count_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['count_type'] = $count_type;
return $this;
}
/**
* Gets matches
*
* @return \MailSlurp\Models\MatchOption[]|null
*/
public function getMatches()
{
return $this->container['matches'];
}
/**
* Sets matches
*
* @param \MailSlurp\Models\MatchOption[]|null $matches Conditions that should be matched for an email to qualify for results. Each condition will be applied in order to each email within an inbox to filter a result list of matching emails you are waiting for.
*
* @return self
*/
public function setMatches($matches)
{
if (is_null($matches)) {
array_push($this->openAPINullablesSetToNull, 'matches');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('matches', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['matches'] = $matches;
return $this;
}
/**
* Gets sort_direction
*
* @return string|null
*/
public function getSortDirection()
{
return $this->container['sort_direction'];
}
/**
* Sets sort_direction
*
* @param string|null $sort_direction Direction to sort matching emails by created time
*
* @return self
*/
public function setSortDirection($sort_direction)
{
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sort_direction', must be one of '%s'",
$sort_direction,
implode("', '", $allowedValues)
)
);
}
if (is_null($sort_direction)) {
array_push($this->openAPINullablesSetToNull, 'sort_direction');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sort_direction', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sort_direction'] = $sort_direction;
return $this;
}
/**
* Gets since
*
* @return \DateTime|null
*/
public function getSince()
{
return $this->container['since'];
}
/**
* Sets since
*
* @param \DateTime|null $since ISO Date Time earliest time of email to consider. Filter for matching emails that were received after this date
*
* @return self
*/
public function setSince($since)
{
if (is_null($since)) {
array_push($this->openAPINullablesSetToNull, 'since');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('since', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['since'] = $since;
return $this;
}
/**
* Gets before
*
* @return \DateTime|null
*/
public function getBefore()
{
return $this->container['before'];
}
/**
* Sets before
*
* @param \DateTime|null $before ISO Date Time latest time of email to consider. Filter for matching emails that were received before this date
*
* @return self
*/
public function setBefore($before)
{
if (is_null($before)) {
array_push($this->openAPINullablesSetToNull, 'before');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('before', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['before'] = $before;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* VerifyWebhookSignatureResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* VerifyWebhookSignatureResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class VerifyWebhookSignatureResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'VerifyWebhookSignatureResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'is_valid' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'is_valid' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'is_valid' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'is_valid' => 'isValid'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'is_valid' => 'setIsValid'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'is_valid' => 'getIsValid'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('is_valid', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['is_valid'] === null) {
$invalidProperties[] = "'is_valid' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets is_valid
*
* @return bool
*/
public function getIsValid()
{
return $this->container['is_valid'];
}
/**
* Sets is_valid
*
* @param bool $is_valid is_valid
*
* @return self
*/
public function setIsValid($is_valid)
{
if (is_null($is_valid)) {
throw new \InvalidArgumentException('non-nullable is_valid cannot be null');
}
$this->container['is_valid'] = $is_valid;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* VerifyWebhookSignatureOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* VerifyWebhookSignatureOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class VerifyWebhookSignatureOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'VerifyWebhookSignatureOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message_id' => 'string',
'signature' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message_id' => null,
'signature' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message_id' => false,
'signature' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message_id' => 'messageId',
'signature' => 'signature'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message_id' => 'setMessageId',
'signature' => 'setSignature'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message_id' => 'getMessageId',
'signature' => 'getSignature'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('signature', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['signature'] === null) {
$invalidProperties[] = "'signature' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id message_id
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets signature
*
* @return string
*/
public function getSignature()
{
return $this->container['signature'];
}
/**
* Sets signature
*
* @param string $signature signature
*
* @return self
*/
public function setSignature($signature)
{
if (is_null($signature)) {
throw new \InvalidArgumentException('non-nullable signature cannot be null');
}
$this->container['signature'] = $signature;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* VerifyEmailAddressOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* VerifyEmailAddressOptions Class Doc Comment
*
* @category Class
* @description Options for verifying that an email address exists at a remote mail server.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class VerifyEmailAddressOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'VerifyEmailAddressOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'mail_server_domain' => 'string',
'email_address' => 'string',
'sender_email_address' => 'string',
'port' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'mail_server_domain' => null,
'email_address' => null,
'sender_email_address' => null,
'port' => 'int32'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'mail_server_domain' => true,
'email_address' => false,
'sender_email_address' => true,
'port' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'mail_server_domain' => 'mailServerDomain',
'email_address' => 'emailAddress',
'sender_email_address' => 'senderEmailAddress',
'port' => 'port'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'mail_server_domain' => 'setMailServerDomain',
'email_address' => 'setEmailAddress',
'sender_email_address' => 'setSenderEmailAddress',
'port' => 'setPort'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'mail_server_domain' => 'getMailServerDomain',
'email_address' => 'getEmailAddress',
'sender_email_address' => 'getSenderEmailAddress',
'port' => 'getPort'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('mail_server_domain', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('sender_email_address', $data ?? [], null);
$this->setIfExists('port', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets mail_server_domain
*
* @return string|null
*/
public function getMailServerDomain()
{
return $this->container['mail_server_domain'];
}
/**
* Sets mail_server_domain
*
* @param string|null $mail_server_domain mail_server_domain
*
* @return self
*/
public function setMailServerDomain($mail_server_domain)
{
if (is_null($mail_server_domain)) {
array_push($this->openAPINullablesSetToNull, 'mail_server_domain');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('mail_server_domain', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['mail_server_domain'] = $mail_server_domain;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets sender_email_address
*
* @return string|null
*/
public function getSenderEmailAddress()
{
return $this->container['sender_email_address'];
}
/**
* Sets sender_email_address
*
* @param string|null $sender_email_address sender_email_address
*
* @return self
*/
public function setSenderEmailAddress($sender_email_address)
{
if (is_null($sender_email_address)) {
array_push($this->openAPINullablesSetToNull, 'sender_email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sender_email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sender_email_address'] = $sender_email_address;
return $this;
}
/**
* Gets port
*
* @return int|null
*/
public function getPort()
{
return $this->container['port'];
}
/**
* Sets port
*
* @param int|null $port port
*
* @return self
*/
public function setPort($port)
{
if (is_null($port)) {
array_push($this->openAPINullablesSetToNull, 'port');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('port', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['port'] = $port;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ValidationMessage
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ValidationMessage Class Doc Comment
*
* @category Class
* @description Optional warnings resulting from HTML validation
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ValidationMessage implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ValidationMessage';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'line_number' => 'int',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'line_number' => 'int32',
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'line_number' => false,
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'line_number' => 'lineNumber',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'line_number' => 'setLineNumber',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'line_number' => 'getLineNumber',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('line_number', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['line_number'] === null) {
$invalidProperties[] = "'line_number' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets line_number
*
* @return int
*/
public function getLineNumber()
{
return $this->container['line_number'];
}
/**
* Sets line_number
*
* @param int $line_number line_number
*
* @return self
*/
public function setLineNumber($line_number)
{
if (is_null($line_number)) {
throw new \InvalidArgumentException('non-nullable line_number cannot be null');
}
$this->container['line_number'] = $line_number;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ValidationDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ValidationDto Class Doc Comment
*
* @category Class
* @description Response object for email validation operation
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ValidationDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ValidationDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_id' => 'string',
'html' => '\MailSlurp\Models\HTMLValidationResult'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_id' => 'uuid',
'html' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_id' => false,
'html' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_id' => 'emailId',
'html' => 'html'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_id' => 'setEmailId',
'html' => 'setHtml'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_id' => 'getEmailId',
'html' => 'getHtml'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_id', $data ?? [], null);
$this->setIfExists('html', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_id'] === null) {
$invalidProperties[] = "'email_id' can't be null";
}
if ($this->container['html'] === null) {
$invalidProperties[] = "'html' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_id
*
* @return string
*/
public function getEmailId()
{
return $this->container['email_id'];
}
/**
* Sets email_id
*
* @param string $email_id ID of the email validated
*
* @return self
*/
public function setEmailId($email_id)
{
if (is_null($email_id)) {
throw new \InvalidArgumentException('non-nullable email_id cannot be null');
}
$this->container['email_id'] = $email_id;
return $this;
}
/**
* Gets html
*
* @return \MailSlurp\Models\HTMLValidationResult
*/
public function getHtml()
{
return $this->container['html'];
}
/**
* Sets html
*
* @param \MailSlurp\Models\HTMLValidationResult $html html
*
* @return self
*/
public function setHtml($html)
{
if (is_null($html)) {
throw new \InvalidArgumentException('non-nullable html cannot be null');
}
$this->container['html'] = $html;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ValidateEmailAddressListResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ValidateEmailAddressListResult Class Doc Comment
*
* @category Class
* @description Result of validating a list of email addresses
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ValidateEmailAddressListResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ValidateEmailAddressListResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'valid_email_addresses' => 'string[]',
'invalid_email_addresses' => 'string[]',
'result_map_email_address_is_valid' => 'array<string,bool>'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'valid_email_addresses' => null,
'invalid_email_addresses' => null,
'result_map_email_address_is_valid' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'valid_email_addresses' => false,
'invalid_email_addresses' => false,
'result_map_email_address_is_valid' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'valid_email_addresses' => 'validEmailAddresses',
'invalid_email_addresses' => 'invalidEmailAddresses',
'result_map_email_address_is_valid' => 'resultMapEmailAddressIsValid'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'valid_email_addresses' => 'setValidEmailAddresses',
'invalid_email_addresses' => 'setInvalidEmailAddresses',
'result_map_email_address_is_valid' => 'setResultMapEmailAddressIsValid'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'valid_email_addresses' => 'getValidEmailAddresses',
'invalid_email_addresses' => 'getInvalidEmailAddresses',
'result_map_email_address_is_valid' => 'getResultMapEmailAddressIsValid'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('valid_email_addresses', $data ?? [], null);
$this->setIfExists('invalid_email_addresses', $data ?? [], null);
$this->setIfExists('result_map_email_address_is_valid', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['valid_email_addresses'] === null) {
$invalidProperties[] = "'valid_email_addresses' can't be null";
}
if ($this->container['invalid_email_addresses'] === null) {
$invalidProperties[] = "'invalid_email_addresses' can't be null";
}
if ($this->container['result_map_email_address_is_valid'] === null) {
$invalidProperties[] = "'result_map_email_address_is_valid' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets valid_email_addresses
*
* @return string[]
*/
public function getValidEmailAddresses()
{
return $this->container['valid_email_addresses'];
}
/**
* Sets valid_email_addresses
*
* @param string[] $valid_email_addresses valid_email_addresses
*
* @return self
*/
public function setValidEmailAddresses($valid_email_addresses)
{
if (is_null($valid_email_addresses)) {
throw new \InvalidArgumentException('non-nullable valid_email_addresses cannot be null');
}
$this->container['valid_email_addresses'] = $valid_email_addresses;
return $this;
}
/**
* Gets invalid_email_addresses
*
* @return string[]
*/
public function getInvalidEmailAddresses()
{
return $this->container['invalid_email_addresses'];
}
/**
* Sets invalid_email_addresses
*
* @param string[] $invalid_email_addresses invalid_email_addresses
*
* @return self
*/
public function setInvalidEmailAddresses($invalid_email_addresses)
{
if (is_null($invalid_email_addresses)) {
throw new \InvalidArgumentException('non-nullable invalid_email_addresses cannot be null');
}
$this->container['invalid_email_addresses'] = $invalid_email_addresses;
return $this;
}
/**
* Gets result_map_email_address_is_valid
*
* @return array<string,bool>
*/
public function getResultMapEmailAddressIsValid()
{
return $this->container['result_map_email_address_is_valid'];
}
/**
* Sets result_map_email_address_is_valid
*
* @param array<string,bool> $result_map_email_address_is_valid result_map_email_address_is_valid
*
* @return self
*/
public function setResultMapEmailAddressIsValid($result_map_email_address_is_valid)
{
if (is_null($result_map_email_address_is_valid)) {
throw new \InvalidArgumentException('non-nullable result_map_email_address_is_valid cannot be null');
}
$this->container['result_map_email_address_is_valid'] = $result_map_email_address_is_valid;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ValidateEmailAddressListOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ValidateEmailAddressListOptions Class Doc Comment
*
* @category Class
* @description Options for validating a list of email addresses
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ValidateEmailAddressListOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ValidateEmailAddressListOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_address_list' => 'string[]',
'ignore_old_results' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_address_list' => null,
'ignore_old_results' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_address_list' => false,
'ignore_old_results' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_address_list' => 'emailAddressList',
'ignore_old_results' => 'ignoreOldResults'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_address_list' => 'setEmailAddressList',
'ignore_old_results' => 'setIgnoreOldResults'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_address_list' => 'getEmailAddressList',
'ignore_old_results' => 'getIgnoreOldResults'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_address_list', $data ?? [], null);
$this->setIfExists('ignore_old_results', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_address_list'] === null) {
$invalidProperties[] = "'email_address_list' can't be null";
}
if ((count($this->container['email_address_list']) > 50)) {
$invalidProperties[] = "invalid value for 'email_address_list', number of items must be less than or equal to 50.";
}
if ((count($this->container['email_address_list']) < 1)) {
$invalidProperties[] = "invalid value for 'email_address_list', number of items must be greater than or equal to 1.";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_address_list
*
* @return string[]
*/
public function getEmailAddressList()
{
return $this->container['email_address_list'];
}
/**
* Sets email_address_list
*
* @param string[] $email_address_list email_address_list
*
* @return self
*/
public function setEmailAddressList($email_address_list)
{
if ((count($email_address_list) > 50)) {
throw new \InvalidArgumentException('invalid value for $email_address_list when calling ValidateEmailAddressListOptions., number of items must be less than or equal to 50.');
}
if ((count($email_address_list) < 1)) {
throw new \InvalidArgumentException('invalid length for $email_address_list when calling ValidateEmailAddressListOptions., number of items must be greater than or equal to 1.');
}
if (is_null($email_address_list)) {
throw new \InvalidArgumentException('non-nullable email_address_list cannot be null');
}
$this->container['email_address_list'] = $email_address_list;
return $this;
}
/**
* Gets ignore_old_results
*
* @return bool|null
*/
public function getIgnoreOldResults()
{
return $this->container['ignore_old_results'];
}
/**
* Sets ignore_old_results
*
* @param bool|null $ignore_old_results ignore_old_results
*
* @return self
*/
public function setIgnoreOldResults($ignore_old_results)
{
if (is_null($ignore_old_results)) {
array_push($this->openAPINullablesSetToNull, 'ignore_old_results');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('ignore_old_results', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['ignore_old_results'] = $ignore_old_results;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UserInfoDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UserInfoDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UserInfoDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UserInfoDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'email_address' => 'string',
'account_state' => 'string',
'subscription_type' => 'string',
'account_type' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'email_address' => null,
'account_state' => null,
'subscription_type' => null,
'account_type' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'email_address' => false,
'account_state' => false,
'subscription_type' => false,
'account_type' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'email_address' => 'emailAddress',
'account_state' => 'accountState',
'subscription_type' => 'subscriptionType',
'account_type' => 'accountType',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'email_address' => 'setEmailAddress',
'account_state' => 'setAccountState',
'subscription_type' => 'setSubscriptionType',
'account_type' => 'setAccountType',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'email_address' => 'getEmailAddress',
'account_state' => 'getAccountState',
'subscription_type' => 'getSubscriptionType',
'account_type' => 'getAccountType',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const ACCOUNT_STATE_FROZEN = 'FROZEN';
public const ACCOUNT_STATE_ACTIVE = 'ACTIVE';
public const SUBSCRIPTION_TYPE_PRO_MONTHLY = 'PRO_MONTHLY';
public const SUBSCRIPTION_TYPE_STARTER = 'STARTER';
public const SUBSCRIPTION_TYPE_PRO = 'PRO';
public const SUBSCRIPTION_TYPE_TEAM = 'TEAM';
public const SUBSCRIPTION_TYPE_ENTERPRISE = 'ENTERPRISE';
public const ACCOUNT_TYPE_SOLO = 'SOLO';
public const ACCOUNT_TYPE_CHILD_SOLO = 'CHILD_SOLO';
public const ACCOUNT_TYPE_CHILD_TEAM = 'CHILD_TEAM';
public const ACCOUNT_TYPE_CHILD_ADMIN = 'CHILD_ADMIN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getAccountStateAllowableValues()
{
return [
self::ACCOUNT_STATE_FROZEN,
self::ACCOUNT_STATE_ACTIVE,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSubscriptionTypeAllowableValues()
{
return [
self::SUBSCRIPTION_TYPE_PRO_MONTHLY,
self::SUBSCRIPTION_TYPE_STARTER,
self::SUBSCRIPTION_TYPE_PRO,
self::SUBSCRIPTION_TYPE_TEAM,
self::SUBSCRIPTION_TYPE_ENTERPRISE,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getAccountTypeAllowableValues()
{
return [
self::ACCOUNT_TYPE_SOLO,
self::ACCOUNT_TYPE_CHILD_SOLO,
self::ACCOUNT_TYPE_CHILD_TEAM,
self::ACCOUNT_TYPE_CHILD_ADMIN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('account_state', $data ?? [], null);
$this->setIfExists('subscription_type', $data ?? [], null);
$this->setIfExists('account_type', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['account_state'] === null) {
$invalidProperties[] = "'account_state' can't be null";
}
$allowedValues = $this->getAccountStateAllowableValues();
if (!is_null($this->container['account_state']) && !in_array($this->container['account_state'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'account_state', must be one of '%s'",
$this->container['account_state'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getSubscriptionTypeAllowableValues();
if (!is_null($this->container['subscription_type']) && !in_array($this->container['subscription_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'subscription_type', must be one of '%s'",
$this->container['subscription_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['account_type'] === null) {
$invalidProperties[] = "'account_type' can't be null";
}
$allowedValues = $this->getAccountTypeAllowableValues();
if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'account_type', must be one of '%s'",
$this->container['account_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets account_state
*
* @return string
*/
public function getAccountState()
{
return $this->container['account_state'];
}
/**
* Sets account_state
*
* @param string $account_state account_state
*
* @return self
*/
public function setAccountState($account_state)
{
$allowedValues = $this->getAccountStateAllowableValues();
if (!in_array($account_state, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'account_state', must be one of '%s'",
$account_state,
implode("', '", $allowedValues)
)
);
}
if (is_null($account_state)) {
throw new \InvalidArgumentException('non-nullable account_state cannot be null');
}
$this->container['account_state'] = $account_state;
return $this;
}
/**
* Gets subscription_type
*
* @return string|null
*/
public function getSubscriptionType()
{
return $this->container['subscription_type'];
}
/**
* Sets subscription_type
*
* @param string|null $subscription_type subscription_type
*
* @return self
*/
public function setSubscriptionType($subscription_type)
{
$allowedValues = $this->getSubscriptionTypeAllowableValues();
if (!is_null($subscription_type) && !in_array($subscription_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'subscription_type', must be one of '%s'",
$subscription_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($subscription_type)) {
throw new \InvalidArgumentException('non-nullable subscription_type cannot be null');
}
$this->container['subscription_type'] = $subscription_type;
return $this;
}
/**
* Gets account_type
*
* @return string
*/
public function getAccountType()
{
return $this->container['account_type'];
}
/**
* Sets account_type
*
* @param string $account_type account_type
*
* @return self
*/
public function setAccountType($account_type)
{
$allowedValues = $this->getAccountTypeAllowableValues();
if (!in_array($account_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'account_type', must be one of '%s'",
$account_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($account_type)) {
throw new \InvalidArgumentException('non-nullable account_type cannot be null');
}
$this->container['account_type'] = $account_type;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UploadMultipartFormRequest
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UploadMultipartFormRequest Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UploadMultipartFormRequest implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'uploadMultipartForm_request';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content_type_header' => 'string',
'file' => '\SplFileObject'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content_type_header' => null,
'file' => 'binary'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content_type_header' => false,
'file' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content_type_header' => 'contentTypeHeader',
'file' => 'file'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content_type_header' => 'setContentTypeHeader',
'file' => 'setFile'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content_type_header' => 'getContentTypeHeader',
'file' => 'getFile'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content_type_header', $data ?? [], null);
$this->setIfExists('file', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['file'] === null) {
$invalidProperties[] = "'file' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content_type_header
*
* @return string|null
*/
public function getContentTypeHeader()
{
return $this->container['content_type_header'];
}
/**
* Sets content_type_header
*
* @param string|null $content_type_header Optional content type header of attachment
*
* @return self
*/
public function setContentTypeHeader($content_type_header)
{
if (is_null($content_type_header)) {
throw new \InvalidArgumentException('non-nullable content_type_header cannot be null');
}
$this->container['content_type_header'] = $content_type_header;
return $this;
}
/**
* Gets file
*
* @return \SplFileObject
*/
public function getFile()
{
return $this->container['file'];
}
/**
* Sets file
*
* @param \SplFileObject $file file
*
* @return self
*/
public function setFile($file)
{
if (is_null($file)) {
throw new \InvalidArgumentException('non-nullable file cannot be null');
}
$this->container['file'] = $file;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UploadAttachmentOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UploadAttachmentOptions Class Doc Comment
*
* @category Class
* @description Options for uploading files for attachments. When sending emails with the API that require attachments first upload each attachment. Then use the returned attachment ID in your `SendEmailOptions` when sending an email. This way you can use attachments multiple times once they have been uploaded.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UploadAttachmentOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UploadAttachmentOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content_id' => 'string',
'content_type' => 'string',
'filename' => 'string',
'base64_contents' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content_id' => null,
'content_type' => null,
'filename' => null,
'base64_contents' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content_id' => true,
'content_type' => true,
'filename' => true,
'base64_contents' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content_id' => 'contentId',
'content_type' => 'contentType',
'filename' => 'filename',
'base64_contents' => 'base64Contents'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content_id' => 'setContentId',
'content_type' => 'setContentType',
'filename' => 'setFilename',
'base64_contents' => 'setBase64Contents'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content_id' => 'getContentId',
'content_type' => 'getContentType',
'filename' => 'getFilename',
'base64_contents' => 'getBase64Contents'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content_id', $data ?? [], null);
$this->setIfExists('content_type', $data ?? [], null);
$this->setIfExists('filename', $data ?? [], null);
$this->setIfExists('base64_contents', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['base64_contents'] === null) {
$invalidProperties[] = "'base64_contents' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content_id
*
* @return string|null
*/
public function getContentId()
{
return $this->container['content_id'];
}
/**
* Sets content_id
*
* @param string|null $content_id Optional contentId for file.
*
* @return self
*/
public function setContentId($content_id)
{
if (is_null($content_id)) {
array_push($this->openAPINullablesSetToNull, 'content_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('content_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['content_id'] = $content_id;
return $this;
}
/**
* Gets content_type
*
* @return string|null
*/
public function getContentType()
{
return $this->container['content_type'];
}
/**
* Sets content_type
*
* @param string|null $content_type Optional contentType for file. For instance `application/pdf`
*
* @return self
*/
public function setContentType($content_type)
{
if (is_null($content_type)) {
array_push($this->openAPINullablesSetToNull, 'content_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('content_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['content_type'] = $content_type;
return $this;
}
/**
* Gets filename
*
* @return string|null
*/
public function getFilename()
{
return $this->container['filename'];
}
/**
* Sets filename
*
* @param string|null $filename Optional filename to save upload with. Will be the name that is shown in email clients
*
* @return self
*/
public function setFilename($filename)
{
if (is_null($filename)) {
array_push($this->openAPINullablesSetToNull, 'filename');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('filename', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['filename'] = $filename;
return $this;
}
/**
* Gets base64_contents
*
* @return string
*/
public function getBase64Contents()
{
return $this->container['base64_contents'];
}
/**
* Sets base64_contents
*
* @param string $base64_contents Base64 encoded string of file contents. Typically this means reading the bytes or string content of a file and then converting that to a base64 encoded string. For examples of how to do this see https://www.mailslurp.com/guides/base64-file-uploads/
*
* @return self
*/
public function setBase64Contents($base64_contents)
{
if (is_null($base64_contents)) {
throw new \InvalidArgumentException('non-nullable base64_contents cannot be null');
}
$this->container['base64_contents'] = $base64_contents;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UpdateSmtpAccessOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UpdateSmtpAccessOptions Class Doc Comment
*
* @category Class
* @description Edit access details for inbox using SMTP
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UpdateSmtpAccessOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UpdateSmtpAccessOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'smtp_username' => 'string',
'smtp_password' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'smtp_username' => null,
'smtp_password' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'smtp_username' => true,
'smtp_password' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'smtp_username' => 'smtpUsername',
'smtp_password' => 'smtpPassword'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'smtp_username' => 'setSmtpUsername',
'smtp_password' => 'setSmtpPassword'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'smtp_username' => 'getSmtpUsername',
'smtp_password' => 'getSmtpPassword'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('smtp_username', $data ?? [], null);
$this->setIfExists('smtp_password', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets smtp_username
*
* @return string|null
*/
public function getSmtpUsername()
{
return $this->container['smtp_username'];
}
/**
* Sets smtp_username
*
* @param string|null $smtp_username SMTP username for login
*
* @return self
*/
public function setSmtpUsername($smtp_username)
{
if (is_null($smtp_username)) {
array_push($this->openAPINullablesSetToNull, 'smtp_username');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('smtp_username', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['smtp_username'] = $smtp_username;
return $this;
}
/**
* Gets smtp_password
*
* @return string|null
*/
public function getSmtpPassword()
{
return $this->container['smtp_password'];
}
/**
* Sets smtp_password
*
* @param string|null $smtp_password SMTP password for login
*
* @return self
*/
public function setSmtpPassword($smtp_password)
{
if (is_null($smtp_password)) {
array_push($this->openAPINullablesSetToNull, 'smtp_password');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('smtp_password', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['smtp_password'] = $smtp_password;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UpdateInboxReplierOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UpdateInboxReplierOptions Class Doc Comment
*
* @category Class
* @description Options for updating an inbox replier
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UpdateInboxReplierOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UpdateInboxReplierOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_id' => 'string',
'name' => 'string',
'field' => 'string',
'match' => 'string',
'reply_to' => 'string',
'subject' => 'string',
'from' => 'string',
'charset' => 'string',
'is_html' => 'bool',
'ignore_reply_to' => 'bool',
'body' => 'string',
'template_id' => 'string',
'template_variables' => 'array<string,object>'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_id' => 'uuid',
'name' => null,
'field' => null,
'match' => null,
'reply_to' => null,
'subject' => null,
'from' => null,
'charset' => null,
'is_html' => null,
'ignore_reply_to' => null,
'body' => null,
'template_id' => 'uuid',
'template_variables' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_id' => false,
'name' => true,
'field' => false,
'match' => false,
'reply_to' => true,
'subject' => true,
'from' => true,
'charset' => true,
'is_html' => true,
'ignore_reply_to' => true,
'body' => true,
'template_id' => true,
'template_variables' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_id' => 'inboxId',
'name' => 'name',
'field' => 'field',
'match' => 'match',
'reply_to' => 'replyTo',
'subject' => 'subject',
'from' => 'from',
'charset' => 'charset',
'is_html' => 'isHTML',
'ignore_reply_to' => 'ignoreReplyTo',
'body' => 'body',
'template_id' => 'templateId',
'template_variables' => 'templateVariables'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_id' => 'setInboxId',
'name' => 'setName',
'field' => 'setField',
'match' => 'setMatch',
'reply_to' => 'setReplyTo',
'subject' => 'setSubject',
'from' => 'setFrom',
'charset' => 'setCharset',
'is_html' => 'setIsHtml',
'ignore_reply_to' => 'setIgnoreReplyTo',
'body' => 'setBody',
'template_id' => 'setTemplateId',
'template_variables' => 'setTemplateVariables'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_id' => 'getInboxId',
'name' => 'getName',
'field' => 'getField',
'match' => 'getMatch',
'reply_to' => 'getReplyTo',
'subject' => 'getSubject',
'from' => 'getFrom',
'charset' => 'getCharset',
'is_html' => 'getIsHtml',
'ignore_reply_to' => 'getIgnoreReplyTo',
'body' => 'getBody',
'template_id' => 'getTemplateId',
'template_variables' => 'getTemplateVariables'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FIELD_RECIPIENTS = 'RECIPIENTS';
public const FIELD_SENDER = 'SENDER';
public const FIELD_SUBJECT = 'SUBJECT';
public const FIELD_ATTACHMENTS = 'ATTACHMENTS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFieldAllowableValues()
{
return [
self::FIELD_RECIPIENTS,
self::FIELD_SENDER,
self::FIELD_SUBJECT,
self::FIELD_ATTACHMENTS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('field', $data ?? [], null);
$this->setIfExists('match', $data ?? [], null);
$this->setIfExists('reply_to', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('ignore_reply_to', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('template_id', $data ?? [], null);
$this->setIfExists('template_variables', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['field'] === null) {
$invalidProperties[] = "'field' can't be null";
}
$allowedValues = $this->getFieldAllowableValues();
if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'field', must be one of '%s'",
$this->container['field'],
implode("', '", $allowedValues)
);
}
if ($this->container['match'] === null) {
$invalidProperties[] = "'match' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Inbox ID to attach replier to
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name for replier
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets field
*
* @return string
*/
public function getField()
{
return $this->container['field'];
}
/**
* Sets field
*
* @param string $field Field to match against to trigger inbox replier for inbound email
*
* @return self
*/
public function setField($field)
{
$allowedValues = $this->getFieldAllowableValues();
if (!in_array($field, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'field', must be one of '%s'",
$field,
implode("', '", $allowedValues)
)
);
}
if (is_null($field)) {
throw new \InvalidArgumentException('non-nullable field cannot be null');
}
$this->container['field'] = $field;
return $this;
}
/**
* Gets match
*
* @return string
*/
public function getMatch()
{
return $this->container['match'];
}
/**
* Sets match
*
* @param string $match String or wildcard style match for field specified when evaluating reply rules
*
* @return self
*/
public function setMatch($match)
{
if (is_null($match)) {
throw new \InvalidArgumentException('non-nullable match cannot be null');
}
$this->container['match'] = $match;
return $this;
}
/**
* Gets reply_to
*
* @return string|null
*/
public function getReplyTo()
{
return $this->container['reply_to'];
}
/**
* Sets reply_to
*
* @param string|null $reply_to Reply-to email address when sending replying
*
* @return self
*/
public function setReplyTo($reply_to)
{
if (is_null($reply_to)) {
array_push($this->openAPINullablesSetToNull, 'reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reply_to'] = $reply_to;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject Subject override when replying to email
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from Send email from address
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset Email reply charset
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets is_html
*
* @return bool|null
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool|null $is_html Send HTML email
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
array_push($this->openAPINullablesSetToNull, 'is_html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('is_html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets ignore_reply_to
*
* @return bool|null
*/
public function getIgnoreReplyTo()
{
return $this->container['ignore_reply_to'];
}
/**
* Sets ignore_reply_to
*
* @param bool|null $ignore_reply_to Ignore sender replyTo when responding. Send directly to the sender if enabled.
*
* @return self
*/
public function setIgnoreReplyTo($ignore_reply_to)
{
if (is_null($ignore_reply_to)) {
array_push($this->openAPINullablesSetToNull, 'ignore_reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('ignore_reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['ignore_reply_to'] = $ignore_reply_to;
return $this;
}
/**
* Gets body
*
* @return string|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string|null $body Email body for reply
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
array_push($this->openAPINullablesSetToNull, 'body');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets template_id
*
* @return string|null
*/
public function getTemplateId()
{
return $this->container['template_id'];
}
/**
* Sets template_id
*
* @param string|null $template_id ID of template to use when sending a reply
*
* @return self
*/
public function setTemplateId($template_id)
{
if (is_null($template_id)) {
array_push($this->openAPINullablesSetToNull, 'template_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_id'] = $template_id;
return $this;
}
/**
* Gets template_variables
*
* @return array<string,object>|null
*/
public function getTemplateVariables()
{
return $this->container['template_variables'];
}
/**
* Sets template_variables
*
* @param array<string,object>|null $template_variables Template variable values
*
* @return self
*/
public function setTemplateVariables($template_variables)
{
if (is_null($template_variables)) {
array_push($this->openAPINullablesSetToNull, 'template_variables');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_variables', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_variables'] = $template_variables;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UpdateInboxOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UpdateInboxOptions Class Doc Comment
*
* @category Class
* @description Options for updating inbox properties
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UpdateInboxOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UpdateInboxOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'description' => 'string',
'tags' => 'string[]',
'expires_at' => '\DateTime',
'favourite' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'description' => null,
'tags' => null,
'expires_at' => 'date-time',
'favourite' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => true,
'description' => true,
'tags' => true,
'expires_at' => true,
'favourite' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'description' => 'description',
'tags' => 'tags',
'expires_at' => 'expiresAt',
'favourite' => 'favourite'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'description' => 'setDescription',
'tags' => 'setTags',
'expires_at' => 'setExpiresAt',
'favourite' => 'setFavourite'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'description' => 'getDescription',
'tags' => 'getTags',
'expires_at' => 'getExpiresAt',
'favourite' => 'getFavourite'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('expires_at', $data ?? [], null);
$this->setIfExists('favourite', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description Description of an inbox for labelling and searching purposes
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
array_push($this->openAPINullablesSetToNull, 'description');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('description', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['description'] = $description;
return $this;
}
/**
* Gets tags
*
* @return string[]|null
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
array_push($this->openAPINullablesSetToNull, 'tags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('tags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets expires_at
*
* @return \DateTime|null
*/
public function getExpiresAt()
{
return $this->container['expires_at'];
}
/**
* Sets expires_at
*
* @param \DateTime|null $expires_at Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email.
*
* @return self
*/
public function setExpiresAt($expires_at)
{
if (is_null($expires_at)) {
array_push($this->openAPINullablesSetToNull, 'expires_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('expires_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['expires_at'] = $expires_at;
return $this;
}
/**
* Gets favourite
*
* @return bool|null
*/
public function getFavourite()
{
return $this->container['favourite'];
}
/**
* Sets favourite
*
* @param bool|null $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering
*
* @return self
*/
public function setFavourite($favourite)
{
if (is_null($favourite)) {
array_push($this->openAPINullablesSetToNull, 'favourite');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('favourite', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['favourite'] = $favourite;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UpdateImapAccessOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UpdateImapAccessOptions Class Doc Comment
*
* @category Class
* @description Edit access details for inbox using IMAP
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UpdateImapAccessOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UpdateImapAccessOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'imap_username' => 'string',
'imap_password' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'imap_username' => null,
'imap_password' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'imap_username' => true,
'imap_password' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'imap_username' => 'imapUsername',
'imap_password' => 'imapPassword'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'imap_username' => 'setImapUsername',
'imap_password' => 'setImapPassword'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'imap_username' => 'getImapUsername',
'imap_password' => 'getImapPassword'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('imap_username', $data ?? [], null);
$this->setIfExists('imap_password', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets imap_username
*
* @return string|null
*/
public function getImapUsername()
{
return $this->container['imap_username'];
}
/**
* Sets imap_username
*
* @param string|null $imap_username IMAP username for login
*
* @return self
*/
public function setImapUsername($imap_username)
{
if (is_null($imap_username)) {
array_push($this->openAPINullablesSetToNull, 'imap_username');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('imap_username', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['imap_username'] = $imap_username;
return $this;
}
/**
* Gets imap_password
*
* @return string|null
*/
public function getImapPassword()
{
return $this->container['imap_password'];
}
/**
* Sets imap_password
*
* @param string|null $imap_password IMAP password for login
*
* @return self
*/
public function setImapPassword($imap_password)
{
if (is_null($imap_password)) {
array_push($this->openAPINullablesSetToNull, 'imap_password');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('imap_password', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['imap_password'] = $imap_password;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UpdateGroupContacts
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UpdateGroupContacts Class Doc Comment
*
* @category Class
* @description Update group contacts options. Pass a list of contact ids to replace existing group contacts.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UpdateGroupContacts implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UpdateGroupContacts';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'contact_ids' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'contact_ids' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'contact_ids' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'contact_ids' => 'contactIds'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'contact_ids' => 'setContactIds'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'contact_ids' => 'getContactIds'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('contact_ids', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['contact_ids'] === null) {
$invalidProperties[] = "'contact_ids' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets contact_ids
*
* @return string[]
*/
public function getContactIds()
{
return $this->container['contact_ids'];
}
/**
* Sets contact_ids
*
* @param string[] $contact_ids contact_ids
*
* @return self
*/
public function setContactIds($contact_ids)
{
if (is_null($contact_ids)) {
throw new \InvalidArgumentException('non-nullable contact_ids cannot be null');
}
$this->container['contact_ids'] = $contact_ids;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UpdateDomainOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UpdateDomainOptions Class Doc Comment
*
* @category Class
* @description Options for creating a domain to use with MailSlurp. You must have ownership access to this domain in order to verify it. Domains will not functionally currently until the domain has been verified. See https://www.mailslurp.com/guides/custom-domains for help.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UpdateDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UpdateDomainOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'catch_all_inbox_id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'catch_all_inbox_id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'catch_all_inbox_id' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'catch_all_inbox_id' => 'catchAllInboxId'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'catch_all_inbox_id' => 'setCatchAllInboxId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'catch_all_inbox_id' => 'getCatchAllInboxId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('catch_all_inbox_id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets catch_all_inbox_id
*
* @return string|null
*/
public function getCatchAllInboxId()
{
return $this->container['catch_all_inbox_id'];
}
/**
* Sets catch_all_inbox_id
*
* @param string|null $catch_all_inbox_id catch_all_inbox_id
*
* @return self
*/
public function setCatchAllInboxId($catch_all_inbox_id)
{
if (is_null($catch_all_inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'catch_all_inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('catch_all_inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['catch_all_inbox_id'] = $catch_all_inbox_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UpdateAliasOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UpdateAliasOptions Class Doc Comment
*
* @category Class
* @description Update an email alias
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UpdateAliasOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UpdateAliasOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Optional name for alias
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UnseenErrorCountDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UnseenErrorCountDto Class Doc Comment
*
* @category Class
* @description Number of unseen errors
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UnseenErrorCountDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UnseenErrorCountDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'count' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'count' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'count' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'count' => 'count'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'count' => 'setCount'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'count' => 'getCount'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('count', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['count'] === null) {
$invalidProperties[] = "'count' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets count
*
* @return int
*/
public function getCount()
{
return $this->container['count'];
}
/**
* Sets count
*
* @param int $count count
*
* @return self
*/
public function setCount($count)
{
if (is_null($count)) {
throw new \InvalidArgumentException('non-nullable count cannot be null');
}
$this->container['count'] = $count;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UnreadCount
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UnreadCount Class Doc Comment
*
* @category Class
* @description Number of unread entities
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UnreadCount implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UnreadCount';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'count' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'count' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'count' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'count' => 'count'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'count' => 'setCount'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'count' => 'getCount'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('count', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['count'] === null) {
$invalidProperties[] = "'count' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets count
*
* @return int
*/
public function getCount()
{
return $this->container['count'];
}
/**
* Sets count
*
* @param int $count count
*
* @return self
*/
public function setCount($count)
{
if (is_null($count)) {
throw new \InvalidArgumentException('non-nullable count cannot be null');
}
$this->container['count'] = $count;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* UnknownMissedEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* UnknownMissedEmailProjection Class Doc Comment
*
* @category Class
* @description Unknown missed email projection
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class UnknownMissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'UnknownMissedEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'to' => 'string[]',
'subject' => 'string',
'id' => 'string',
'from' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'to' => null,
'subject' => null,
'id' => 'uuid',
'from' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'to' => false,
'subject' => false,
'id' => false,
'from' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'to' => 'to',
'subject' => 'subject',
'id' => 'id',
'from' => 'from'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'to' => 'setTo',
'subject' => 'setSubject',
'id' => 'setId',
'from' => 'setFrom'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'to' => 'getTo',
'subject' => 'getSubject',
'id' => 'getId',
'from' => 'getFrom'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets to
*
* @return string[]|null
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[]|null $to to
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from from
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
throw new \InvalidArgumentException('non-nullable from cannot be null');
}
$this->container['from'] = $from;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TrackingPixelProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TrackingPixelProjection Class Doc Comment
*
* @category Class
* @description Tracking pixel data
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TrackingPixelProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TrackingPixelProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'inbox_id' => 'string',
'user_id' => 'string',
'sent_email_id' => 'string',
'recipient' => 'string',
'seen' => 'bool',
'seen_at' => '\DateTime',
'name' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'inbox_id' => 'uuid',
'user_id' => 'uuid',
'sent_email_id' => 'uuid',
'recipient' => null,
'seen' => null,
'seen_at' => 'date-time',
'name' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'inbox_id' => false,
'user_id' => false,
'sent_email_id' => false,
'recipient' => false,
'seen' => false,
'seen_at' => false,
'name' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'inbox_id' => 'inboxId',
'user_id' => 'userId',
'sent_email_id' => 'sentEmailId',
'recipient' => 'recipient',
'seen' => 'seen',
'seen_at' => 'seenAt',
'name' => 'name',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'inbox_id' => 'setInboxId',
'user_id' => 'setUserId',
'sent_email_id' => 'setSentEmailId',
'recipient' => 'setRecipient',
'seen' => 'setSeen',
'seen_at' => 'setSeenAt',
'name' => 'setName',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'inbox_id' => 'getInboxId',
'user_id' => 'getUserId',
'sent_email_id' => 'getSentEmailId',
'recipient' => 'getRecipient',
'seen' => 'getSeen',
'seen_at' => 'getSeenAt',
'name' => 'getName',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('sent_email_id', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
$this->setIfExists('seen', $data ?? [], null);
$this->setIfExists('seen_at', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['seen'] === null) {
$invalidProperties[] = "'seen' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets sent_email_id
*
* @return string|null
*/
public function getSentEmailId()
{
return $this->container['sent_email_id'];
}
/**
* Sets sent_email_id
*
* @param string|null $sent_email_id sent_email_id
*
* @return self
*/
public function setSentEmailId($sent_email_id)
{
if (is_null($sent_email_id)) {
throw new \InvalidArgumentException('non-nullable sent_email_id cannot be null');
}
$this->container['sent_email_id'] = $sent_email_id;
return $this;
}
/**
* Gets recipient
*
* @return string|null
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string|null $recipient recipient
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
throw new \InvalidArgumentException('non-nullable recipient cannot be null');
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Gets seen
*
* @return bool
*/
public function getSeen()
{
return $this->container['seen'];
}
/**
* Sets seen
*
* @param bool $seen seen
*
* @return self
*/
public function setSeen($seen)
{
if (is_null($seen)) {
throw new \InvalidArgumentException('non-nullable seen cannot be null');
}
$this->container['seen'] = $seen;
return $this;
}
/**
* Gets seen_at
*
* @return \DateTime|null
*/
public function getSeenAt()
{
return $this->container['seen_at'];
}
/**
* Sets seen_at
*
* @param \DateTime|null $seen_at seen_at
*
* @return self
*/
public function setSeenAt($seen_at)
{
if (is_null($seen_at)) {
throw new \InvalidArgumentException('non-nullable seen_at cannot be null');
}
$this->container['seen_at'] = $seen_at;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TrackingPixelDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TrackingPixelDto Class Doc Comment
*
* @category Class
* @description Tracking pixel
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TrackingPixelDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TrackingPixelDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'seen' => 'bool',
'recipient' => 'string',
'html' => 'string',
'url' => 'string',
'inbox_id' => 'string',
'sent_email_id' => 'string',
'seen_at' => '\DateTime',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'seen' => null,
'recipient' => null,
'html' => null,
'url' => null,
'inbox_id' => 'uuid',
'sent_email_id' => 'uuid',
'seen_at' => 'date-time',
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'seen' => false,
'recipient' => true,
'html' => false,
'url' => false,
'inbox_id' => true,
'sent_email_id' => true,
'seen_at' => true,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'seen' => 'seen',
'recipient' => 'recipient',
'html' => 'html',
'url' => 'url',
'inbox_id' => 'inboxId',
'sent_email_id' => 'sentEmailId',
'seen_at' => 'seenAt',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'seen' => 'setSeen',
'recipient' => 'setRecipient',
'html' => 'setHtml',
'url' => 'setUrl',
'inbox_id' => 'setInboxId',
'sent_email_id' => 'setSentEmailId',
'seen_at' => 'setSeenAt',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'seen' => 'getSeen',
'recipient' => 'getRecipient',
'html' => 'getHtml',
'url' => 'getUrl',
'inbox_id' => 'getInboxId',
'sent_email_id' => 'getSentEmailId',
'seen_at' => 'getSeenAt',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('seen', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
$this->setIfExists('html', $data ?? [], null);
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('sent_email_id', $data ?? [], null);
$this->setIfExists('seen_at', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['seen'] === null) {
$invalidProperties[] = "'seen' can't be null";
}
if ($this->container['html'] === null) {
$invalidProperties[] = "'html' can't be null";
}
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets seen
*
* @return bool
*/
public function getSeen()
{
return $this->container['seen'];
}
/**
* Sets seen
*
* @param bool $seen seen
*
* @return self
*/
public function setSeen($seen)
{
if (is_null($seen)) {
throw new \InvalidArgumentException('non-nullable seen cannot be null');
}
$this->container['seen'] = $seen;
return $this;
}
/**
* Gets recipient
*
* @return string|null
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string|null $recipient recipient
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
array_push($this->openAPINullablesSetToNull, 'recipient');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('recipient', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Gets html
*
* @return string
*/
public function getHtml()
{
return $this->container['html'];
}
/**
* Sets html
*
* @param string $html html
*
* @return self
*/
public function setHtml($html)
{
if (is_null($html)) {
throw new \InvalidArgumentException('non-nullable html cannot be null');
}
$this->container['html'] = $html;
return $this;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url url
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets sent_email_id
*
* @return string|null
*/
public function getSentEmailId()
{
return $this->container['sent_email_id'];
}
/**
* Sets sent_email_id
*
* @param string|null $sent_email_id sent_email_id
*
* @return self
*/
public function setSentEmailId($sent_email_id)
{
if (is_null($sent_email_id)) {
array_push($this->openAPINullablesSetToNull, 'sent_email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_email_id'] = $sent_email_id;
return $this;
}
/**
* Gets seen_at
*
* @return \DateTime|null
*/
public function getSeenAt()
{
return $this->container['seen_at'];
}
/**
* Sets seen_at
*
* @param \DateTime|null $seen_at seen_at
*
* @return self
*/
public function setSeenAt($seen_at)
{
if (is_null($seen_at)) {
array_push($this->openAPINullablesSetToNull, 'seen_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('seen_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['seen_at'] = $seen_at;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ThreadProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ThreadProjection Class Doc Comment
*
* @category Class
* @description A thread is a message thread created for a message received by an alias
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ThreadProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ThreadProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'inbox_id' => 'string',
'user_id' => 'string',
'to' => 'string[]',
'bcc' => 'string[]',
'cc' => 'string[]',
'alias_id' => 'string',
'subject' => 'string',
'name' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'updated_at' => 'date-time',
'inbox_id' => 'uuid',
'user_id' => 'uuid',
'to' => null,
'bcc' => null,
'cc' => null,
'alias_id' => 'uuid',
'subject' => null,
'name' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'updated_at' => false,
'inbox_id' => false,
'user_id' => false,
'to' => false,
'bcc' => false,
'cc' => false,
'alias_id' => false,
'subject' => false,
'name' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'inbox_id' => 'inboxId',
'user_id' => 'userId',
'to' => 'to',
'bcc' => 'bcc',
'cc' => 'cc',
'alias_id' => 'aliasId',
'subject' => 'subject',
'name' => 'name',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'inbox_id' => 'setInboxId',
'user_id' => 'setUserId',
'to' => 'setTo',
'bcc' => 'setBcc',
'cc' => 'setCc',
'alias_id' => 'setAliasId',
'subject' => 'setSubject',
'name' => 'setName',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'inbox_id' => 'getInboxId',
'user_id' => 'getUserId',
'to' => 'getTo',
'bcc' => 'getBcc',
'cc' => 'getCc',
'alias_id' => 'getAliasId',
'subject' => 'getSubject',
'name' => 'getName',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('alias_id', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
if ($this->container['alias_id'] === null) {
$invalidProperties[] = "'alias_id' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at Created at DateTime
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at Updated at DateTime
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Inbox ID
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id User ID
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to To recipients
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets bcc
*
* @return string[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[]|null $bcc BCC recipients
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
throw new \InvalidArgumentException('non-nullable bcc cannot be null');
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets cc
*
* @return string[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[]|null $cc CC recipients
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
throw new \InvalidArgumentException('non-nullable cc cannot be null');
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets alias_id
*
* @return string
*/
public function getAliasId()
{
return $this->container['alias_id'];
}
/**
* Sets alias_id
*
* @param string $alias_id Alias ID
*
* @return self
*/
public function setAliasId($alias_id)
{
if (is_null($alias_id)) {
throw new \InvalidArgumentException('non-nullable alias_id cannot be null');
}
$this->container['alias_id'] = $alias_id;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject Thread subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of thread
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of email thread
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TestPhoneNumberOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TestPhoneNumberOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TestPhoneNumberOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TestPhoneNumberOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['message'] === null) {
$invalidProperties[] = "'message' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message
*
* @return string
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TestNewInboxRulesetOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TestNewInboxRulesetOptions Class Doc Comment
*
* @category Class
* @description Test inbox ruleset options
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TestNewInboxRulesetOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TestNewInboxRulesetOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_ruleset_test_options' => '\MailSlurp\Models\InboxRulesetTestOptions',
'create_inbox_ruleset_options' => '\MailSlurp\Models\CreateInboxRulesetOptions'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_ruleset_test_options' => null,
'create_inbox_ruleset_options' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_ruleset_test_options' => false,
'create_inbox_ruleset_options' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_ruleset_test_options' => 'inboxRulesetTestOptions',
'create_inbox_ruleset_options' => 'createInboxRulesetOptions'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_ruleset_test_options' => 'setInboxRulesetTestOptions',
'create_inbox_ruleset_options' => 'setCreateInboxRulesetOptions'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_ruleset_test_options' => 'getInboxRulesetTestOptions',
'create_inbox_ruleset_options' => 'getCreateInboxRulesetOptions'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_ruleset_test_options', $data ?? [], null);
$this->setIfExists('create_inbox_ruleset_options', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_ruleset_test_options'] === null) {
$invalidProperties[] = "'inbox_ruleset_test_options' can't be null";
}
if ($this->container['create_inbox_ruleset_options'] === null) {
$invalidProperties[] = "'create_inbox_ruleset_options' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_ruleset_test_options
*
* @return \MailSlurp\Models\InboxRulesetTestOptions
*/
public function getInboxRulesetTestOptions()
{
return $this->container['inbox_ruleset_test_options'];
}
/**
* Sets inbox_ruleset_test_options
*
* @param \MailSlurp\Models\InboxRulesetTestOptions $inbox_ruleset_test_options inbox_ruleset_test_options
*
* @return self
*/
public function setInboxRulesetTestOptions($inbox_ruleset_test_options)
{
if (is_null($inbox_ruleset_test_options)) {
throw new \InvalidArgumentException('non-nullable inbox_ruleset_test_options cannot be null');
}
$this->container['inbox_ruleset_test_options'] = $inbox_ruleset_test_options;
return $this;
}
/**
* Gets create_inbox_ruleset_options
*
* @return \MailSlurp\Models\CreateInboxRulesetOptions
*/
public function getCreateInboxRulesetOptions()
{
return $this->container['create_inbox_ruleset_options'];
}
/**
* Sets create_inbox_ruleset_options
*
* @param \MailSlurp\Models\CreateInboxRulesetOptions $create_inbox_ruleset_options create_inbox_ruleset_options
*
* @return self
*/
public function setCreateInboxRulesetOptions($create_inbox_ruleset_options)
{
if (is_null($create_inbox_ruleset_options)) {
throw new \InvalidArgumentException('non-nullable create_inbox_ruleset_options cannot be null');
}
$this->container['create_inbox_ruleset_options'] = $create_inbox_ruleset_options;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TestNewInboxForwarderOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TestNewInboxForwarderOptions Class Doc Comment
*
* @category Class
* @description Options for testing new inbox forwarder rules
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TestNewInboxForwarderOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TestNewInboxForwarderOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_forwarder_test_options' => '\MailSlurp\Models\InboxForwarderTestOptions',
'create_inbox_forwarder_options' => '\MailSlurp\Models\CreateInboxForwarderOptions'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_forwarder_test_options' => null,
'create_inbox_forwarder_options' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_forwarder_test_options' => false,
'create_inbox_forwarder_options' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_forwarder_test_options' => 'inboxForwarderTestOptions',
'create_inbox_forwarder_options' => 'createInboxForwarderOptions'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_forwarder_test_options' => 'setInboxForwarderTestOptions',
'create_inbox_forwarder_options' => 'setCreateInboxForwarderOptions'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_forwarder_test_options' => 'getInboxForwarderTestOptions',
'create_inbox_forwarder_options' => 'getCreateInboxForwarderOptions'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_forwarder_test_options', $data ?? [], null);
$this->setIfExists('create_inbox_forwarder_options', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_forwarder_test_options'] === null) {
$invalidProperties[] = "'inbox_forwarder_test_options' can't be null";
}
if ($this->container['create_inbox_forwarder_options'] === null) {
$invalidProperties[] = "'create_inbox_forwarder_options' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_forwarder_test_options
*
* @return \MailSlurp\Models\InboxForwarderTestOptions
*/
public function getInboxForwarderTestOptions()
{
return $this->container['inbox_forwarder_test_options'];
}
/**
* Sets inbox_forwarder_test_options
*
* @param \MailSlurp\Models\InboxForwarderTestOptions $inbox_forwarder_test_options inbox_forwarder_test_options
*
* @return self
*/
public function setInboxForwarderTestOptions($inbox_forwarder_test_options)
{
if (is_null($inbox_forwarder_test_options)) {
throw new \InvalidArgumentException('non-nullable inbox_forwarder_test_options cannot be null');
}
$this->container['inbox_forwarder_test_options'] = $inbox_forwarder_test_options;
return $this;
}
/**
* Gets create_inbox_forwarder_options
*
* @return \MailSlurp\Models\CreateInboxForwarderOptions
*/
public function getCreateInboxForwarderOptions()
{
return $this->container['create_inbox_forwarder_options'];
}
/**
* Sets create_inbox_forwarder_options
*
* @param \MailSlurp\Models\CreateInboxForwarderOptions $create_inbox_forwarder_options create_inbox_forwarder_options
*
* @return self
*/
public function setCreateInboxForwarderOptions($create_inbox_forwarder_options)
{
if (is_null($create_inbox_forwarder_options)) {
throw new \InvalidArgumentException('non-nullable create_inbox_forwarder_options cannot be null');
}
$this->container['create_inbox_forwarder_options'] = $create_inbox_forwarder_options;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TestInboxRulesetSendingResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TestInboxRulesetSendingResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TestInboxRulesetSendingResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TestInboxRulesetSendingResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'can_send' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'can_send' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'can_send' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'can_send' => 'canSend'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'can_send' => 'setCanSend'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'can_send' => 'getCanSend'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('can_send', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['can_send'] === null) {
$invalidProperties[] = "'can_send' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets can_send
*
* @return bool
*/
public function getCanSend()
{
return $this->container['can_send'];
}
/**
* Sets can_send
*
* @param bool $can_send can_send
*
* @return self
*/
public function setCanSend($can_send)
{
if (is_null($can_send)) {
throw new \InvalidArgumentException('non-nullable can_send cannot be null');
}
$this->container['can_send'] = $can_send;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TestInboxRulesetSendingOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TestInboxRulesetSendingOptions Class Doc Comment
*
* @category Class
* @description Test options for inbox ruleset sending test
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TestInboxRulesetSendingOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TestInboxRulesetSendingOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_id' => 'string',
'recipient' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_id' => 'uuid',
'recipient' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_id' => false,
'recipient' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_id' => 'inboxId',
'recipient' => 'recipient'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_id' => 'setInboxId',
'recipient' => 'setRecipient'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_id' => 'getInboxId',
'recipient' => 'getRecipient'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['recipient'] === null) {
$invalidProperties[] = "'recipient' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets recipient
*
* @return string
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string $recipient recipient
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
throw new \InvalidArgumentException('non-nullable recipient cannot be null');
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TestInboxRulesetReceivingResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TestInboxRulesetReceivingResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TestInboxRulesetReceivingResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TestInboxRulesetReceivingResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'can_receive' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'can_receive' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'can_receive' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'can_receive' => 'canReceive'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'can_receive' => 'setCanReceive'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'can_receive' => 'getCanReceive'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('can_receive', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['can_receive'] === null) {
$invalidProperties[] = "'can_receive' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets can_receive
*
* @return bool
*/
public function getCanReceive()
{
return $this->container['can_receive'];
}
/**
* Sets can_receive
*
* @param bool $can_receive can_receive
*
* @return self
*/
public function setCanReceive($can_receive)
{
if (is_null($can_receive)) {
throw new \InvalidArgumentException('non-nullable can_receive cannot be null');
}
$this->container['can_receive'] = $can_receive;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TestInboxRulesetReceivingOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TestInboxRulesetReceivingOptions Class Doc Comment
*
* @category Class
* @description Test options for inbox ruleset receiving test
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TestInboxRulesetReceivingOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TestInboxRulesetReceivingOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_id' => 'string',
'from_sender' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_id' => 'uuid',
'from_sender' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_id' => false,
'from_sender' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_id' => 'inboxId',
'from_sender' => 'fromSender'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_id' => 'setInboxId',
'from_sender' => 'setFromSender'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_id' => 'getInboxId',
'from_sender' => 'getFromSender'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('from_sender', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['from_sender'] === null) {
$invalidProperties[] = "'from_sender' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets from_sender
*
* @return string
*/
public function getFromSender()
{
return $this->container['from_sender'];
}
/**
* Sets from_sender
*
* @param string $from_sender from_sender
*
* @return self
*/
public function setFromSender($from_sender)
{
if (is_null($from_sender)) {
throw new \InvalidArgumentException('non-nullable from_sender cannot be null');
}
$this->container['from_sender'] = $from_sender;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TemplateVariable
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TemplateVariable Class Doc Comment
*
* @category Class
* @description Variable for use with email template
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TemplateVariable implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TemplateVariable';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'variable_type' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'variable_type' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'variable_type' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'variable_type' => 'variableType'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'variable_type' => 'setVariableType'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'variable_type' => 'getVariableType'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const VARIABLE_TYPE_STRING = 'STRING';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getVariableTypeAllowableValues()
{
return [
self::VARIABLE_TYPE_STRING,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('variable_type', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['variable_type'] === null) {
$invalidProperties[] = "'variable_type' can't be null";
}
$allowedValues = $this->getVariableTypeAllowableValues();
if (!is_null($this->container['variable_type']) && !in_array($this->container['variable_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'variable_type', must be one of '%s'",
$this->container['variable_type'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name Name of variable. This can be used in a template as {{name}}
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets variable_type
*
* @return string
*/
public function getVariableType()
{
return $this->container['variable_type'];
}
/**
* Sets variable_type
*
* @param string $variable_type The type of variable
*
* @return self
*/
public function setVariableType($variable_type)
{
$allowedValues = $this->getVariableTypeAllowableValues();
if (!in_array($variable_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'variable_type', must be one of '%s'",
$variable_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($variable_type)) {
throw new \InvalidArgumentException('non-nullable variable_type cannot be null');
}
$this->container['variable_type'] = $variable_type;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TemplateProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TemplateProjection Class Doc Comment
*
* @category Class
* @description Email template data
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TemplateProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TemplateProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'variables' => 'string[]',
'name' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'updated_at' => 'date-time',
'variables' => null,
'name' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'updated_at' => false,
'variables' => false,
'name' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'variables' => 'variables',
'name' => 'name',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'variables' => 'setVariables',
'name' => 'setName',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'variables' => 'getVariables',
'name' => 'getName',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('variables', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['variables'] === null) {
$invalidProperties[] = "'variables' can't be null";
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets variables
*
* @return string[]
*/
public function getVariables()
{
return $this->container['variables'];
}
/**
* Sets variables
*
* @param string[] $variables variables
*
* @return self
*/
public function setVariables($variables)
{
if (is_null($variables)) {
throw new \InvalidArgumentException('non-nullable variables cannot be null');
}
$this->container['variables'] = $variables;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TemplatePreview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TemplatePreview Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TemplatePreview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TemplatePreview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'preview' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'preview' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'preview' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'preview' => 'preview'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'preview' => 'setPreview'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'preview' => 'getPreview'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('preview', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['preview'] === null) {
$invalidProperties[] = "'preview' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets preview
*
* @return string
*/
public function getPreview()
{
return $this->container['preview'];
}
/**
* Sets preview
*
* @param string $preview preview
*
* @return self
*/
public function setPreview($preview)
{
if (is_null($preview)) {
throw new \InvalidArgumentException('non-nullable preview cannot be null');
}
$this->container['preview'] = $preview;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* TemplateDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* TemplateDto Class Doc Comment
*
* @category Class
* @description Email template
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class TemplateDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'TemplateDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'name' => 'string',
'variables' => '\MailSlurp\Models\TemplateVariable[]',
'content' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'name' => null,
'variables' => null,
'content' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'name' => false,
'variables' => false,
'content' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'name' => 'name',
'variables' => 'variables',
'content' => 'content',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'name' => 'setName',
'variables' => 'setVariables',
'content' => 'setContent',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'name' => 'getName',
'variables' => 'getVariables',
'content' => 'getContent',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('variables', $data ?? [], null);
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['variables'] === null) {
$invalidProperties[] = "'variables' can't be null";
}
if ($this->container['content'] === null) {
$invalidProperties[] = "'content' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of template
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name Template name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets variables
*
* @return \MailSlurp\Models\TemplateVariable[]
*/
public function getVariables()
{
return $this->container['variables'];
}
/**
* Sets variables
*
* @param \MailSlurp\Models\TemplateVariable[] $variables Variables available in template that can be replaced with values
*
* @return self
*/
public function setVariables($variables)
{
if (is_null($variables)) {
throw new \InvalidArgumentException('non-nullable variables cannot be null');
}
$this->container['variables'] = $variables;
return $this;
}
/**
* Gets content
*
* @return string
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param string $content Content of the template
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at Created at time
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SpellingIssue
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SpellingIssue Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SpellingIssue implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SpellingIssue';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'group' => 'string',
'suggestion' => 'string',
'severity' => 'string',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'group' => null,
'suggestion' => null,
'severity' => null,
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'group' => false,
'suggestion' => false,
'severity' => false,
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'group' => 'group',
'suggestion' => 'suggestion',
'severity' => 'severity',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'group' => 'setGroup',
'suggestion' => 'setSuggestion',
'severity' => 'setSeverity',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'group' => 'getGroup',
'suggestion' => 'getSuggestion',
'severity' => 'getSeverity',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SEVERITY_WARNING = 'Warning';
public const SEVERITY_ERROR = 'Error';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSeverityAllowableValues()
{
return [
self::SEVERITY_WARNING,
self::SEVERITY_ERROR,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('group', $data ?? [], null);
$this->setIfExists('suggestion', $data ?? [], null);
$this->setIfExists('severity', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['group'] === null) {
$invalidProperties[] = "'group' can't be null";
}
if ($this->container['suggestion'] === null) {
$invalidProperties[] = "'suggestion' can't be null";
}
if ($this->container['severity'] === null) {
$invalidProperties[] = "'severity' can't be null";
}
$allowedValues = $this->getSeverityAllowableValues();
if (!is_null($this->container['severity']) && !in_array($this->container['severity'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'severity', must be one of '%s'",
$this->container['severity'],
implode("', '", $allowedValues)
);
}
if ($this->container['message'] === null) {
$invalidProperties[] = "'message' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets group
*
* @return string
*/
public function getGroup()
{
return $this->container['group'];
}
/**
* Sets group
*
* @param string $group group
*
* @return self
*/
public function setGroup($group)
{
if (is_null($group)) {
throw new \InvalidArgumentException('non-nullable group cannot be null');
}
$this->container['group'] = $group;
return $this;
}
/**
* Gets suggestion
*
* @return string
*/
public function getSuggestion()
{
return $this->container['suggestion'];
}
/**
* Sets suggestion
*
* @param string $suggestion suggestion
*
* @return self
*/
public function setSuggestion($suggestion)
{
if (is_null($suggestion)) {
throw new \InvalidArgumentException('non-nullable suggestion cannot be null');
}
$this->container['suggestion'] = $suggestion;
return $this;
}
/**
* Gets severity
*
* @return string
*/
public function getSeverity()
{
return $this->container['severity'];
}
/**
* Sets severity
*
* @param string $severity severity
*
* @return self
*/
public function setSeverity($severity)
{
$allowedValues = $this->getSeverityAllowableValues();
if (!in_array($severity, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'severity', must be one of '%s'",
$severity,
implode("', '", $allowedValues)
)
);
}
if (is_null($severity)) {
throw new \InvalidArgumentException('non-nullable severity cannot be null');
}
$this->container['severity'] = $severity;
return $this;
}
/**
* Gets message
*
* @return string
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SortObject
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SortObject Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SortObject implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SortObject';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'sorted' => 'bool',
'unsorted' => 'bool',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'sorted' => null,
'unsorted' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'sorted' => false,
'unsorted' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'sorted' => 'sorted',
'unsorted' => 'unsorted',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'sorted' => 'setSorted',
'unsorted' => 'setUnsorted',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'sorted' => 'getSorted',
'unsorted' => 'getUnsorted',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('sorted', $data ?? [], null);
$this->setIfExists('unsorted', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets sorted
*
* @return bool|null
*/
public function getSorted()
{
return $this->container['sorted'];
}
/**
* Sets sorted
*
* @param bool|null $sorted sorted
*
* @return self
*/
public function setSorted($sorted)
{
if (is_null($sorted)) {
throw new \InvalidArgumentException('non-nullable sorted cannot be null');
}
$this->container['sorted'] = $sorted;
return $this;
}
/**
* Gets unsorted
*
* @return bool|null
*/
public function getUnsorted()
{
return $this->container['unsorted'];
}
/**
* Sets unsorted
*
* @param bool|null $unsorted unsorted
*
* @return self
*/
public function setUnsorted($unsorted)
{
if (is_null($unsorted)) {
throw new \InvalidArgumentException('non-nullable unsorted cannot be null');
}
$this->container['unsorted'] = $unsorted;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SmtpAccessDetails
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SmtpAccessDetails Class Doc Comment
*
* @category Class
* @description Access details for inbox using SMTP
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SmtpAccessDetails implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SmtpAccessDetails';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'secure_smtp_server_host' => 'string',
'secure_smtp_server_port' => 'int',
'secure_smtp_username' => 'string',
'secure_smtp_password' => 'string',
'smtp_server_host' => 'string',
'smtp_server_port' => 'int',
'smtp_username' => 'string',
'smtp_password' => 'string',
'mail_from_domain' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'secure_smtp_server_host' => null,
'secure_smtp_server_port' => 'int32',
'secure_smtp_username' => null,
'secure_smtp_password' => null,
'smtp_server_host' => null,
'smtp_server_port' => 'int32',
'smtp_username' => null,
'smtp_password' => null,
'mail_from_domain' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'secure_smtp_server_host' => false,
'secure_smtp_server_port' => false,
'secure_smtp_username' => false,
'secure_smtp_password' => false,
'smtp_server_host' => false,
'smtp_server_port' => false,
'smtp_username' => false,
'smtp_password' => false,
'mail_from_domain' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'secure_smtp_server_host' => 'secureSmtpServerHost',
'secure_smtp_server_port' => 'secureSmtpServerPort',
'secure_smtp_username' => 'secureSmtpUsername',
'secure_smtp_password' => 'secureSmtpPassword',
'smtp_server_host' => 'smtpServerHost',
'smtp_server_port' => 'smtpServerPort',
'smtp_username' => 'smtpUsername',
'smtp_password' => 'smtpPassword',
'mail_from_domain' => 'mailFromDomain'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'secure_smtp_server_host' => 'setSecureSmtpServerHost',
'secure_smtp_server_port' => 'setSecureSmtpServerPort',
'secure_smtp_username' => 'setSecureSmtpUsername',
'secure_smtp_password' => 'setSecureSmtpPassword',
'smtp_server_host' => 'setSmtpServerHost',
'smtp_server_port' => 'setSmtpServerPort',
'smtp_username' => 'setSmtpUsername',
'smtp_password' => 'setSmtpPassword',
'mail_from_domain' => 'setMailFromDomain'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'secure_smtp_server_host' => 'getSecureSmtpServerHost',
'secure_smtp_server_port' => 'getSecureSmtpServerPort',
'secure_smtp_username' => 'getSecureSmtpUsername',
'secure_smtp_password' => 'getSecureSmtpPassword',
'smtp_server_host' => 'getSmtpServerHost',
'smtp_server_port' => 'getSmtpServerPort',
'smtp_username' => 'getSmtpUsername',
'smtp_password' => 'getSmtpPassword',
'mail_from_domain' => 'getMailFromDomain'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('secure_smtp_server_host', $data ?? [], null);
$this->setIfExists('secure_smtp_server_port', $data ?? [], null);
$this->setIfExists('secure_smtp_username', $data ?? [], null);
$this->setIfExists('secure_smtp_password', $data ?? [], null);
$this->setIfExists('smtp_server_host', $data ?? [], null);
$this->setIfExists('smtp_server_port', $data ?? [], null);
$this->setIfExists('smtp_username', $data ?? [], null);
$this->setIfExists('smtp_password', $data ?? [], null);
$this->setIfExists('mail_from_domain', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['secure_smtp_server_host'] === null) {
$invalidProperties[] = "'secure_smtp_server_host' can't be null";
}
if ($this->container['secure_smtp_server_port'] === null) {
$invalidProperties[] = "'secure_smtp_server_port' can't be null";
}
if ($this->container['secure_smtp_username'] === null) {
$invalidProperties[] = "'secure_smtp_username' can't be null";
}
if ($this->container['secure_smtp_password'] === null) {
$invalidProperties[] = "'secure_smtp_password' can't be null";
}
if ($this->container['smtp_server_host'] === null) {
$invalidProperties[] = "'smtp_server_host' can't be null";
}
if ($this->container['smtp_server_port'] === null) {
$invalidProperties[] = "'smtp_server_port' can't be null";
}
if ($this->container['smtp_username'] === null) {
$invalidProperties[] = "'smtp_username' can't be null";
}
if ($this->container['smtp_password'] === null) {
$invalidProperties[] = "'smtp_password' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets secure_smtp_server_host
*
* @return string
*/
public function getSecureSmtpServerHost()
{
return $this->container['secure_smtp_server_host'];
}
/**
* Sets secure_smtp_server_host
*
* @param string $secure_smtp_server_host Secure TLS SMTP server host domain
*
* @return self
*/
public function setSecureSmtpServerHost($secure_smtp_server_host)
{
if (is_null($secure_smtp_server_host)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_server_host cannot be null');
}
$this->container['secure_smtp_server_host'] = $secure_smtp_server_host;
return $this;
}
/**
* Gets secure_smtp_server_port
*
* @return int
*/
public function getSecureSmtpServerPort()
{
return $this->container['secure_smtp_server_port'];
}
/**
* Sets secure_smtp_server_port
*
* @param int $secure_smtp_server_port Secure TLS SMTP server host port
*
* @return self
*/
public function setSecureSmtpServerPort($secure_smtp_server_port)
{
if (is_null($secure_smtp_server_port)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_server_port cannot be null');
}
$this->container['secure_smtp_server_port'] = $secure_smtp_server_port;
return $this;
}
/**
* Gets secure_smtp_username
*
* @return string
*/
public function getSecureSmtpUsername()
{
return $this->container['secure_smtp_username'];
}
/**
* Sets secure_smtp_username
*
* @param string $secure_smtp_username Secure TLS SMTP username for login
*
* @return self
*/
public function setSecureSmtpUsername($secure_smtp_username)
{
if (is_null($secure_smtp_username)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_username cannot be null');
}
$this->container['secure_smtp_username'] = $secure_smtp_username;
return $this;
}
/**
* Gets secure_smtp_password
*
* @return string
*/
public function getSecureSmtpPassword()
{
return $this->container['secure_smtp_password'];
}
/**
* Sets secure_smtp_password
*
* @param string $secure_smtp_password Secure TLS SMTP password for login
*
* @return self
*/
public function setSecureSmtpPassword($secure_smtp_password)
{
if (is_null($secure_smtp_password)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_password cannot be null');
}
$this->container['secure_smtp_password'] = $secure_smtp_password;
return $this;
}
/**
* Gets smtp_server_host
*
* @return string
*/
public function getSmtpServerHost()
{
return $this->container['smtp_server_host'];
}
/**
* Sets smtp_server_host
*
* @param string $smtp_server_host SMTP server host domain
*
* @return self
*/
public function setSmtpServerHost($smtp_server_host)
{
if (is_null($smtp_server_host)) {
throw new \InvalidArgumentException('non-nullable smtp_server_host cannot be null');
}
$this->container['smtp_server_host'] = $smtp_server_host;
return $this;
}
/**
* Gets smtp_server_port
*
* @return int
*/
public function getSmtpServerPort()
{
return $this->container['smtp_server_port'];
}
/**
* Sets smtp_server_port
*
* @param int $smtp_server_port SMTP server host port
*
* @return self
*/
public function setSmtpServerPort($smtp_server_port)
{
if (is_null($smtp_server_port)) {
throw new \InvalidArgumentException('non-nullable smtp_server_port cannot be null');
}
$this->container['smtp_server_port'] = $smtp_server_port;
return $this;
}
/**
* Gets smtp_username
*
* @return string
*/
public function getSmtpUsername()
{
return $this->container['smtp_username'];
}
/**
* Sets smtp_username
*
* @param string $smtp_username SMTP username for login
*
* @return self
*/
public function setSmtpUsername($smtp_username)
{
if (is_null($smtp_username)) {
throw new \InvalidArgumentException('non-nullable smtp_username cannot be null');
}
$this->container['smtp_username'] = $smtp_username;
return $this;
}
/**
* Gets smtp_password
*
* @return string
*/
public function getSmtpPassword()
{
return $this->container['smtp_password'];
}
/**
* Sets smtp_password
*
* @param string $smtp_password SMTP password for login
*
* @return self
*/
public function setSmtpPassword($smtp_password)
{
if (is_null($smtp_password)) {
throw new \InvalidArgumentException('non-nullable smtp_password cannot be null');
}
$this->container['smtp_password'] = $smtp_password;
return $this;
}
/**
* Gets mail_from_domain
*
* @return string|null
*/
public function getMailFromDomain()
{
return $this->container['mail_from_domain'];
}
/**
* Sets mail_from_domain
*
* @param string|null $mail_from_domain Mail from domain or SMTP HELO value
*
* @return self
*/
public function setMailFromDomain($mail_from_domain)
{
if (is_null($mail_from_domain)) {
array_push($this->openAPINullablesSetToNull, 'mail_from_domain');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('mail_from_domain', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['mail_from_domain'] = $mail_from_domain;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SmsReplyOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SmsReplyOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SmsReplyOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SmsReplyOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'body' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'body' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'body' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'body' => 'body'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'body' => 'setBody'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'body' => 'getBody'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('body', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SmsProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SmsProjection Class Doc Comment
*
* @category Class
* @description SMS projection
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SmsProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SmsProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'body' => 'string',
'created_at' => '\DateTime',
'user_id' => 'string',
'phone_number' => 'string',
'from_number' => 'string',
'read' => 'bool',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'body' => null,
'created_at' => 'date-time',
'user_id' => 'uuid',
'phone_number' => 'uuid',
'from_number' => null,
'read' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'body' => false,
'created_at' => false,
'user_id' => false,
'phone_number' => false,
'from_number' => false,
'read' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'body' => 'body',
'created_at' => 'createdAt',
'user_id' => 'userId',
'phone_number' => 'phoneNumber',
'from_number' => 'fromNumber',
'read' => 'read',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'body' => 'setBody',
'created_at' => 'setCreatedAt',
'user_id' => 'setUserId',
'phone_number' => 'setPhoneNumber',
'from_number' => 'setFromNumber',
'read' => 'setRead',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'body' => 'getBody',
'created_at' => 'getCreatedAt',
'user_id' => 'getUserId',
'phone_number' => 'getPhoneNumber',
'from_number' => 'getFromNumber',
'read' => 'getRead',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('phone_number', $data ?? [], null);
$this->setIfExists('from_number', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['phone_number'] === null) {
$invalidProperties[] = "'phone_number' can't be null";
}
if ($this->container['from_number'] === null) {
$invalidProperties[] = "'from_number' can't be null";
}
if ($this->container['read'] === null) {
$invalidProperties[] = "'read' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets phone_number
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number
*
* @param string $phone_number phone_number
*
* @return self
*/
public function setPhoneNumber($phone_number)
{
if (is_null($phone_number)) {
throw new \InvalidArgumentException('non-nullable phone_number cannot be null');
}
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Gets from_number
*
* @return string
*/
public function getFromNumber()
{
return $this->container['from_number'];
}
/**
* Sets from_number
*
* @param string $from_number from_number
*
* @return self
*/
public function setFromNumber($from_number)
{
if (is_null($from_number)) {
throw new \InvalidArgumentException('non-nullable from_number cannot be null');
}
$this->container['from_number'] = $from_number;
return $this;
}
/**
* Gets read
*
* @return bool
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool $read read
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
throw new \InvalidArgumentException('non-nullable read cannot be null');
}
$this->container['read'] = $read;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SmsPreview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SmsPreview Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SmsPreview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SmsPreview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'body' => 'string',
'phone_number' => 'string',
'from_number' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'body' => null,
'phone_number' => 'uuid',
'from_number' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'body' => false,
'phone_number' => false,
'from_number' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'body' => 'body',
'phone_number' => 'phoneNumber',
'from_number' => 'fromNumber',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'body' => 'setBody',
'phone_number' => 'setPhoneNumber',
'from_number' => 'setFromNumber',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'body' => 'getBody',
'phone_number' => 'getPhoneNumber',
'from_number' => 'getFromNumber',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('phone_number', $data ?? [], null);
$this->setIfExists('from_number', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['phone_number'] === null) {
$invalidProperties[] = "'phone_number' can't be null";
}
if ($this->container['from_number'] === null) {
$invalidProperties[] = "'from_number' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets phone_number
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number
*
* @param string $phone_number phone_number
*
* @return self
*/
public function setPhoneNumber($phone_number)
{
if (is_null($phone_number)) {
throw new \InvalidArgumentException('non-nullable phone_number cannot be null');
}
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Gets from_number
*
* @return string
*/
public function getFromNumber()
{
return $this->container['from_number'];
}
/**
* Sets from_number
*
* @param string $from_number from_number
*
* @return self
*/
public function setFromNumber($from_number)
{
if (is_null($from_number)) {
throw new \InvalidArgumentException('non-nullable from_number cannot be null');
}
$this->container['from_number'] = $from_number;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SmsMatchOption
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SmsMatchOption Class Doc Comment
*
* @category Class
* @description Options for matching SMS messages in a phone number. Each match option object contains a `field`, `should` and `value` property. Together they form logical conditions such as `BODY` should `CONTAIN` value.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SmsMatchOption implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SmsMatchOption';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'field' => 'string',
'should' => 'string',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'field' => null,
'should' => null,
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'field' => false,
'should' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'field' => 'field',
'should' => 'should',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'field' => 'setField',
'should' => 'setShould',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'field' => 'getField',
'should' => 'getShould',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FIELD_BODY = 'BODY';
public const FIELD_FROM = 'FROM';
public const SHOULD_MATCH = 'MATCH';
public const SHOULD_CONTAIN = 'CONTAIN';
public const SHOULD_EQUAL = 'EQUAL';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFieldAllowableValues()
{
return [
self::FIELD_BODY,
self::FIELD_FROM,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getShouldAllowableValues()
{
return [
self::SHOULD_MATCH,
self::SHOULD_CONTAIN,
self::SHOULD_EQUAL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('field', $data ?? [], null);
$this->setIfExists('should', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['field'] === null) {
$invalidProperties[] = "'field' can't be null";
}
$allowedValues = $this->getFieldAllowableValues();
if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'field', must be one of '%s'",
$this->container['field'],
implode("', '", $allowedValues)
);
}
if ($this->container['should'] === null) {
$invalidProperties[] = "'should' can't be null";
}
$allowedValues = $this->getShouldAllowableValues();
if (!is_null($this->container['should']) && !in_array($this->container['should'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'should', must be one of '%s'",
$this->container['should'],
implode("', '", $allowedValues)
);
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets field
*
* @return string
*/
public function getField()
{
return $this->container['field'];
}
/**
* Sets field
*
* @param string $field Fields of an SMS object that can be used to filter results
*
* @return self
*/
public function setField($field)
{
$allowedValues = $this->getFieldAllowableValues();
if (!in_array($field, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'field', must be one of '%s'",
$field,
implode("', '", $allowedValues)
)
);
}
if (is_null($field)) {
throw new \InvalidArgumentException('non-nullable field cannot be null');
}
$this->container['field'] = $field;
return $this;
}
/**
* Gets should
*
* @return string
*/
public function getShould()
{
return $this->container['should'];
}
/**
* Sets should
*
* @param string $should How the value of the email field specified should be compared to the value given in the match options.
*
* @return self
*/
public function setShould($should)
{
$allowedValues = $this->getShouldAllowableValues();
if (!in_array($should, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'should', must be one of '%s'",
$should,
implode("', '", $allowedValues)
)
);
}
if (is_null($should)) {
throw new \InvalidArgumentException('non-nullable should cannot be null');
}
$this->container['should'] = $should;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value The value you wish to compare with the value of the field specified using the `should` value passed. For example `BODY` should `CONTAIN` a value passed.
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SmsDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SmsDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SmsDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SmsDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'phone_number' => 'string',
'from_number' => 'string',
'body' => 'string',
'read' => 'bool',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'phone_number' => 'uuid',
'from_number' => null,
'body' => null,
'read' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'phone_number' => false,
'from_number' => false,
'body' => false,
'read' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'phone_number' => 'phoneNumber',
'from_number' => 'fromNumber',
'body' => 'body',
'read' => 'read',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'phone_number' => 'setPhoneNumber',
'from_number' => 'setFromNumber',
'body' => 'setBody',
'read' => 'setRead',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'phone_number' => 'getPhoneNumber',
'from_number' => 'getFromNumber',
'body' => 'getBody',
'read' => 'getRead',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('phone_number', $data ?? [], null);
$this->setIfExists('from_number', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['phone_number'] === null) {
$invalidProperties[] = "'phone_number' can't be null";
}
if ($this->container['from_number'] === null) {
$invalidProperties[] = "'from_number' can't be null";
}
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['read'] === null) {
$invalidProperties[] = "'read' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets phone_number
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number
*
* @param string $phone_number phone_number
*
* @return self
*/
public function setPhoneNumber($phone_number)
{
if (is_null($phone_number)) {
throw new \InvalidArgumentException('non-nullable phone_number cannot be null');
}
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Gets from_number
*
* @return string
*/
public function getFromNumber()
{
return $this->container['from_number'];
}
/**
* Sets from_number
*
* @param string $from_number from_number
*
* @return self
*/
public function setFromNumber($from_number)
{
if (is_null($from_number)) {
throw new \InvalidArgumentException('non-nullable from_number cannot be null');
}
$this->container['from_number'] = $from_number;
return $this;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets read
*
* @return bool
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool $read read
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
throw new \InvalidArgumentException('non-nullable read cannot be null');
}
$this->container['read'] = $read;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SimpleSendEmailOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SimpleSendEmailOptions Class Doc Comment
*
* @category Class
* @description Simplified send email options
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SimpleSendEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SimpleSendEmailOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'sender_id' => 'string',
'to' => 'string',
'body' => 'string',
'subject' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'sender_id' => 'uuid',
'to' => null,
'body' => null,
'subject' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'sender_id' => true,
'to' => false,
'body' => true,
'subject' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'sender_id' => 'senderId',
'to' => 'to',
'body' => 'body',
'subject' => 'subject'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'sender_id' => 'setSenderId',
'to' => 'setTo',
'body' => 'setBody',
'subject' => 'setSubject'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'sender_id' => 'getSenderId',
'to' => 'getTo',
'body' => 'getBody',
'subject' => 'getSubject'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('sender_id', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets sender_id
*
* @return string|null
*/
public function getSenderId()
{
return $this->container['sender_id'];
}
/**
* Sets sender_id
*
* @param string|null $sender_id ID of inbox to send from. If null an inbox will be created for sending
*
* @return self
*/
public function setSenderId($sender_id)
{
if (is_null($sender_id)) {
array_push($this->openAPINullablesSetToNull, 'sender_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sender_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sender_id'] = $sender_id;
return $this;
}
/**
* Gets to
*
* @return string
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string $to Email address to send to
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets body
*
* @return string|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string|null $body Body of the email message. Supports HTML
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
array_push($this->openAPINullablesSetToNull, 'body');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject Subject line of the email
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SetInboxFavouritedOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SetInboxFavouritedOptions Class Doc Comment
*
* @category Class
* @description Options for setting inbox favourite state
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SetInboxFavouritedOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SetInboxFavouritedOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'state' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'state' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'state' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'state' => 'state'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'state' => 'setState'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'state' => 'getState'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('state', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['state'] === null) {
$invalidProperties[] = "'state' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets state
*
* @return bool
*/
public function getState()
{
return $this->container['state'];
}
/**
* Sets state
*
* @param bool $state Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering
*
* @return self
*/
public function setState($state)
{
if (is_null($state)) {
throw new \InvalidArgumentException('non-nullable state cannot be null');
}
$this->container['state'] = $state;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ServerEndpoints
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ServerEndpoints Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ServerEndpoints implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ServerEndpoints';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'host' => 'string',
'port' => 'int',
'tls' => 'bool',
'alt_ports' => 'int[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'host' => null,
'port' => 'int32',
'tls' => null,
'alt_ports' => 'int32'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'host' => false,
'port' => false,
'tls' => false,
'alt_ports' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'host' => 'host',
'port' => 'port',
'tls' => 'tls',
'alt_ports' => 'altPorts'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'host' => 'setHost',
'port' => 'setPort',
'tls' => 'setTls',
'alt_ports' => 'setAltPorts'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'host' => 'getHost',
'port' => 'getPort',
'tls' => 'getTls',
'alt_ports' => 'getAltPorts'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('host', $data ?? [], null);
$this->setIfExists('port', $data ?? [], null);
$this->setIfExists('tls', $data ?? [], null);
$this->setIfExists('alt_ports', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['host'] === null) {
$invalidProperties[] = "'host' can't be null";
}
if ($this->container['port'] === null) {
$invalidProperties[] = "'port' can't be null";
}
if ($this->container['tls'] === null) {
$invalidProperties[] = "'tls' can't be null";
}
if ($this->container['alt_ports'] === null) {
$invalidProperties[] = "'alt_ports' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets host
*
* @return string
*/
public function getHost()
{
return $this->container['host'];
}
/**
* Sets host
*
* @param string $host host
*
* @return self
*/
public function setHost($host)
{
if (is_null($host)) {
throw new \InvalidArgumentException('non-nullable host cannot be null');
}
$this->container['host'] = $host;
return $this;
}
/**
* Gets port
*
* @return int
*/
public function getPort()
{
return $this->container['port'];
}
/**
* Sets port
*
* @param int $port port
*
* @return self
*/
public function setPort($port)
{
if (is_null($port)) {
throw new \InvalidArgumentException('non-nullable port cannot be null');
}
$this->container['port'] = $port;
return $this;
}
/**
* Gets tls
*
* @return bool
*/
public function getTls()
{
return $this->container['tls'];
}
/**
* Sets tls
*
* @param bool $tls tls
*
* @return self
*/
public function setTls($tls)
{
if (is_null($tls)) {
throw new \InvalidArgumentException('non-nullable tls cannot be null');
}
$this->container['tls'] = $tls;
return $this;
}
/**
* Gets alt_ports
*
* @return int[]
*/
public function getAltPorts()
{
return $this->container['alt_ports'];
}
/**
* Sets alt_ports
*
* @param int[] $alt_ports alt_ports
*
* @return self
*/
public function setAltPorts($alt_ports)
{
if (is_null($alt_ports)) {
throw new \InvalidArgumentException('non-nullable alt_ports cannot be null');
}
$this->container['alt_ports'] = $alt_ports;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SentSmsDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SentSmsDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SentSmsDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SentSmsDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'phone_number' => 'string',
'from_number' => 'string',
'to_number' => 'string',
'body' => 'string',
'sid' => 'string',
'reply_to_sid' => 'string',
'reply_to_id' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'phone_number' => 'uuid',
'from_number' => null,
'to_number' => null,
'body' => null,
'sid' => null,
'reply_to_sid' => null,
'reply_to_id' => 'uuid',
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'phone_number' => false,
'from_number' => false,
'to_number' => false,
'body' => false,
'sid' => false,
'reply_to_sid' => false,
'reply_to_id' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'phone_number' => 'phoneNumber',
'from_number' => 'fromNumber',
'to_number' => 'toNumber',
'body' => 'body',
'sid' => 'sid',
'reply_to_sid' => 'replyToSid',
'reply_to_id' => 'replyToId',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'phone_number' => 'setPhoneNumber',
'from_number' => 'setFromNumber',
'to_number' => 'setToNumber',
'body' => 'setBody',
'sid' => 'setSid',
'reply_to_sid' => 'setReplyToSid',
'reply_to_id' => 'setReplyToId',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'phone_number' => 'getPhoneNumber',
'from_number' => 'getFromNumber',
'to_number' => 'getToNumber',
'body' => 'getBody',
'sid' => 'getSid',
'reply_to_sid' => 'getReplyToSid',
'reply_to_id' => 'getReplyToId',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('phone_number', $data ?? [], null);
$this->setIfExists('from_number', $data ?? [], null);
$this->setIfExists('to_number', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('sid', $data ?? [], null);
$this->setIfExists('reply_to_sid', $data ?? [], null);
$this->setIfExists('reply_to_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['phone_number'] === null) {
$invalidProperties[] = "'phone_number' can't be null";
}
if ($this->container['from_number'] === null) {
$invalidProperties[] = "'from_number' can't be null";
}
if ($this->container['to_number'] === null) {
$invalidProperties[] = "'to_number' can't be null";
}
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['sid'] === null) {
$invalidProperties[] = "'sid' can't be null";
}
if ($this->container['reply_to_sid'] === null) {
$invalidProperties[] = "'reply_to_sid' can't be null";
}
if ($this->container['reply_to_id'] === null) {
$invalidProperties[] = "'reply_to_id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets phone_number
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number
*
* @param string $phone_number phone_number
*
* @return self
*/
public function setPhoneNumber($phone_number)
{
if (is_null($phone_number)) {
throw new \InvalidArgumentException('non-nullable phone_number cannot be null');
}
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Gets from_number
*
* @return string
*/
public function getFromNumber()
{
return $this->container['from_number'];
}
/**
* Sets from_number
*
* @param string $from_number from_number
*
* @return self
*/
public function setFromNumber($from_number)
{
if (is_null($from_number)) {
throw new \InvalidArgumentException('non-nullable from_number cannot be null');
}
$this->container['from_number'] = $from_number;
return $this;
}
/**
* Gets to_number
*
* @return string
*/
public function getToNumber()
{
return $this->container['to_number'];
}
/**
* Sets to_number
*
* @param string $to_number to_number
*
* @return self
*/
public function setToNumber($to_number)
{
if (is_null($to_number)) {
throw new \InvalidArgumentException('non-nullable to_number cannot be null');
}
$this->container['to_number'] = $to_number;
return $this;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets sid
*
* @return string
*/
public function getSid()
{
return $this->container['sid'];
}
/**
* Sets sid
*
* @param string $sid sid
*
* @return self
*/
public function setSid($sid)
{
if (is_null($sid)) {
throw new \InvalidArgumentException('non-nullable sid cannot be null');
}
$this->container['sid'] = $sid;
return $this;
}
/**
* Gets reply_to_sid
*
* @return string
*/
public function getReplyToSid()
{
return $this->container['reply_to_sid'];
}
/**
* Sets reply_to_sid
*
* @param string $reply_to_sid reply_to_sid
*
* @return self
*/
public function setReplyToSid($reply_to_sid)
{
if (is_null($reply_to_sid)) {
throw new \InvalidArgumentException('non-nullable reply_to_sid cannot be null');
}
$this->container['reply_to_sid'] = $reply_to_sid;
return $this;
}
/**
* Gets reply_to_id
*
* @return string
*/
public function getReplyToId()
{
return $this->container['reply_to_id'];
}
/**
* Sets reply_to_id
*
* @param string $reply_to_id reply_to_id
*
* @return self
*/
public function setReplyToId($reply_to_id)
{
if (is_null($reply_to_id)) {
throw new \InvalidArgumentException('non-nullable reply_to_id cannot be null');
}
$this->container['reply_to_id'] = $reply_to_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SentEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SentEmailProjection Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SentEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SentEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'id' => 'string',
'from' => 'string',
'subject' => 'string',
'attachments' => 'string[]',
'inbox_id' => 'string',
'user_id' => 'string',
'to' => 'string[]',
'bcc' => 'string[]',
'cc' => 'string[]',
'body_md5_hash' => 'string',
'virtual_send' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'id' => 'uuid',
'from' => null,
'subject' => null,
'attachments' => null,
'inbox_id' => 'uuid',
'user_id' => 'uuid',
'to' => null,
'bcc' => null,
'cc' => null,
'body_md5_hash' => null,
'virtual_send' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'id' => false,
'from' => false,
'subject' => false,
'attachments' => false,
'inbox_id' => false,
'user_id' => false,
'to' => false,
'bcc' => false,
'cc' => false,
'body_md5_hash' => false,
'virtual_send' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'id' => 'id',
'from' => 'from',
'subject' => 'subject',
'attachments' => 'attachments',
'inbox_id' => 'inboxId',
'user_id' => 'userId',
'to' => 'to',
'bcc' => 'bcc',
'cc' => 'cc',
'body_md5_hash' => 'bodyMD5Hash',
'virtual_send' => 'virtualSend'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'id' => 'setId',
'from' => 'setFrom',
'subject' => 'setSubject',
'attachments' => 'setAttachments',
'inbox_id' => 'setInboxId',
'user_id' => 'setUserId',
'to' => 'setTo',
'bcc' => 'setBcc',
'cc' => 'setCc',
'body_md5_hash' => 'setBodyMd5Hash',
'virtual_send' => 'setVirtualSend'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'id' => 'getId',
'from' => 'getFrom',
'subject' => 'getSubject',
'attachments' => 'getAttachments',
'inbox_id' => 'getInboxId',
'user_id' => 'getUserId',
'to' => 'getTo',
'bcc' => 'getBcc',
'cc' => 'getCc',
'body_md5_hash' => 'getBodyMd5Hash',
'virtual_send' => 'getVirtualSend'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('body_md5_hash', $data ?? [], null);
$this->setIfExists('virtual_send', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['attachments'] === null) {
$invalidProperties[] = "'attachments' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
if ($this->container['bcc'] === null) {
$invalidProperties[] = "'bcc' can't be null";
}
if ($this->container['cc'] === null) {
$invalidProperties[] = "'cc' can't be null";
}
if ($this->container['virtual_send'] === null) {
$invalidProperties[] = "'virtual_send' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from from
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
throw new \InvalidArgumentException('non-nullable from cannot be null');
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets attachments
*
* @return string[]
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[] $attachments attachments
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
throw new \InvalidArgumentException('non-nullable attachments cannot be null');
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to to
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets bcc
*
* @return string[]
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[] $bcc bcc
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
throw new \InvalidArgumentException('non-nullable bcc cannot be null');
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets cc
*
* @return string[]
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[] $cc cc
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
throw new \InvalidArgumentException('non-nullable cc cannot be null');
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets body_md5_hash
*
* @return string|null
*/
public function getBodyMd5Hash()
{
return $this->container['body_md5_hash'];
}
/**
* Sets body_md5_hash
*
* @param string|null $body_md5_hash body_md5_hash
*
* @return self
*/
public function setBodyMd5Hash($body_md5_hash)
{
if (is_null($body_md5_hash)) {
throw new \InvalidArgumentException('non-nullable body_md5_hash cannot be null');
}
$this->container['body_md5_hash'] = $body_md5_hash;
return $this;
}
/**
* Gets virtual_send
*
* @return bool
*/
public function getVirtualSend()
{
return $this->container['virtual_send'];
}
/**
* Sets virtual_send
*
* @param bool $virtual_send virtual_send
*
* @return self
*/
public function setVirtualSend($virtual_send)
{
if (is_null($virtual_send)) {
throw new \InvalidArgumentException('non-nullable virtual_send cannot be null');
}
$this->container['virtual_send'] = $virtual_send;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SentEmailDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SentEmailDto Class Doc Comment
*
* @category Class
* @description Sent email details
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SentEmailDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SentEmailDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'inbox_id' => 'string',
'domain_id' => 'string',
'to' => 'string[]',
'from' => 'string',
'reply_to' => 'string',
'cc' => 'string[]',
'bcc' => 'string[]',
'attachments' => 'string[]',
'subject' => 'string',
'body_md5_hash' => 'string',
'body' => 'string',
'to_contacts' => 'string[]',
'to_group' => 'string',
'charset' => 'string',
'is_html' => 'bool',
'sent_at' => '\DateTime',
'pixel_ids' => 'string[]',
'message_id' => 'string',
'message_ids' => 'string[]',
'virtual_send' => 'bool',
'template_id' => 'string',
'template_variables' => 'array<string,object>',
'headers' => 'array<string,string>',
'html' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'inbox_id' => 'uuid',
'domain_id' => 'uuid',
'to' => null,
'from' => null,
'reply_to' => null,
'cc' => null,
'bcc' => null,
'attachments' => null,
'subject' => null,
'body_md5_hash' => null,
'body' => null,
'to_contacts' => 'uuid',
'to_group' => 'uuid',
'charset' => null,
'is_html' => null,
'sent_at' => 'date-time',
'pixel_ids' => 'uuid',
'message_id' => null,
'message_ids' => null,
'virtual_send' => null,
'template_id' => 'uuid',
'template_variables' => null,
'headers' => null,
'html' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'inbox_id' => false,
'domain_id' => true,
'to' => true,
'from' => true,
'reply_to' => true,
'cc' => true,
'bcc' => true,
'attachments' => true,
'subject' => true,
'body_md5_hash' => true,
'body' => true,
'to_contacts' => true,
'to_group' => true,
'charset' => true,
'is_html' => true,
'sent_at' => false,
'pixel_ids' => true,
'message_id' => true,
'message_ids' => true,
'virtual_send' => true,
'template_id' => true,
'template_variables' => true,
'headers' => true,
'html' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'inbox_id' => 'inboxId',
'domain_id' => 'domainId',
'to' => 'to',
'from' => 'from',
'reply_to' => 'replyTo',
'cc' => 'cc',
'bcc' => 'bcc',
'attachments' => 'attachments',
'subject' => 'subject',
'body_md5_hash' => 'bodyMD5Hash',
'body' => 'body',
'to_contacts' => 'toContacts',
'to_group' => 'toGroup',
'charset' => 'charset',
'is_html' => 'isHTML',
'sent_at' => 'sentAt',
'pixel_ids' => 'pixelIds',
'message_id' => 'messageId',
'message_ids' => 'messageIds',
'virtual_send' => 'virtualSend',
'template_id' => 'templateId',
'template_variables' => 'templateVariables',
'headers' => 'headers',
'html' => 'html'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'inbox_id' => 'setInboxId',
'domain_id' => 'setDomainId',
'to' => 'setTo',
'from' => 'setFrom',
'reply_to' => 'setReplyTo',
'cc' => 'setCc',
'bcc' => 'setBcc',
'attachments' => 'setAttachments',
'subject' => 'setSubject',
'body_md5_hash' => 'setBodyMd5Hash',
'body' => 'setBody',
'to_contacts' => 'setToContacts',
'to_group' => 'setToGroup',
'charset' => 'setCharset',
'is_html' => 'setIsHtml',
'sent_at' => 'setSentAt',
'pixel_ids' => 'setPixelIds',
'message_id' => 'setMessageId',
'message_ids' => 'setMessageIds',
'virtual_send' => 'setVirtualSend',
'template_id' => 'setTemplateId',
'template_variables' => 'setTemplateVariables',
'headers' => 'setHeaders',
'html' => 'setHtml'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'inbox_id' => 'getInboxId',
'domain_id' => 'getDomainId',
'to' => 'getTo',
'from' => 'getFrom',
'reply_to' => 'getReplyTo',
'cc' => 'getCc',
'bcc' => 'getBcc',
'attachments' => 'getAttachments',
'subject' => 'getSubject',
'body_md5_hash' => 'getBodyMd5Hash',
'body' => 'getBody',
'to_contacts' => 'getToContacts',
'to_group' => 'getToGroup',
'charset' => 'getCharset',
'is_html' => 'getIsHtml',
'sent_at' => 'getSentAt',
'pixel_ids' => 'getPixelIds',
'message_id' => 'getMessageId',
'message_ids' => 'getMessageIds',
'virtual_send' => 'getVirtualSend',
'template_id' => 'getTemplateId',
'template_variables' => 'getTemplateVariables',
'headers' => 'getHeaders',
'html' => 'getHtml'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('reply_to', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('body_md5_hash', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('to_contacts', $data ?? [], null);
$this->setIfExists('to_group', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('sent_at', $data ?? [], null);
$this->setIfExists('pixel_ids', $data ?? [], null);
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('message_ids', $data ?? [], null);
$this->setIfExists('virtual_send', $data ?? [], null);
$this->setIfExists('template_id', $data ?? [], null);
$this->setIfExists('template_variables', $data ?? [], null);
$this->setIfExists('headers', $data ?? [], null);
$this->setIfExists('html', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['sent_at'] === null) {
$invalidProperties[] = "'sent_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of sent email
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id User ID
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Inbox ID email was sent from
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id Domain ID
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets to
*
* @return string[]|null
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[]|null $to Recipients email was sent to
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
array_push($this->openAPINullablesSetToNull, 'to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from Sent from address
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets reply_to
*
* @return string|null
*/
public function getReplyTo()
{
return $this->container['reply_to'];
}
/**
* Sets reply_to
*
* @param string|null $reply_to reply_to
*
* @return self
*/
public function setReplyTo($reply_to)
{
if (is_null($reply_to)) {
array_push($this->openAPINullablesSetToNull, 'reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reply_to'] = $reply_to;
return $this;
}
/**
* Gets cc
*
* @return string[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[]|null $cc cc
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
array_push($this->openAPINullablesSetToNull, 'cc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('cc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets bcc
*
* @return string[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[]|null $bcc bcc
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
array_push($this->openAPINullablesSetToNull, 'bcc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bcc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets attachments
*
* @return string[]|null
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[]|null $attachments Array of IDs of attachments that were sent with this email
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
array_push($this->openAPINullablesSetToNull, 'attachments');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachments', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets body_md5_hash
*
* @return string|null
*/
public function getBodyMd5Hash()
{
return $this->container['body_md5_hash'];
}
/**
* Sets body_md5_hash
*
* @param string|null $body_md5_hash MD5 Hash
*
* @return self
*/
public function setBodyMd5Hash($body_md5_hash)
{
if (is_null($body_md5_hash)) {
array_push($this->openAPINullablesSetToNull, 'body_md5_hash');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_md5_hash', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_md5_hash'] = $body_md5_hash;
return $this;
}
/**
* Gets body
*
* @return string|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string|null $body Sent email body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
array_push($this->openAPINullablesSetToNull, 'body');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets to_contacts
*
* @return string[]|null
*/
public function getToContacts()
{
return $this->container['to_contacts'];
}
/**
* Sets to_contacts
*
* @param string[]|null $to_contacts to_contacts
*
* @return self
*/
public function setToContacts($to_contacts)
{
if (is_null($to_contacts)) {
array_push($this->openAPINullablesSetToNull, 'to_contacts');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('to_contacts', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['to_contacts'] = $to_contacts;
return $this;
}
/**
* Gets to_group
*
* @return string|null
*/
public function getToGroup()
{
return $this->container['to_group'];
}
/**
* Sets to_group
*
* @param string|null $to_group to_group
*
* @return self
*/
public function setToGroup($to_group)
{
if (is_null($to_group)) {
array_push($this->openAPINullablesSetToNull, 'to_group');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('to_group', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['to_group'] = $to_group;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset charset
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets is_html
*
* @return bool|null
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool|null $is_html is_html
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
array_push($this->openAPINullablesSetToNull, 'is_html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('is_html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets sent_at
*
* @return \DateTime
*/
public function getSentAt()
{
return $this->container['sent_at'];
}
/**
* Sets sent_at
*
* @param \DateTime $sent_at sent_at
*
* @return self
*/
public function setSentAt($sent_at)
{
if (is_null($sent_at)) {
throw new \InvalidArgumentException('non-nullable sent_at cannot be null');
}
$this->container['sent_at'] = $sent_at;
return $this;
}
/**
* Gets pixel_ids
*
* @return string[]|null
*/
public function getPixelIds()
{
return $this->container['pixel_ids'];
}
/**
* Sets pixel_ids
*
* @param string[]|null $pixel_ids pixel_ids
*
* @return self
*/
public function setPixelIds($pixel_ids)
{
if (is_null($pixel_ids)) {
array_push($this->openAPINullablesSetToNull, 'pixel_ids');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('pixel_ids', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['pixel_ids'] = $pixel_ids;
return $this;
}
/**
* Gets message_id
*
* @return string|null
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string|null $message_id message_id
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
array_push($this->openAPINullablesSetToNull, 'message_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets message_ids
*
* @return string[]|null
*/
public function getMessageIds()
{
return $this->container['message_ids'];
}
/**
* Sets message_ids
*
* @param string[]|null $message_ids message_ids
*
* @return self
*/
public function setMessageIds($message_ids)
{
if (is_null($message_ids)) {
array_push($this->openAPINullablesSetToNull, 'message_ids');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message_ids', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message_ids'] = $message_ids;
return $this;
}
/**
* Gets virtual_send
*
* @return bool|null
*/
public function getVirtualSend()
{
return $this->container['virtual_send'];
}
/**
* Sets virtual_send
*
* @param bool|null $virtual_send virtual_send
*
* @return self
*/
public function setVirtualSend($virtual_send)
{
if (is_null($virtual_send)) {
array_push($this->openAPINullablesSetToNull, 'virtual_send');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('virtual_send', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['virtual_send'] = $virtual_send;
return $this;
}
/**
* Gets template_id
*
* @return string|null
*/
public function getTemplateId()
{
return $this->container['template_id'];
}
/**
* Sets template_id
*
* @param string|null $template_id template_id
*
* @return self
*/
public function setTemplateId($template_id)
{
if (is_null($template_id)) {
array_push($this->openAPINullablesSetToNull, 'template_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_id'] = $template_id;
return $this;
}
/**
* Gets template_variables
*
* @return array<string,object>|null
*/
public function getTemplateVariables()
{
return $this->container['template_variables'];
}
/**
* Sets template_variables
*
* @param array<string,object>|null $template_variables template_variables
*
* @return self
*/
public function setTemplateVariables($template_variables)
{
if (is_null($template_variables)) {
array_push($this->openAPINullablesSetToNull, 'template_variables');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_variables', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_variables'] = $template_variables;
return $this;
}
/**
* Gets headers
*
* @return array<string,string>|null
*/
public function getHeaders()
{
return $this->container['headers'];
}
/**
* Sets headers
*
* @param array<string,string>|null $headers headers
*
* @return self
*/
public function setHeaders($headers)
{
if (is_null($headers)) {
array_push($this->openAPINullablesSetToNull, 'headers');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('headers', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['headers'] = $headers;
return $this;
}
/**
* Gets html
*
* @return bool|null
*/
public function getHtml()
{
return $this->container['html'];
}
/**
* Sets html
*
* @param bool|null $html html
*
* @return self
*/
public function setHtml($html)
{
if (is_null($html)) {
throw new \InvalidArgumentException('non-nullable html cannot be null');
}
$this->container['html'] = $html;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* Sender
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* Sender Class Doc Comment
*
* @category Class
* @description Sender object containing from email address and from personal name if provided in address
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class Sender implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'Sender';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'raw_value' => 'string',
'email_address' => 'string',
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'raw_value' => null,
'email_address' => null,
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'raw_value' => false,
'email_address' => false,
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'raw_value' => 'rawValue',
'email_address' => 'emailAddress',
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'raw_value' => 'setRawValue',
'email_address' => 'setEmailAddress',
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'raw_value' => 'getRawValue',
'email_address' => 'getEmailAddress',
'name' => 'getName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('raw_value', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['raw_value'] === null) {
$invalidProperties[] = "'raw_value' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets raw_value
*
* @return string
*/
public function getRawValue()
{
return $this->container['raw_value'];
}
/**
* Sets raw_value
*
* @param string $raw_value raw_value
*
* @return self
*/
public function setRawValue($raw_value)
{
if (is_null($raw_value)) {
throw new \InvalidArgumentException('non-nullable raw_value cannot be null');
}
$this->container['raw_value'] = $raw_value;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SendWithQueueResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SendWithQueueResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SendWithQueueResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SendWithQueueResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'subject' => 'string',
'inbox_id' => 'string',
'header_id' => 'string',
'delivered' => 'bool',
'exception_name' => 'string',
'message' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'subject' => null,
'inbox_id' => 'uuid',
'header_id' => null,
'delivered' => null,
'exception_name' => null,
'message' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'subject' => false,
'inbox_id' => false,
'header_id' => false,
'delivered' => false,
'exception_name' => false,
'message' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'subject' => 'subject',
'inbox_id' => 'inboxId',
'header_id' => 'headerId',
'delivered' => 'delivered',
'exception_name' => 'exceptionName',
'message' => 'message',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'subject' => 'setSubject',
'inbox_id' => 'setInboxId',
'header_id' => 'setHeaderId',
'delivered' => 'setDelivered',
'exception_name' => 'setExceptionName',
'message' => 'setMessage',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'subject' => 'getSubject',
'inbox_id' => 'getInboxId',
'header_id' => 'getHeaderId',
'delivered' => 'getDelivered',
'exception_name' => 'getExceptionName',
'message' => 'getMessage',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('header_id', $data ?? [], null);
$this->setIfExists('delivered', $data ?? [], null);
$this->setIfExists('exception_name', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['header_id'] === null) {
$invalidProperties[] = "'header_id' can't be null";
}
if ($this->container['delivered'] === null) {
$invalidProperties[] = "'delivered' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets header_id
*
* @return string
*/
public function getHeaderId()
{
return $this->container['header_id'];
}
/**
* Sets header_id
*
* @param string $header_id header_id
*
* @return self
*/
public function setHeaderId($header_id)
{
if (is_null($header_id)) {
throw new \InvalidArgumentException('non-nullable header_id cannot be null');
}
$this->container['header_id'] = $header_id;
return $this;
}
/**
* Gets delivered
*
* @return bool
*/
public function getDelivered()
{
return $this->container['delivered'];
}
/**
* Sets delivered
*
* @param bool $delivered delivered
*
* @return self
*/
public function setDelivered($delivered)
{
if (is_null($delivered)) {
throw new \InvalidArgumentException('non-nullable delivered cannot be null');
}
$this->container['delivered'] = $delivered;
return $this;
}
/**
* Gets exception_name
*
* @return string|null
*/
public function getExceptionName()
{
return $this->container['exception_name'];
}
/**
* Sets exception_name
*
* @param string|null $exception_name exception_name
*
* @return self
*/
public function setExceptionName($exception_name)
{
if (is_null($exception_name)) {
throw new \InvalidArgumentException('non-nullable exception_name cannot be null');
}
$this->container['exception_name'] = $exception_name;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SendSMTPEnvelopeOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SendSMTPEnvelopeOptions Class Doc Comment
*
* @category Class
* @description Options for the email envelope
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SendSMTPEnvelopeOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SendSMTPEnvelopeOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'rcpt_to' => 'string[]',
'mail_from' => 'string',
'data' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'rcpt_to' => null,
'mail_from' => null,
'data' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'rcpt_to' => false,
'mail_from' => false,
'data' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'rcpt_to' => 'rcptTo',
'mail_from' => 'mailFrom',
'data' => 'data'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'rcpt_to' => 'setRcptTo',
'mail_from' => 'setMailFrom',
'data' => 'setData'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'rcpt_to' => 'getRcptTo',
'mail_from' => 'getMailFrom',
'data' => 'getData'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('rcpt_to', $data ?? [], null);
$this->setIfExists('mail_from', $data ?? [], null);
$this->setIfExists('data', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['rcpt_to'] === null) {
$invalidProperties[] = "'rcpt_to' can't be null";
}
if ($this->container['mail_from'] === null) {
$invalidProperties[] = "'mail_from' can't be null";
}
if ($this->container['data'] === null) {
$invalidProperties[] = "'data' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets rcpt_to
*
* @return string[]
*/
public function getRcptTo()
{
return $this->container['rcpt_to'];
}
/**
* Sets rcpt_to
*
* @param string[] $rcpt_to rcpt_to
*
* @return self
*/
public function setRcptTo($rcpt_to)
{
if (is_null($rcpt_to)) {
throw new \InvalidArgumentException('non-nullable rcpt_to cannot be null');
}
$this->container['rcpt_to'] = $rcpt_to;
return $this;
}
/**
* Gets mail_from
*
* @return string
*/
public function getMailFrom()
{
return $this->container['mail_from'];
}
/**
* Sets mail_from
*
* @param string $mail_from mail_from
*
* @return self
*/
public function setMailFrom($mail_from)
{
if (is_null($mail_from)) {
throw new \InvalidArgumentException('non-nullable mail_from cannot be null');
}
$this->container['mail_from'] = $mail_from;
return $this;
}
/**
* Gets data
*
* @return string
*/
public function getData()
{
return $this->container['data'];
}
/**
* Sets data
*
* @param string $data data
*
* @return self
*/
public function setData($data)
{
if (is_null($data)) {
throw new \InvalidArgumentException('non-nullable data cannot be null');
}
$this->container['data'] = $data;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SendEmailOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SendEmailOptions Class Doc Comment
*
* @category Class
* @description Options for the email to be sent
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SendEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SendEmailOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'to_contacts' => 'string[]',
'to_group' => 'string',
'to' => 'string[]',
'from' => 'string',
'cc' => 'string[]',
'bcc' => 'string[]',
'subject' => 'string',
'reply_to' => 'string',
'custom_headers' => 'array<string,string>',
'body' => 'string',
'html' => 'bool',
'is_html' => 'bool',
'charset' => 'string',
'attachments' => 'string[]',
'template_variables' => 'array<string,object>',
'template' => 'string',
'send_strategy' => 'string',
'use_inbox_name' => 'bool',
'add_tracking_pixel' => 'bool',
'filter_bounced_recipients' => 'bool',
'validate_email_addresses' => 'string',
'ignore_empty_recipients' => 'bool',
'is_x_amp_html' => 'bool',
'body_parts' => '\MailSlurp\Models\SendEmailBodyPart[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'to_contacts' => 'uuid',
'to_group' => 'uuid',
'to' => null,
'from' => null,
'cc' => null,
'bcc' => null,
'subject' => null,
'reply_to' => null,
'custom_headers' => null,
'body' => null,
'html' => null,
'is_html' => null,
'charset' => null,
'attachments' => null,
'template_variables' => null,
'template' => 'uuid',
'send_strategy' => null,
'use_inbox_name' => null,
'add_tracking_pixel' => null,
'filter_bounced_recipients' => null,
'validate_email_addresses' => null,
'ignore_empty_recipients' => null,
'is_x_amp_html' => null,
'body_parts' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'to_contacts' => true,
'to_group' => true,
'to' => true,
'from' => true,
'cc' => true,
'bcc' => true,
'subject' => true,
'reply_to' => true,
'custom_headers' => true,
'body' => true,
'html' => true,
'is_html' => true,
'charset' => true,
'attachments' => true,
'template_variables' => true,
'template' => true,
'send_strategy' => true,
'use_inbox_name' => true,
'add_tracking_pixel' => true,
'filter_bounced_recipients' => true,
'validate_email_addresses' => true,
'ignore_empty_recipients' => true,
'is_x_amp_html' => true,
'body_parts' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'to_contacts' => 'toContacts',
'to_group' => 'toGroup',
'to' => 'to',
'from' => 'from',
'cc' => 'cc',
'bcc' => 'bcc',
'subject' => 'subject',
'reply_to' => 'replyTo',
'custom_headers' => 'customHeaders',
'body' => 'body',
'html' => 'html',
'is_html' => 'isHTML',
'charset' => 'charset',
'attachments' => 'attachments',
'template_variables' => 'templateVariables',
'template' => 'template',
'send_strategy' => 'sendStrategy',
'use_inbox_name' => 'useInboxName',
'add_tracking_pixel' => 'addTrackingPixel',
'filter_bounced_recipients' => 'filterBouncedRecipients',
'validate_email_addresses' => 'validateEmailAddresses',
'ignore_empty_recipients' => 'ignoreEmptyRecipients',
'is_x_amp_html' => 'isXAmpHtml',
'body_parts' => 'bodyParts'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'to_contacts' => 'setToContacts',
'to_group' => 'setToGroup',
'to' => 'setTo',
'from' => 'setFrom',
'cc' => 'setCc',
'bcc' => 'setBcc',
'subject' => 'setSubject',
'reply_to' => 'setReplyTo',
'custom_headers' => 'setCustomHeaders',
'body' => 'setBody',
'html' => 'setHtml',
'is_html' => 'setIsHtml',
'charset' => 'setCharset',
'attachments' => 'setAttachments',
'template_variables' => 'setTemplateVariables',
'template' => 'setTemplate',
'send_strategy' => 'setSendStrategy',
'use_inbox_name' => 'setUseInboxName',
'add_tracking_pixel' => 'setAddTrackingPixel',
'filter_bounced_recipients' => 'setFilterBouncedRecipients',
'validate_email_addresses' => 'setValidateEmailAddresses',
'ignore_empty_recipients' => 'setIgnoreEmptyRecipients',
'is_x_amp_html' => 'setIsXAmpHtml',
'body_parts' => 'setBodyParts'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'to_contacts' => 'getToContacts',
'to_group' => 'getToGroup',
'to' => 'getTo',
'from' => 'getFrom',
'cc' => 'getCc',
'bcc' => 'getBcc',
'subject' => 'getSubject',
'reply_to' => 'getReplyTo',
'custom_headers' => 'getCustomHeaders',
'body' => 'getBody',
'html' => 'getHtml',
'is_html' => 'getIsHtml',
'charset' => 'getCharset',
'attachments' => 'getAttachments',
'template_variables' => 'getTemplateVariables',
'template' => 'getTemplate',
'send_strategy' => 'getSendStrategy',
'use_inbox_name' => 'getUseInboxName',
'add_tracking_pixel' => 'getAddTrackingPixel',
'filter_bounced_recipients' => 'getFilterBouncedRecipients',
'validate_email_addresses' => 'getValidateEmailAddresses',
'ignore_empty_recipients' => 'getIgnoreEmptyRecipients',
'is_x_amp_html' => 'getIsXAmpHtml',
'body_parts' => 'getBodyParts'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SEND_STRATEGY_SINGLE_MESSAGE = 'SINGLE_MESSAGE';
public const VALIDATE_EMAIL_ADDRESSES_VALIDATE_FILTER_REMOVE_INVALID = 'VALIDATE_FILTER_REMOVE_INVALID';
public const VALIDATE_EMAIL_ADDRESSES_VALIDATE_ERROR_IF_INVALID = 'VALIDATE_ERROR_IF_INVALID';
public const VALIDATE_EMAIL_ADDRESSES_NO_VALIDATION = 'NO_VALIDATION';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSendStrategyAllowableValues()
{
return [
self::SEND_STRATEGY_SINGLE_MESSAGE,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getValidateEmailAddressesAllowableValues()
{
return [
self::VALIDATE_EMAIL_ADDRESSES_VALIDATE_FILTER_REMOVE_INVALID,
self::VALIDATE_EMAIL_ADDRESSES_VALIDATE_ERROR_IF_INVALID,
self::VALIDATE_EMAIL_ADDRESSES_NO_VALIDATION,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('to_contacts', $data ?? [], null);
$this->setIfExists('to_group', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('reply_to', $data ?? [], null);
$this->setIfExists('custom_headers', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('html', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
$this->setIfExists('template_variables', $data ?? [], null);
$this->setIfExists('template', $data ?? [], null);
$this->setIfExists('send_strategy', $data ?? [], null);
$this->setIfExists('use_inbox_name', $data ?? [], null);
$this->setIfExists('add_tracking_pixel', $data ?? [], null);
$this->setIfExists('filter_bounced_recipients', $data ?? [], null);
$this->setIfExists('validate_email_addresses', $data ?? [], null);
$this->setIfExists('ignore_empty_recipients', $data ?? [], null);
$this->setIfExists('is_x_amp_html', $data ?? [], null);
$this->setIfExists('body_parts', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
$allowedValues = $this->getSendStrategyAllowableValues();
if (!is_null($this->container['send_strategy']) && !in_array($this->container['send_strategy'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'send_strategy', must be one of '%s'",
$this->container['send_strategy'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getValidateEmailAddressesAllowableValues();
if (!is_null($this->container['validate_email_addresses']) && !in_array($this->container['validate_email_addresses'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'validate_email_addresses', must be one of '%s'",
$this->container['validate_email_addresses'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets to_contacts
*
* @return string[]|null
*/
public function getToContacts()
{
return $this->container['to_contacts'];
}
/**
* Sets to_contacts
*
* @param string[]|null $to_contacts Optional list of contact IDs to send email to. Manage your contacts via the API or dashboard. When contacts are used the email is sent to each contact separately so they will not see other recipients.
*
* @return self
*/
public function setToContacts($to_contacts)
{
if (is_null($to_contacts)) {
array_push($this->openAPINullablesSetToNull, 'to_contacts');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('to_contacts', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['to_contacts'] = $to_contacts;
return $this;
}
/**
* Gets to_group
*
* @return string|null
*/
public function getToGroup()
{
return $this->container['to_group'];
}
/**
* Sets to_group
*
* @param string|null $to_group Optional contact group ID to send email to. You can create contacts and contact groups in the API or dashboard and use them for email campaigns. When contact groups are used the email is sent to each contact separately so they will not see other recipients
*
* @return self
*/
public function setToGroup($to_group)
{
if (is_null($to_group)) {
array_push($this->openAPINullablesSetToNull, 'to_group');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('to_group', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['to_group'] = $to_group;
return $this;
}
/**
* Gets to
*
* @return string[]|null
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[]|null $to List of destination email addresses. Each email address must be RFC 5322 format. Even single recipients must be in array form. Maximum recipients per email depends on your plan. If you need to send many emails try using contacts or contact groups or use a non standard sendStrategy to ensure that spam filters are not triggered (many recipients in one email can affect your spam rating). Be cautious when sending emails that your recipients exist. High bounce rates (meaning a high percentage of emails cannot be delivered because an address does not exist) can result in account freezing.
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
array_push($this->openAPINullablesSetToNull, 'to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from Optional from address. Email address is RFC 5322 format and may include a display name and email in angle brackets (`my@address.com` or `My inbox <my@address.com>`). If no sender is set the source inbox address will be used for this field. If you set `useInboxName` to `true` the from field will include the inbox name as a display name: `inbox_name <inbox@address.com>`. For this to work use the name field when creating an inbox. Beware of potential spam penalties when setting the from field to an address not used by the inbox. Your emails may get blocked by services if you impersonate another address. To use a custom email addresses use a custom domain. You can create domains with the DomainController. The domain must be verified in the dashboard before it can be used.
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets cc
*
* @return string[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[]|null $cc Optional list of cc destination email addresses
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
array_push($this->openAPINullablesSetToNull, 'cc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('cc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets bcc
*
* @return string[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[]|null $bcc Optional list of bcc destination email addresses
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
array_push($this->openAPINullablesSetToNull, 'bcc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bcc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject Optional email subject line
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets reply_to
*
* @return string|null
*/
public function getReplyTo()
{
return $this->container['reply_to'];
}
/**
* Sets reply_to
*
* @param string|null $reply_to Optional replyTo header
*
* @return self
*/
public function setReplyTo($reply_to)
{
if (is_null($reply_to)) {
array_push($this->openAPINullablesSetToNull, 'reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reply_to'] = $reply_to;
return $this;
}
/**
* Gets custom_headers
*
* @return array<string,string>|null
*/
public function getCustomHeaders()
{
return $this->container['custom_headers'];
}
/**
* Sets custom_headers
*
* @param array<string,string>|null $custom_headers Optional custom headers
*
* @return self
*/
public function setCustomHeaders($custom_headers)
{
if (is_null($custom_headers)) {
array_push($this->openAPINullablesSetToNull, 'custom_headers');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('custom_headers', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['custom_headers'] = $custom_headers;
return $this;
}
/**
* Gets body
*
* @return string|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string|null $body Optional contents of email. If body contains HTML then set `isHTML` to true to ensure that email clients render it correctly. You can use moustache template syntax in the email body in conjunction with `toGroup` contact variables or `templateVariables` data. If you need more templating control consider creating a template and using the `template` property instead of the body.
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
array_push($this->openAPINullablesSetToNull, 'body');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets html
*
* @return bool|null
*/
public function getHtml()
{
return $this->container['html'];
}
/**
* Sets html
*
* @param bool|null $html Optional HTML flag to indicate that contents is HTML. Set's a `content-type: text/html` for email. (Deprecated: use `isHTML` instead.)
*
* @return self
*/
public function setHtml($html)
{
if (is_null($html)) {
array_push($this->openAPINullablesSetToNull, 'html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['html'] = $html;
return $this;
}
/**
* Gets is_html
*
* @return bool|null
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool|null $is_html Optional HTML flag. If true the `content-type` of the email will be `text/html`. Set to true when sending HTML to ensure proper rending on email clients
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
array_push($this->openAPINullablesSetToNull, 'is_html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('is_html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset Optional charset
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets attachments
*
* @return string[]|null
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[]|null $attachments Optional list of attachment IDs to send with this email. You must first upload each attachment separately via method call or dashboard in order to obtain attachment IDs. This way you can reuse attachments with different emails once uploaded. There are several ways to upload that support `multi-part form`, `base64 file encoding`, and octet stream binary uploads. See the `UploadController` for available methods.
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
array_push($this->openAPINullablesSetToNull, 'attachments');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachments', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Gets template_variables
*
* @return array<string,object>|null
*/
public function getTemplateVariables()
{
return $this->container['template_variables'];
}
/**
* Sets template_variables
*
* @param array<string,object>|null $template_variables Optional map of template variables. Will replace moustache syntax variables in subject and body or template with the associated values if found.
*
* @return self
*/
public function setTemplateVariables($template_variables)
{
if (is_null($template_variables)) {
array_push($this->openAPINullablesSetToNull, 'template_variables');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_variables', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_variables'] = $template_variables;
return $this;
}
/**
* Gets template
*
* @return string|null
*/
public function getTemplate()
{
return $this->container['template'];
}
/**
* Sets template
*
* @param string|null $template Optional template ID to use for body. Will override body if provided. When using a template make sure you pass the corresponding map of `templateVariables`. You can find which variables are needed by fetching the template itself or viewing it in the dashboard.
*
* @return self
*/
public function setTemplate($template)
{
if (is_null($template)) {
array_push($this->openAPINullablesSetToNull, 'template');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template'] = $template;
return $this;
}
/**
* Gets send_strategy
*
* @return string|null
*/
public function getSendStrategy()
{
return $this->container['send_strategy'];
}
/**
* Sets send_strategy
*
* @param string|null $send_strategy How an email should be sent based on its recipients
*
* @return self
*/
public function setSendStrategy($send_strategy)
{
$allowedValues = $this->getSendStrategyAllowableValues();
if (!is_null($send_strategy) && !in_array($send_strategy, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'send_strategy', must be one of '%s'",
$send_strategy,
implode("', '", $allowedValues)
)
);
}
if (is_null($send_strategy)) {
array_push($this->openAPINullablesSetToNull, 'send_strategy');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('send_strategy', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['send_strategy'] = $send_strategy;
return $this;
}
/**
* Gets use_inbox_name
*
* @return bool|null
*/
public function getUseInboxName()
{
return $this->container['use_inbox_name'];
}
/**
* Sets use_inbox_name
*
* @param bool|null $use_inbox_name Use name of inbox as sender email address name. Will construct RFC 5322 email address with `Inbox name <inbox@address.com>` if the inbox has a name.
*
* @return self
*/
public function setUseInboxName($use_inbox_name)
{
if (is_null($use_inbox_name)) {
array_push($this->openAPINullablesSetToNull, 'use_inbox_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_inbox_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_inbox_name'] = $use_inbox_name;
return $this;
}
/**
* Gets add_tracking_pixel
*
* @return bool|null
*/
public function getAddTrackingPixel()
{
return $this->container['add_tracking_pixel'];
}
/**
* Sets add_tracking_pixel
*
* @param bool|null $add_tracking_pixel Add tracking pixel to email
*
* @return self
*/
public function setAddTrackingPixel($add_tracking_pixel)
{
if (is_null($add_tracking_pixel)) {
array_push($this->openAPINullablesSetToNull, 'add_tracking_pixel');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('add_tracking_pixel', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['add_tracking_pixel'] = $add_tracking_pixel;
return $this;
}
/**
* Gets filter_bounced_recipients
*
* @return bool|null
*/
public function getFilterBouncedRecipients()
{
return $this->container['filter_bounced_recipients'];
}
/**
* Sets filter_bounced_recipients
*
* @param bool|null $filter_bounced_recipients Filter recipients to remove any bounced recipients from to, bcc, and cc before sending
*
* @return self
*/
public function setFilterBouncedRecipients($filter_bounced_recipients)
{
if (is_null($filter_bounced_recipients)) {
array_push($this->openAPINullablesSetToNull, 'filter_bounced_recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('filter_bounced_recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['filter_bounced_recipients'] = $filter_bounced_recipients;
return $this;
}
/**
* Gets validate_email_addresses
*
* @return string|null
*/
public function getValidateEmailAddresses()
{
return $this->container['validate_email_addresses'];
}
/**
* Sets validate_email_addresses
*
* @param string|null $validate_email_addresses Validate recipient email addresses before sending
*
* @return self
*/
public function setValidateEmailAddresses($validate_email_addresses)
{
$allowedValues = $this->getValidateEmailAddressesAllowableValues();
if (!is_null($validate_email_addresses) && !in_array($validate_email_addresses, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'validate_email_addresses', must be one of '%s'",
$validate_email_addresses,
implode("', '", $allowedValues)
)
);
}
if (is_null($validate_email_addresses)) {
array_push($this->openAPINullablesSetToNull, 'validate_email_addresses');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('validate_email_addresses', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['validate_email_addresses'] = $validate_email_addresses;
return $this;
}
/**
* Gets ignore_empty_recipients
*
* @return bool|null
*/
public function getIgnoreEmptyRecipients()
{
return $this->container['ignore_empty_recipients'];
}
/**
* Sets ignore_empty_recipients
*
* @param bool|null $ignore_empty_recipients Ignore empty recipients after validation removes all recipients as invalid and fail silently
*
* @return self
*/
public function setIgnoreEmptyRecipients($ignore_empty_recipients)
{
if (is_null($ignore_empty_recipients)) {
array_push($this->openAPINullablesSetToNull, 'ignore_empty_recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('ignore_empty_recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['ignore_empty_recipients'] = $ignore_empty_recipients;
return $this;
}
/**
* Gets is_x_amp_html
*
* @return bool|null
*/
public function getIsXAmpHtml()
{
return $this->container['is_x_amp_html'];
}
/**
* Sets is_x_amp_html
*
* @param bool|null $is_x_amp_html Is content AMP4EMAIL compatible. If set will send as x-amp-html part.
*
* @return self
*/
public function setIsXAmpHtml($is_x_amp_html)
{
if (is_null($is_x_amp_html)) {
array_push($this->openAPINullablesSetToNull, 'is_x_amp_html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('is_x_amp_html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['is_x_amp_html'] = $is_x_amp_html;
return $this;
}
/**
* Gets body_parts
*
* @return \MailSlurp\Models\SendEmailBodyPart[]|null
*/
public function getBodyParts()
{
return $this->container['body_parts'];
}
/**
* Sets body_parts
*
* @param \MailSlurp\Models\SendEmailBodyPart[]|null $body_parts Email body content parts for multipart mime message. Will override body.
*
* @return self
*/
public function setBodyParts($body_parts)
{
if (is_null($body_parts)) {
array_push($this->openAPINullablesSetToNull, 'body_parts');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_parts', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_parts'] = $body_parts;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SendEmailBodyPart
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SendEmailBodyPart Class Doc Comment
*
* @category Class
* @description Email body content parts for multipart mime message. Will override body.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SendEmailBodyPart implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SendEmailBodyPart';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content_type' => 'string',
'content_body' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content_type' => null,
'content_body' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content_type' => false,
'content_body' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content_type' => 'contentType',
'content_body' => 'contentBody'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content_type' => 'setContentType',
'content_body' => 'setContentBody'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content_type' => 'getContentType',
'content_body' => 'getContentBody'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content_type', $data ?? [], null);
$this->setIfExists('content_body', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['content_type'] === null) {
$invalidProperties[] = "'content_type' can't be null";
}
if ($this->container['content_body'] === null) {
$invalidProperties[] = "'content_body' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content_type
*
* @return string
*/
public function getContentType()
{
return $this->container['content_type'];
}
/**
* Sets content_type
*
* @param string $content_type content_type
*
* @return self
*/
public function setContentType($content_type)
{
if (is_null($content_type)) {
throw new \InvalidArgumentException('non-nullable content_type cannot be null');
}
$this->container['content_type'] = $content_type;
return $this;
}
/**
* Gets content_body
*
* @return string
*/
public function getContentBody()
{
return $this->container['content_body'];
}
/**
* Sets content_body
*
* @param string $content_body content_body
*
* @return self
*/
public function setContentBody($content_body)
{
if (is_null($content_body)) {
throw new \InvalidArgumentException('non-nullable content_body cannot be null');
}
$this->container['content_body'] = $content_body;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SearchInboxesOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SearchInboxesOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SearchInboxesOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SearchInboxesOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'page_index' => 'int',
'page_size' => 'int',
'sort_direction' => 'string',
'favourite' => 'bool',
'search' => 'string',
'tag' => 'string',
'since' => '\DateTime',
'before' => '\DateTime',
'inbox_type' => 'string',
'inbox_function' => 'string',
'domain_id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'page_index' => 'int32',
'page_size' => 'int32',
'sort_direction' => null,
'favourite' => null,
'search' => null,
'tag' => null,
'since' => 'date-time',
'before' => 'date-time',
'inbox_type' => null,
'inbox_function' => null,
'domain_id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'page_index' => true,
'page_size' => true,
'sort_direction' => true,
'favourite' => true,
'search' => true,
'tag' => true,
'since' => true,
'before' => true,
'inbox_type' => true,
'inbox_function' => true,
'domain_id' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'page_index' => 'pageIndex',
'page_size' => 'pageSize',
'sort_direction' => 'sortDirection',
'favourite' => 'favourite',
'search' => 'search',
'tag' => 'tag',
'since' => 'since',
'before' => 'before',
'inbox_type' => 'inboxType',
'inbox_function' => 'inboxFunction',
'domain_id' => 'domainId'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'page_index' => 'setPageIndex',
'page_size' => 'setPageSize',
'sort_direction' => 'setSortDirection',
'favourite' => 'setFavourite',
'search' => 'setSearch',
'tag' => 'setTag',
'since' => 'setSince',
'before' => 'setBefore',
'inbox_type' => 'setInboxType',
'inbox_function' => 'setInboxFunction',
'domain_id' => 'setDomainId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'page_index' => 'getPageIndex',
'page_size' => 'getPageSize',
'sort_direction' => 'getSortDirection',
'favourite' => 'getFavourite',
'search' => 'getSearch',
'tag' => 'getTag',
'since' => 'getSince',
'before' => 'getBefore',
'inbox_type' => 'getInboxType',
'inbox_function' => 'getInboxFunction',
'domain_id' => 'getDomainId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SORT_DIRECTION_ASC = 'ASC';
public const SORT_DIRECTION_DESC = 'DESC';
public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX';
public const INBOX_FUNCTION_ALIAS = 'ALIAS';
public const INBOX_FUNCTION_THREAD = 'THREAD';
public const INBOX_FUNCTION_CATCH_ALL = 'CATCH_ALL';
public const INBOX_FUNCTION_CONNECTOR = 'CONNECTOR';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSortDirectionAllowableValues()
{
return [
self::SORT_DIRECTION_ASC,
self::SORT_DIRECTION_DESC,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getInboxTypeAllowableValues()
{
return [
self::INBOX_TYPE_HTTP_INBOX,
self::INBOX_TYPE_SMTP_INBOX,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getInboxFunctionAllowableValues()
{
return [
self::INBOX_FUNCTION_ALIAS,
self::INBOX_FUNCTION_THREAD,
self::INBOX_FUNCTION_CATCH_ALL,
self::INBOX_FUNCTION_CONNECTOR,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('page_index', $data ?? [], null);
$this->setIfExists('page_size', $data ?? [], null);
$this->setIfExists('sort_direction', $data ?? [], null);
$this->setIfExists('favourite', $data ?? [], null);
$this->setIfExists('search', $data ?? [], null);
$this->setIfExists('tag', $data ?? [], null);
$this->setIfExists('since', $data ?? [], null);
$this->setIfExists('before', $data ?? [], null);
$this->setIfExists('inbox_type', $data ?? [], null);
$this->setIfExists('inbox_function', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sort_direction', must be one of '%s'",
$this->container['sort_direction'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'inbox_type', must be one of '%s'",
$this->container['inbox_type'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getInboxFunctionAllowableValues();
if (!is_null($this->container['inbox_function']) && !in_array($this->container['inbox_function'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'inbox_function', must be one of '%s'",
$this->container['inbox_function'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets page_index
*
* @return int|null
*/
public function getPageIndex()
{
return $this->container['page_index'];
}
/**
* Sets page_index
*
* @param int|null $page_index Optional page index in list pagination
*
* @return self
*/
public function setPageIndex($page_index)
{
if (is_null($page_index)) {
array_push($this->openAPINullablesSetToNull, 'page_index');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('page_index', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['page_index'] = $page_index;
return $this;
}
/**
* Gets page_size
*
* @return int|null
*/
public function getPageSize()
{
return $this->container['page_size'];
}
/**
* Sets page_size
*
* @param int|null $page_size Optional page size in list pagination
*
* @return self
*/
public function setPageSize($page_size)
{
if (is_null($page_size)) {
array_push($this->openAPINullablesSetToNull, 'page_size');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('page_size', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['page_size'] = $page_size;
return $this;
}
/**
* Gets sort_direction
*
* @return string|null
*/
public function getSortDirection()
{
return $this->container['sort_direction'];
}
/**
* Sets sort_direction
*
* @param string|null $sort_direction Optional createdAt sort direction ASC or DESC
*
* @return self
*/
public function setSortDirection($sort_direction)
{
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sort_direction', must be one of '%s'",
$sort_direction,
implode("', '", $allowedValues)
)
);
}
if (is_null($sort_direction)) {
array_push($this->openAPINullablesSetToNull, 'sort_direction');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sort_direction', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sort_direction'] = $sort_direction;
return $this;
}
/**
* Gets favourite
*
* @return bool|null
*/
public function getFavourite()
{
return $this->container['favourite'];
}
/**
* Sets favourite
*
* @param bool|null $favourite Optionally filter results for favourites only
*
* @return self
*/
public function setFavourite($favourite)
{
if (is_null($favourite)) {
array_push($this->openAPINullablesSetToNull, 'favourite');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('favourite', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['favourite'] = $favourite;
return $this;
}
/**
* Gets search
*
* @return string|null
*/
public function getSearch()
{
return $this->container['search'];
}
/**
* Sets search
*
* @param string|null $search Optionally filter by search words partial matching ID, tags, name, and email address
*
* @return self
*/
public function setSearch($search)
{
if (is_null($search)) {
array_push($this->openAPINullablesSetToNull, 'search');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('search', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['search'] = $search;
return $this;
}
/**
* Gets tag
*
* @return string|null
*/
public function getTag()
{
return $this->container['tag'];
}
/**
* Sets tag
*
* @param string|null $tag Optionally filter by tags. Will return inboxes that include given tags
*
* @return self
*/
public function setTag($tag)
{
if (is_null($tag)) {
array_push($this->openAPINullablesSetToNull, 'tag');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('tag', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['tag'] = $tag;
return $this;
}
/**
* Gets since
*
* @return \DateTime|null
*/
public function getSince()
{
return $this->container['since'];
}
/**
* Sets since
*
* @param \DateTime|null $since Optional filter by created after given date time
*
* @return self
*/
public function setSince($since)
{
if (is_null($since)) {
array_push($this->openAPINullablesSetToNull, 'since');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('since', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['since'] = $since;
return $this;
}
/**
* Gets before
*
* @return \DateTime|null
*/
public function getBefore()
{
return $this->container['before'];
}
/**
* Sets before
*
* @param \DateTime|null $before Optional filter by created before given date time
*
* @return self
*/
public function setBefore($before)
{
if (is_null($before)) {
array_push($this->openAPINullablesSetToNull, 'before');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('before', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['before'] = $before;
return $this;
}
/**
* Gets inbox_type
*
* @return string|null
*/
public function getInboxType()
{
return $this->container['inbox_type'];
}
/**
* Sets inbox_type
*
* @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).
*
* @return self
*/
public function setInboxType($inbox_type)
{
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'inbox_type', must be one of '%s'",
$inbox_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($inbox_type)) {
array_push($this->openAPINullablesSetToNull, 'inbox_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_type'] = $inbox_type;
return $this;
}
/**
* Gets inbox_function
*
* @return string|null
*/
public function getInboxFunction()
{
return $this->container['inbox_function'];
}
/**
* Sets inbox_function
*
* @param string|null $inbox_function Optional filter by inbox function
*
* @return self
*/
public function setInboxFunction($inbox_function)
{
$allowedValues = $this->getInboxFunctionAllowableValues();
if (!is_null($inbox_function) && !in_array($inbox_function, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'inbox_function', must be one of '%s'",
$inbox_function,
implode("', '", $allowedValues)
)
);
}
if (is_null($inbox_function)) {
array_push($this->openAPINullablesSetToNull, 'inbox_function');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_function', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_function'] = $inbox_function;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id Optional domain ID filter
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* SearchEmailsOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* SearchEmailsOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class SearchEmailsOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'SearchEmailsOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_ids' => 'string[]',
'page_index' => 'int',
'page_size' => 'int',
'sort_direction' => 'string',
'unread_only' => 'bool',
'search_filter' => 'string',
'since' => '\DateTime',
'before' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_ids' => 'uuid',
'page_index' => 'int32',
'page_size' => 'int32',
'sort_direction' => null,
'unread_only' => null,
'search_filter' => null,
'since' => 'date-time',
'before' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_ids' => false,
'page_index' => false,
'page_size' => false,
'sort_direction' => false,
'unread_only' => false,
'search_filter' => false,
'since' => false,
'before' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_ids' => 'inboxIds',
'page_index' => 'pageIndex',
'page_size' => 'pageSize',
'sort_direction' => 'sortDirection',
'unread_only' => 'unreadOnly',
'search_filter' => 'searchFilter',
'since' => 'since',
'before' => 'before'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_ids' => 'setInboxIds',
'page_index' => 'setPageIndex',
'page_size' => 'setPageSize',
'sort_direction' => 'setSortDirection',
'unread_only' => 'setUnreadOnly',
'search_filter' => 'setSearchFilter',
'since' => 'setSince',
'before' => 'setBefore'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_ids' => 'getInboxIds',
'page_index' => 'getPageIndex',
'page_size' => 'getPageSize',
'sort_direction' => 'getSortDirection',
'unread_only' => 'getUnreadOnly',
'search_filter' => 'getSearchFilter',
'since' => 'getSince',
'before' => 'getBefore'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SORT_DIRECTION_ASC = 'ASC';
public const SORT_DIRECTION_DESC = 'DESC';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSortDirectionAllowableValues()
{
return [
self::SORT_DIRECTION_ASC,
self::SORT_DIRECTION_DESC,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_ids', $data ?? [], null);
$this->setIfExists('page_index', $data ?? [], null);
$this->setIfExists('page_size', $data ?? [], null);
$this->setIfExists('sort_direction', $data ?? [], null);
$this->setIfExists('unread_only', $data ?? [], null);
$this->setIfExists('search_filter', $data ?? [], null);
$this->setIfExists('since', $data ?? [], null);
$this->setIfExists('before', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (!is_null($this->container['page_size']) && ($this->container['page_size'] > 100)) {
$invalidProperties[] = "invalid value for 'page_size', must be smaller than or equal to 100.";
}
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($this->container['sort_direction']) && !in_array($this->container['sort_direction'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sort_direction', must be one of '%s'",
$this->container['sort_direction'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_ids
*
* @return string[]|null
*/
public function getInboxIds()
{
return $this->container['inbox_ids'];
}
/**
* Sets inbox_ids
*
* @param string[]|null $inbox_ids Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
*
* @return self
*/
public function setInboxIds($inbox_ids)
{
if (is_null($inbox_ids)) {
throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null');
}
$this->container['inbox_ids'] = $inbox_ids;
return $this;
}
/**
* Gets page_index
*
* @return int|null
*/
public function getPageIndex()
{
return $this->container['page_index'];
}
/**
* Sets page_index
*
* @param int|null $page_index Optional page index in email list pagination
*
* @return self
*/
public function setPageIndex($page_index)
{
if (is_null($page_index)) {
throw new \InvalidArgumentException('non-nullable page_index cannot be null');
}
$this->container['page_index'] = $page_index;
return $this;
}
/**
* Gets page_size
*
* @return int|null
*/
public function getPageSize()
{
return $this->container['page_size'];
}
/**
* Sets page_size
*
* @param int|null $page_size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results
*
* @return self
*/
public function setPageSize($page_size)
{
if (!is_null($page_size) && ($page_size > 100)) {
throw new \InvalidArgumentException('invalid value for $page_size when calling SearchEmailsOptions., must be smaller than or equal to 100.');
}
if (is_null($page_size)) {
throw new \InvalidArgumentException('non-nullable page_size cannot be null');
}
$this->container['page_size'] = $page_size;
return $this;
}
/**
* Gets sort_direction
*
* @return string|null
*/
public function getSortDirection()
{
return $this->container['sort_direction'];
}
/**
* Sets sort_direction
*
* @param string|null $sort_direction Optional createdAt sort direction ASC or DESC
*
* @return self
*/
public function setSortDirection($sort_direction)
{
$allowedValues = $this->getSortDirectionAllowableValues();
if (!is_null($sort_direction) && !in_array($sort_direction, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sort_direction', must be one of '%s'",
$sort_direction,
implode("', '", $allowedValues)
)
);
}
if (is_null($sort_direction)) {
throw new \InvalidArgumentException('non-nullable sort_direction cannot be null');
}
$this->container['sort_direction'] = $sort_direction;
return $this;
}
/**
* Gets unread_only
*
* @return bool|null
*/
public function getUnreadOnly()
{
return $this->container['unread_only'];
}
/**
* Sets unread_only
*
* @param bool|null $unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly
*
* @return self
*/
public function setUnreadOnly($unread_only)
{
if (is_null($unread_only)) {
throw new \InvalidArgumentException('non-nullable unread_only cannot be null');
}
$this->container['unread_only'] = $unread_only;
return $this;
}
/**
* Gets search_filter
*
* @return string|null
*/
public function getSearchFilter()
{
return $this->container['search_filter'];
}
/**
* Sets search_filter
*
* @param string|null $search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body
*
* @return self
*/
public function setSearchFilter($search_filter)
{
if (is_null($search_filter)) {
throw new \InvalidArgumentException('non-nullable search_filter cannot be null');
}
$this->container['search_filter'] = $search_filter;
return $this;
}
/**
* Gets since
*
* @return \DateTime|null
*/
public function getSince()
{
return $this->container['since'];
}
/**
* Sets since
*
* @param \DateTime|null $since Optional filter emails received after given date time
*
* @return self
*/
public function setSince($since)
{
if (is_null($since)) {
throw new \InvalidArgumentException('non-nullable since cannot be null');
}
$this->container['since'] = $since;
return $this;
}
/**
* Gets before
*
* @return \DateTime|null
*/
public function getBefore()
{
return $this->container['before'];
}
/**
* Sets before
*
* @param \DateTime|null $before Optional filter emails received before given date time
*
* @return self
*/
public function setBefore($before)
{
if (is_null($before)) {
throw new \InvalidArgumentException('non-nullable before cannot be null');
}
$this->container['before'] = $before;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ScheduledJobDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ScheduledJobDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ScheduledJobDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ScheduledJobDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'inbox_id' => 'string',
'job_id' => 'string',
'group_id' => 'string',
'trigger_id' => 'string',
'status' => 'string',
'send_at_timestamp' => '\DateTime',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'inbox_id' => 'uuid',
'job_id' => null,
'group_id' => null,
'trigger_id' => null,
'status' => null,
'send_at_timestamp' => 'date-time',
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'inbox_id' => false,
'job_id' => false,
'group_id' => false,
'trigger_id' => false,
'status' => false,
'send_at_timestamp' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'inbox_id' => 'inboxId',
'job_id' => 'jobId',
'group_id' => 'groupId',
'trigger_id' => 'triggerId',
'status' => 'status',
'send_at_timestamp' => 'sendAtTimestamp',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'inbox_id' => 'setInboxId',
'job_id' => 'setJobId',
'group_id' => 'setGroupId',
'trigger_id' => 'setTriggerId',
'status' => 'setStatus',
'send_at_timestamp' => 'setSendAtTimestamp',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'inbox_id' => 'getInboxId',
'job_id' => 'getJobId',
'group_id' => 'getGroupId',
'trigger_id' => 'getTriggerId',
'status' => 'getStatus',
'send_at_timestamp' => 'getSendAtTimestamp',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_SUBMITTED = 'SUBMITTED';
public const STATUS_COMPLETED = 'COMPLETED';
public const STATUS_ABORTED = 'ABORTED';
public const STATUS_FAILED = 'FAILED';
public const STATUS_CANCELLED = 'CANCELLED';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_SUBMITTED,
self::STATUS_COMPLETED,
self::STATUS_ABORTED,
self::STATUS_FAILED,
self::STATUS_CANCELLED,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('job_id', $data ?? [], null);
$this->setIfExists('group_id', $data ?? [], null);
$this->setIfExists('trigger_id', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
$this->setIfExists('send_at_timestamp', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['job_id'] === null) {
$invalidProperties[] = "'job_id' can't be null";
}
if ($this->container['group_id'] === null) {
$invalidProperties[] = "'group_id' can't be null";
}
if ($this->container['trigger_id'] === null) {
$invalidProperties[] = "'trigger_id' can't be null";
}
if ($this->container['status'] === null) {
$invalidProperties[] = "'status' can't be null";
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
if ($this->container['send_at_timestamp'] === null) {
$invalidProperties[] = "'send_at_timestamp' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets job_id
*
* @return string
*/
public function getJobId()
{
return $this->container['job_id'];
}
/**
* Sets job_id
*
* @param string $job_id job_id
*
* @return self
*/
public function setJobId($job_id)
{
if (is_null($job_id)) {
throw new \InvalidArgumentException('non-nullable job_id cannot be null');
}
$this->container['job_id'] = $job_id;
return $this;
}
/**
* Gets group_id
*
* @return string
*/
public function getGroupId()
{
return $this->container['group_id'];
}
/**
* Sets group_id
*
* @param string $group_id group_id
*
* @return self
*/
public function setGroupId($group_id)
{
if (is_null($group_id)) {
throw new \InvalidArgumentException('non-nullable group_id cannot be null');
}
$this->container['group_id'] = $group_id;
return $this;
}
/**
* Gets trigger_id
*
* @return string
*/
public function getTriggerId()
{
return $this->container['trigger_id'];
}
/**
* Sets trigger_id
*
* @param string $trigger_id trigger_id
*
* @return self
*/
public function setTriggerId($trigger_id)
{
if (is_null($trigger_id)) {
throw new \InvalidArgumentException('non-nullable trigger_id cannot be null');
}
$this->container['trigger_id'] = $trigger_id;
return $this;
}
/**
* Gets status
*
* @return string
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string $status status
*
* @return self
*/
public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets send_at_timestamp
*
* @return \DateTime
*/
public function getSendAtTimestamp()
{
return $this->container['send_at_timestamp'];
}
/**
* Sets send_at_timestamp
*
* @param \DateTime $send_at_timestamp send_at_timestamp
*
* @return self
*/
public function setSendAtTimestamp($send_at_timestamp)
{
if (is_null($send_at_timestamp)) {
throw new \InvalidArgumentException('non-nullable send_at_timestamp cannot be null');
}
$this->container['send_at_timestamp'] = $send_at_timestamp;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ScheduledJob
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ScheduledJob Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ScheduledJob implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ScheduledJob';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'inbox_id' => 'string',
'job_id' => 'string',
'group_id' => 'string',
'trigger_id' => 'string',
'status' => 'string',
'send_at_timestamp' => '\DateTime',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'inbox_id' => 'uuid',
'job_id' => null,
'group_id' => null,
'trigger_id' => null,
'status' => null,
'send_at_timestamp' => 'date-time',
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'inbox_id' => false,
'job_id' => false,
'group_id' => false,
'trigger_id' => false,
'status' => false,
'send_at_timestamp' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'inbox_id' => 'inboxId',
'job_id' => 'jobId',
'group_id' => 'groupId',
'trigger_id' => 'triggerId',
'status' => 'status',
'send_at_timestamp' => 'sendAtTimestamp',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'inbox_id' => 'setInboxId',
'job_id' => 'setJobId',
'group_id' => 'setGroupId',
'trigger_id' => 'setTriggerId',
'status' => 'setStatus',
'send_at_timestamp' => 'setSendAtTimestamp',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'inbox_id' => 'getInboxId',
'job_id' => 'getJobId',
'group_id' => 'getGroupId',
'trigger_id' => 'getTriggerId',
'status' => 'getStatus',
'send_at_timestamp' => 'getSendAtTimestamp',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_SUBMITTED = 'SUBMITTED';
public const STATUS_COMPLETED = 'COMPLETED';
public const STATUS_ABORTED = 'ABORTED';
public const STATUS_FAILED = 'FAILED';
public const STATUS_CANCELLED = 'CANCELLED';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_SUBMITTED,
self::STATUS_COMPLETED,
self::STATUS_ABORTED,
self::STATUS_FAILED,
self::STATUS_CANCELLED,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('job_id', $data ?? [], null);
$this->setIfExists('group_id', $data ?? [], null);
$this->setIfExists('trigger_id', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
$this->setIfExists('send_at_timestamp', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['job_id'] === null) {
$invalidProperties[] = "'job_id' can't be null";
}
if ($this->container['group_id'] === null) {
$invalidProperties[] = "'group_id' can't be null";
}
if ($this->container['trigger_id'] === null) {
$invalidProperties[] = "'trigger_id' can't be null";
}
if ($this->container['status'] === null) {
$invalidProperties[] = "'status' can't be null";
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
if ($this->container['send_at_timestamp'] === null) {
$invalidProperties[] = "'send_at_timestamp' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets job_id
*
* @return string
*/
public function getJobId()
{
return $this->container['job_id'];
}
/**
* Sets job_id
*
* @param string $job_id job_id
*
* @return self
*/
public function setJobId($job_id)
{
if (is_null($job_id)) {
throw new \InvalidArgumentException('non-nullable job_id cannot be null');
}
$this->container['job_id'] = $job_id;
return $this;
}
/**
* Gets group_id
*
* @return string
*/
public function getGroupId()
{
return $this->container['group_id'];
}
/**
* Sets group_id
*
* @param string $group_id group_id
*
* @return self
*/
public function setGroupId($group_id)
{
if (is_null($group_id)) {
throw new \InvalidArgumentException('non-nullable group_id cannot be null');
}
$this->container['group_id'] = $group_id;
return $this;
}
/**
* Gets trigger_id
*
* @return string
*/
public function getTriggerId()
{
return $this->container['trigger_id'];
}
/**
* Sets trigger_id
*
* @param string $trigger_id trigger_id
*
* @return self
*/
public function setTriggerId($trigger_id)
{
if (is_null($trigger_id)) {
throw new \InvalidArgumentException('non-nullable trigger_id cannot be null');
}
$this->container['trigger_id'] = $trigger_id;
return $this;
}
/**
* Gets status
*
* @return string
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string $status status
*
* @return self
*/
public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets send_at_timestamp
*
* @return \DateTime
*/
public function getSendAtTimestamp()
{
return $this->container['send_at_timestamp'];
}
/**
* Sets send_at_timestamp
*
* @param \DateTime $send_at_timestamp send_at_timestamp
*
* @return self
*/
public function setSendAtTimestamp($send_at_timestamp)
{
if (is_null($send_at_timestamp)) {
throw new \InvalidArgumentException('non-nullable send_at_timestamp cannot be null');
}
$this->container['send_at_timestamp'] = $send_at_timestamp;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ReplyToEmailOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ReplyToEmailOptions Class Doc Comment
*
* @category Class
* @description Options for replying to email with API
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ReplyToEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ReplyToEmailOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'body' => 'string',
'is_html' => 'bool',
'from' => 'string',
'reply_to' => 'string',
'custom_headers' => 'array<string,string>',
'charset' => 'string',
'attachments' => 'string[]',
'template_variables' => 'array<string,object>',
'template' => 'string',
'send_strategy' => 'string',
'use_inbox_name' => 'bool',
'html' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'body' => null,
'is_html' => null,
'from' => null,
'reply_to' => null,
'custom_headers' => null,
'charset' => null,
'attachments' => null,
'template_variables' => null,
'template' => 'uuid',
'send_strategy' => null,
'use_inbox_name' => null,
'html' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'body' => false,
'is_html' => false,
'from' => true,
'reply_to' => true,
'custom_headers' => true,
'charset' => true,
'attachments' => true,
'template_variables' => true,
'template' => true,
'send_strategy' => true,
'use_inbox_name' => true,
'html' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'body' => 'body',
'is_html' => 'isHTML',
'from' => 'from',
'reply_to' => 'replyTo',
'custom_headers' => 'customHeaders',
'charset' => 'charset',
'attachments' => 'attachments',
'template_variables' => 'templateVariables',
'template' => 'template',
'send_strategy' => 'sendStrategy',
'use_inbox_name' => 'useInboxName',
'html' => 'html'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'body' => 'setBody',
'is_html' => 'setIsHtml',
'from' => 'setFrom',
'reply_to' => 'setReplyTo',
'custom_headers' => 'setCustomHeaders',
'charset' => 'setCharset',
'attachments' => 'setAttachments',
'template_variables' => 'setTemplateVariables',
'template' => 'setTemplate',
'send_strategy' => 'setSendStrategy',
'use_inbox_name' => 'setUseInboxName',
'html' => 'setHtml'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'body' => 'getBody',
'is_html' => 'getIsHtml',
'from' => 'getFrom',
'reply_to' => 'getReplyTo',
'custom_headers' => 'getCustomHeaders',
'charset' => 'getCharset',
'attachments' => 'getAttachments',
'template_variables' => 'getTemplateVariables',
'template' => 'getTemplate',
'send_strategy' => 'getSendStrategy',
'use_inbox_name' => 'getUseInboxName',
'html' => 'getHtml'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SEND_STRATEGY_SINGLE_MESSAGE = 'SINGLE_MESSAGE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSendStrategyAllowableValues()
{
return [
self::SEND_STRATEGY_SINGLE_MESSAGE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('reply_to', $data ?? [], null);
$this->setIfExists('custom_headers', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
$this->setIfExists('template_variables', $data ?? [], null);
$this->setIfExists('template', $data ?? [], null);
$this->setIfExists('send_strategy', $data ?? [], null);
$this->setIfExists('use_inbox_name', $data ?? [], null);
$this->setIfExists('html', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['is_html'] === null) {
$invalidProperties[] = "'is_html' can't be null";
}
$allowedValues = $this->getSendStrategyAllowableValues();
if (!is_null($this->container['send_strategy']) && !in_array($this->container['send_strategy'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'send_strategy', must be one of '%s'",
$this->container['send_strategy'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body Body of the reply email you want to send
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets is_html
*
* @return bool
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool $is_html Is the reply HTML
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
throw new \InvalidArgumentException('non-nullable is_html cannot be null');
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from The from header that should be used. Optional
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets reply_to
*
* @return string|null
*/
public function getReplyTo()
{
return $this->container['reply_to'];
}
/**
* Sets reply_to
*
* @param string|null $reply_to The replyTo header that should be used. Optional
*
* @return self
*/
public function setReplyTo($reply_to)
{
if (is_null($reply_to)) {
array_push($this->openAPINullablesSetToNull, 'reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reply_to'] = $reply_to;
return $this;
}
/**
* Gets custom_headers
*
* @return array<string,string>|null
*/
public function getCustomHeaders()
{
return $this->container['custom_headers'];
}
/**
* Sets custom_headers
*
* @param array<string,string>|null $custom_headers Optional custom headers
*
* @return self
*/
public function setCustomHeaders($custom_headers)
{
if (is_null($custom_headers)) {
array_push($this->openAPINullablesSetToNull, 'custom_headers');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('custom_headers', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['custom_headers'] = $custom_headers;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset The charset that your message should be sent with. Optional. Default is UTF-8
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets attachments
*
* @return string[]|null
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[]|null $attachments List of uploaded attachments to send with the reply. Optional.
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
array_push($this->openAPINullablesSetToNull, 'attachments');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachments', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Gets template_variables
*
* @return array<string,object>|null
*/
public function getTemplateVariables()
{
return $this->container['template_variables'];
}
/**
* Sets template_variables
*
* @param array<string,object>|null $template_variables Template variables if using a template
*
* @return self
*/
public function setTemplateVariables($template_variables)
{
if (is_null($template_variables)) {
array_push($this->openAPINullablesSetToNull, 'template_variables');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_variables', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_variables'] = $template_variables;
return $this;
}
/**
* Gets template
*
* @return string|null
*/
public function getTemplate()
{
return $this->container['template'];
}
/**
* Sets template
*
* @param string|null $template Template ID to use instead of body. Will use template variable map to fill defined variable slots.
*
* @return self
*/
public function setTemplate($template)
{
if (is_null($template)) {
array_push($this->openAPINullablesSetToNull, 'template');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template'] = $template;
return $this;
}
/**
* Gets send_strategy
*
* @return string|null
*/
public function getSendStrategy()
{
return $this->container['send_strategy'];
}
/**
* Sets send_strategy
*
* @param string|null $send_strategy How an email should be sent based on its recipients
*
* @return self
*/
public function setSendStrategy($send_strategy)
{
$allowedValues = $this->getSendStrategyAllowableValues();
if (!is_null($send_strategy) && !in_array($send_strategy, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'send_strategy', must be one of '%s'",
$send_strategy,
implode("', '", $allowedValues)
)
);
}
if (is_null($send_strategy)) {
array_push($this->openAPINullablesSetToNull, 'send_strategy');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('send_strategy', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['send_strategy'] = $send_strategy;
return $this;
}
/**
* Gets use_inbox_name
*
* @return bool|null
*/
public function getUseInboxName()
{
return $this->container['use_inbox_name'];
}
/**
* Sets use_inbox_name
*
* @param bool|null $use_inbox_name Optionally use inbox name as display name for sender email address
*
* @return self
*/
public function setUseInboxName($use_inbox_name)
{
if (is_null($use_inbox_name)) {
array_push($this->openAPINullablesSetToNull, 'use_inbox_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_inbox_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_inbox_name'] = $use_inbox_name;
return $this;
}
/**
* Gets html
*
* @return bool|null
*/
public function getHtml()
{
return $this->container['html'];
}
/**
* Sets html
*
* @param bool|null $html html
*
* @return self
*/
public function setHtml($html)
{
if (is_null($html)) {
throw new \InvalidArgumentException('non-nullable html cannot be null');
}
$this->container['html'] = $html;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ReplyToAliasEmailOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ReplyToAliasEmailOptions Class Doc Comment
*
* @category Class
* @description Options for replying to an alias email using the alias inbox
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ReplyToAliasEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ReplyToAliasEmailOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'body' => 'string',
'is_html' => 'bool',
'charset' => 'string',
'attachments' => 'string[]',
'template_variables' => 'array<string,object>',
'template' => 'string',
'send_strategy' => 'string',
'custom_headers' => 'array<string,string>',
'use_inbox_name' => 'bool',
'html' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'body' => null,
'is_html' => null,
'charset' => null,
'attachments' => null,
'template_variables' => null,
'template' => 'uuid',
'send_strategy' => null,
'custom_headers' => null,
'use_inbox_name' => null,
'html' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'body' => false,
'is_html' => false,
'charset' => true,
'attachments' => true,
'template_variables' => true,
'template' => true,
'send_strategy' => true,
'custom_headers' => true,
'use_inbox_name' => true,
'html' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'body' => 'body',
'is_html' => 'isHTML',
'charset' => 'charset',
'attachments' => 'attachments',
'template_variables' => 'templateVariables',
'template' => 'template',
'send_strategy' => 'sendStrategy',
'custom_headers' => 'customHeaders',
'use_inbox_name' => 'useInboxName',
'html' => 'html'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'body' => 'setBody',
'is_html' => 'setIsHtml',
'charset' => 'setCharset',
'attachments' => 'setAttachments',
'template_variables' => 'setTemplateVariables',
'template' => 'setTemplate',
'send_strategy' => 'setSendStrategy',
'custom_headers' => 'setCustomHeaders',
'use_inbox_name' => 'setUseInboxName',
'html' => 'setHtml'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'body' => 'getBody',
'is_html' => 'getIsHtml',
'charset' => 'getCharset',
'attachments' => 'getAttachments',
'template_variables' => 'getTemplateVariables',
'template' => 'getTemplate',
'send_strategy' => 'getSendStrategy',
'custom_headers' => 'getCustomHeaders',
'use_inbox_name' => 'getUseInboxName',
'html' => 'getHtml'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SEND_STRATEGY_SINGLE_MESSAGE = 'SINGLE_MESSAGE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSendStrategyAllowableValues()
{
return [
self::SEND_STRATEGY_SINGLE_MESSAGE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
$this->setIfExists('template_variables', $data ?? [], null);
$this->setIfExists('template', $data ?? [], null);
$this->setIfExists('send_strategy', $data ?? [], null);
$this->setIfExists('custom_headers', $data ?? [], null);
$this->setIfExists('use_inbox_name', $data ?? [], null);
$this->setIfExists('html', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['is_html'] === null) {
$invalidProperties[] = "'is_html' can't be null";
}
$allowedValues = $this->getSendStrategyAllowableValues();
if (!is_null($this->container['send_strategy']) && !in_array($this->container['send_strategy'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'send_strategy', must be one of '%s'",
$this->container['send_strategy'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body Body of the reply email you want to send
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets is_html
*
* @return bool
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool $is_html Is the reply HTML
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
throw new \InvalidArgumentException('non-nullable is_html cannot be null');
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset The charset that your message should be sent with. Optional. Default is UTF-8
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets attachments
*
* @return string[]|null
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[]|null $attachments List of uploaded attachments to send with the reply. Optional.
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
array_push($this->openAPINullablesSetToNull, 'attachments');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachments', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Gets template_variables
*
* @return array<string,object>|null
*/
public function getTemplateVariables()
{
return $this->container['template_variables'];
}
/**
* Sets template_variables
*
* @param array<string,object>|null $template_variables Template variables if using a template
*
* @return self
*/
public function setTemplateVariables($template_variables)
{
if (is_null($template_variables)) {
array_push($this->openAPINullablesSetToNull, 'template_variables');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_variables', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_variables'] = $template_variables;
return $this;
}
/**
* Gets template
*
* @return string|null
*/
public function getTemplate()
{
return $this->container['template'];
}
/**
* Sets template
*
* @param string|null $template Template ID to use instead of body. Will use template variable map to fill defined variable slots.
*
* @return self
*/
public function setTemplate($template)
{
if (is_null($template)) {
array_push($this->openAPINullablesSetToNull, 'template');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template'] = $template;
return $this;
}
/**
* Gets send_strategy
*
* @return string|null
*/
public function getSendStrategy()
{
return $this->container['send_strategy'];
}
/**
* Sets send_strategy
*
* @param string|null $send_strategy How an email should be sent based on its recipients
*
* @return self
*/
public function setSendStrategy($send_strategy)
{
$allowedValues = $this->getSendStrategyAllowableValues();
if (!is_null($send_strategy) && !in_array($send_strategy, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'send_strategy', must be one of '%s'",
$send_strategy,
implode("', '", $allowedValues)
)
);
}
if (is_null($send_strategy)) {
array_push($this->openAPINullablesSetToNull, 'send_strategy');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('send_strategy', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['send_strategy'] = $send_strategy;
return $this;
}
/**
* Gets custom_headers
*
* @return array<string,string>|null
*/
public function getCustomHeaders()
{
return $this->container['custom_headers'];
}
/**
* Sets custom_headers
*
* @param array<string,string>|null $custom_headers Optional custom headers
*
* @return self
*/
public function setCustomHeaders($custom_headers)
{
if (is_null($custom_headers)) {
array_push($this->openAPINullablesSetToNull, 'custom_headers');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('custom_headers', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['custom_headers'] = $custom_headers;
return $this;
}
/**
* Gets use_inbox_name
*
* @return bool|null
*/
public function getUseInboxName()
{
return $this->container['use_inbox_name'];
}
/**
* Sets use_inbox_name
*
* @param bool|null $use_inbox_name Optionally use inbox name as display name for sender email address
*
* @return self
*/
public function setUseInboxName($use_inbox_name)
{
if (is_null($use_inbox_name)) {
array_push($this->openAPINullablesSetToNull, 'use_inbox_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_inbox_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_inbox_name'] = $use_inbox_name;
return $this;
}
/**
* Gets html
*
* @return bool|null
*/
public function getHtml()
{
return $this->container['html'];
}
/**
* Sets html
*
* @param bool|null $html html
*
* @return self
*/
public function setHtml($html)
{
if (is_null($html)) {
throw new \InvalidArgumentException('non-nullable html cannot be null');
}
$this->container['html'] = $html;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ReplyForSms
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ReplyForSms Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ReplyForSms implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ReplyForSms';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'reply' => '\MailSlurp\Models\SentSmsDto'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'reply' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'reply' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'reply' => 'reply'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'reply' => 'setReply'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'reply' => 'getReply'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('reply', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets reply
*
* @return \MailSlurp\Models\SentSmsDto|null
*/
public function getReply()
{
return $this->container['reply'];
}
/**
* Sets reply
*
* @param \MailSlurp\Models\SentSmsDto|null $reply reply
*
* @return self
*/
public function setReply($reply)
{
if (is_null($reply)) {
throw new \InvalidArgumentException('non-nullable reply cannot be null');
}
$this->container['reply'] = $reply;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* Recipient
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* Recipient Class Doc Comment
*
* @category Class
* @description Email recipient
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class Recipient implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'Recipient';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'raw_value' => 'string',
'email_address' => 'string',
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'raw_value' => null,
'email_address' => null,
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'raw_value' => false,
'email_address' => false,
'name' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'raw_value' => 'rawValue',
'email_address' => 'emailAddress',
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'raw_value' => 'setRawValue',
'email_address' => 'setEmailAddress',
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'raw_value' => 'getRawValue',
'email_address' => 'getEmailAddress',
'name' => 'getName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('raw_value', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['raw_value'] === null) {
$invalidProperties[] = "'raw_value' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets raw_value
*
* @return string
*/
public function getRawValue()
{
return $this->container['raw_value'];
}
/**
* Sets raw_value
*
* @param string $raw_value raw_value
*
* @return self
*/
public function setRawValue($raw_value)
{
if (is_null($raw_value)) {
throw new \InvalidArgumentException('non-nullable raw_value cannot be null');
}
$this->container['raw_value'] = $raw_value;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* RawEmailJson
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* RawEmailJson Class Doc Comment
*
* @category Class
* @description Content in raw format
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class RawEmailJson implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'RawEmailJson';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['content'] === null) {
$invalidProperties[] = "'content' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return string
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param string $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PhonePlanDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PhonePlanDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PhonePlanDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PhonePlanDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'phone_country' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'phone_country' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'phone_country' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'phone_country' => 'phoneCountry',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'phone_country' => 'setPhoneCountry',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'phone_country' => 'getPhoneCountry',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const PHONE_COUNTRY_US = 'US';
public const PHONE_COUNTRY_GB = 'GB';
public const PHONE_COUNTRY_AU = 'AU';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getPhoneCountryAllowableValues()
{
return [
self::PHONE_COUNTRY_US,
self::PHONE_COUNTRY_GB,
self::PHONE_COUNTRY_AU,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('phone_country', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['phone_country'] === null) {
$invalidProperties[] = "'phone_country' can't be null";
}
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'phone_country', must be one of '%s'",
$this->container['phone_country'],
implode("', '", $allowedValues)
);
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets phone_country
*
* @return string
*/
public function getPhoneCountry()
{
return $this->container['phone_country'];
}
/**
* Sets phone_country
*
* @param string $phone_country phone_country
*
* @return self
*/
public function setPhoneCountry($phone_country)
{
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!in_array($phone_country, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'phone_country', must be one of '%s'",
$phone_country,
implode("', '", $allowedValues)
)
);
}
if (is_null($phone_country)) {
throw new \InvalidArgumentException('non-nullable phone_country cannot be null');
}
$this->container['phone_country'] = $phone_country;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PhoneNumberProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PhoneNumberProjection Class Doc Comment
*
* @category Class
* @description Phone number projection
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PhoneNumberProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PhoneNumberProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'user_id' => 'string',
'phone_number' => 'string',
'phone_country' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'user_id' => 'uuid',
'phone_number' => null,
'phone_country' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'user_id' => false,
'phone_number' => false,
'phone_country' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'user_id' => 'userId',
'phone_number' => 'phoneNumber',
'phone_country' => 'phoneCountry',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'user_id' => 'setUserId',
'phone_number' => 'setPhoneNumber',
'phone_country' => 'setPhoneCountry',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'user_id' => 'getUserId',
'phone_number' => 'getPhoneNumber',
'phone_country' => 'getPhoneCountry',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const PHONE_COUNTRY_US = 'US';
public const PHONE_COUNTRY_GB = 'GB';
public const PHONE_COUNTRY_AU = 'AU';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getPhoneCountryAllowableValues()
{
return [
self::PHONE_COUNTRY_US,
self::PHONE_COUNTRY_GB,
self::PHONE_COUNTRY_AU,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('phone_number', $data ?? [], null);
$this->setIfExists('phone_country', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['phone_number'] === null) {
$invalidProperties[] = "'phone_number' can't be null";
}
if ($this->container['phone_country'] === null) {
$invalidProperties[] = "'phone_country' can't be null";
}
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'phone_country', must be one of '%s'",
$this->container['phone_country'],
implode("', '", $allowedValues)
);
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets phone_number
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number
*
* @param string $phone_number phone_number
*
* @return self
*/
public function setPhoneNumber($phone_number)
{
if (is_null($phone_number)) {
throw new \InvalidArgumentException('non-nullable phone_number cannot be null');
}
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Gets phone_country
*
* @return string
*/
public function getPhoneCountry()
{
return $this->container['phone_country'];
}
/**
* Sets phone_country
*
* @param string $phone_country phone_country
*
* @return self
*/
public function setPhoneCountry($phone_country)
{
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!in_array($phone_country, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'phone_country', must be one of '%s'",
$phone_country,
implode("', '", $allowedValues)
)
);
}
if (is_null($phone_country)) {
throw new \InvalidArgumentException('non-nullable phone_country cannot be null');
}
$this->container['phone_country'] = $phone_country;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PhoneNumberDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PhoneNumberDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PhoneNumberDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PhoneNumberDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'compliance_address' => 'string',
'emergency_address' => 'string',
'phone_number' => 'string',
'phone_country' => 'string',
'phone_plan' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'compliance_address' => 'uuid',
'emergency_address' => 'uuid',
'phone_number' => null,
'phone_country' => null,
'phone_plan' => 'uuid',
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'compliance_address' => false,
'emergency_address' => false,
'phone_number' => false,
'phone_country' => false,
'phone_plan' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'compliance_address' => 'complianceAddress',
'emergency_address' => 'emergencyAddress',
'phone_number' => 'phoneNumber',
'phone_country' => 'phoneCountry',
'phone_plan' => 'phonePlan',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'compliance_address' => 'setComplianceAddress',
'emergency_address' => 'setEmergencyAddress',
'phone_number' => 'setPhoneNumber',
'phone_country' => 'setPhoneCountry',
'phone_plan' => 'setPhonePlan',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'compliance_address' => 'getComplianceAddress',
'emergency_address' => 'getEmergencyAddress',
'phone_number' => 'getPhoneNumber',
'phone_country' => 'getPhoneCountry',
'phone_plan' => 'getPhonePlan',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const PHONE_COUNTRY_US = 'US';
public const PHONE_COUNTRY_GB = 'GB';
public const PHONE_COUNTRY_AU = 'AU';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getPhoneCountryAllowableValues()
{
return [
self::PHONE_COUNTRY_US,
self::PHONE_COUNTRY_GB,
self::PHONE_COUNTRY_AU,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('compliance_address', $data ?? [], null);
$this->setIfExists('emergency_address', $data ?? [], null);
$this->setIfExists('phone_number', $data ?? [], null);
$this->setIfExists('phone_country', $data ?? [], null);
$this->setIfExists('phone_plan', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['phone_number'] === null) {
$invalidProperties[] = "'phone_number' can't be null";
}
if ($this->container['phone_country'] === null) {
$invalidProperties[] = "'phone_country' can't be null";
}
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'phone_country', must be one of '%s'",
$this->container['phone_country'],
implode("', '", $allowedValues)
);
}
if ($this->container['phone_plan'] === null) {
$invalidProperties[] = "'phone_plan' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets compliance_address
*
* @return string|null
*/
public function getComplianceAddress()
{
return $this->container['compliance_address'];
}
/**
* Sets compliance_address
*
* @param string|null $compliance_address compliance_address
*
* @return self
*/
public function setComplianceAddress($compliance_address)
{
if (is_null($compliance_address)) {
throw new \InvalidArgumentException('non-nullable compliance_address cannot be null');
}
$this->container['compliance_address'] = $compliance_address;
return $this;
}
/**
* Gets emergency_address
*
* @return string|null
*/
public function getEmergencyAddress()
{
return $this->container['emergency_address'];
}
/**
* Sets emergency_address
*
* @param string|null $emergency_address emergency_address
*
* @return self
*/
public function setEmergencyAddress($emergency_address)
{
if (is_null($emergency_address)) {
throw new \InvalidArgumentException('non-nullable emergency_address cannot be null');
}
$this->container['emergency_address'] = $emergency_address;
return $this;
}
/**
* Gets phone_number
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number
*
* @param string $phone_number phone_number
*
* @return self
*/
public function setPhoneNumber($phone_number)
{
if (is_null($phone_number)) {
throw new \InvalidArgumentException('non-nullable phone_number cannot be null');
}
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Gets phone_country
*
* @return string
*/
public function getPhoneCountry()
{
return $this->container['phone_country'];
}
/**
* Sets phone_country
*
* @param string $phone_country phone_country
*
* @return self
*/
public function setPhoneCountry($phone_country)
{
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!in_array($phone_country, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'phone_country', must be one of '%s'",
$phone_country,
implode("', '", $allowedValues)
)
);
}
if (is_null($phone_country)) {
throw new \InvalidArgumentException('non-nullable phone_country cannot be null');
}
$this->container['phone_country'] = $phone_country;
return $this;
}
/**
* Gets phone_plan
*
* @return string
*/
public function getPhonePlan()
{
return $this->container['phone_plan'];
}
/**
* Sets phone_plan
*
* @param string $phone_plan phone_plan
*
* @return self
*/
public function setPhonePlan($phone_plan)
{
if (is_null($phone_plan)) {
throw new \InvalidArgumentException('non-nullable phone_plan cannot be null');
}
$this->container['phone_plan'] = $phone_plan;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageableObject
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageableObject Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageableObject implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageableObject';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'page_number' => 'int',
'page_size' => 'int',
'unpaged' => 'bool',
'paged' => 'bool',
'offset' => 'int',
'sort' => '\MailSlurp\Models\SortObject'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'page_number' => 'int32',
'page_size' => 'int32',
'unpaged' => null,
'paged' => null,
'offset' => 'int64',
'sort' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'page_number' => false,
'page_size' => false,
'unpaged' => false,
'paged' => false,
'offset' => false,
'sort' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'page_number' => 'pageNumber',
'page_size' => 'pageSize',
'unpaged' => 'unpaged',
'paged' => 'paged',
'offset' => 'offset',
'sort' => 'sort'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'page_number' => 'setPageNumber',
'page_size' => 'setPageSize',
'unpaged' => 'setUnpaged',
'paged' => 'setPaged',
'offset' => 'setOffset',
'sort' => 'setSort'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'page_number' => 'getPageNumber',
'page_size' => 'getPageSize',
'unpaged' => 'getUnpaged',
'paged' => 'getPaged',
'offset' => 'getOffset',
'sort' => 'getSort'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('page_number', $data ?? [], null);
$this->setIfExists('page_size', $data ?? [], null);
$this->setIfExists('unpaged', $data ?? [], null);
$this->setIfExists('paged', $data ?? [], null);
$this->setIfExists('offset', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets page_number
*
* @return int|null
*/
public function getPageNumber()
{
return $this->container['page_number'];
}
/**
* Sets page_number
*
* @param int|null $page_number page_number
*
* @return self
*/
public function setPageNumber($page_number)
{
if (is_null($page_number)) {
throw new \InvalidArgumentException('non-nullable page_number cannot be null');
}
$this->container['page_number'] = $page_number;
return $this;
}
/**
* Gets page_size
*
* @return int|null
*/
public function getPageSize()
{
return $this->container['page_size'];
}
/**
* Sets page_size
*
* @param int|null $page_size page_size
*
* @return self
*/
public function setPageSize($page_size)
{
if (is_null($page_size)) {
throw new \InvalidArgumentException('non-nullable page_size cannot be null');
}
$this->container['page_size'] = $page_size;
return $this;
}
/**
* Gets unpaged
*
* @return bool|null
*/
public function getUnpaged()
{
return $this->container['unpaged'];
}
/**
* Sets unpaged
*
* @param bool|null $unpaged unpaged
*
* @return self
*/
public function setUnpaged($unpaged)
{
if (is_null($unpaged)) {
throw new \InvalidArgumentException('non-nullable unpaged cannot be null');
}
$this->container['unpaged'] = $unpaged;
return $this;
}
/**
* Gets paged
*
* @return bool|null
*/
public function getPaged()
{
return $this->container['paged'];
}
/**
* Sets paged
*
* @param bool|null $paged paged
*
* @return self
*/
public function setPaged($paged)
{
if (is_null($paged)) {
throw new \InvalidArgumentException('non-nullable paged cannot be null');
}
$this->container['paged'] = $paged;
return $this;
}
/**
* Gets offset
*
* @return int|null
*/
public function getOffset()
{
return $this->container['offset'];
}
/**
* Sets offset
*
* @param int|null $offset offset
*
* @return self
*/
public function setOffset($offset)
{
if (is_null($offset)) {
throw new \InvalidArgumentException('non-nullable offset cannot be null');
}
$this->container['offset'] = $offset;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageWebhookResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageWebhookResult Class Doc Comment
*
* @category Class
* @description Paginated webhook results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageWebhookResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageWebhookResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\WebhookResultDto[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\WebhookResultDto[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\WebhookResultDto[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageWebhookProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageWebhookProjection Class Doc Comment
*
* @category Class
* @description Paginated webhook entity. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageWebhookProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageWebhookProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\WebhookProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\WebhookProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\WebhookProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageUnknownMissedEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageUnknownMissedEmailProjection Class Doc Comment
*
* @category Class
* @description Paginated unknown MissedEmail results. Unknown missed emails are emails that were sent to MailSlurp /Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageUnknownMissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageUnknownMissedEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\UnknownMissedEmailProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\UnknownMissedEmailProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\UnknownMissedEmailProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageTrackingPixelProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageTrackingPixelProjection Class Doc Comment
*
* @category Class
* @description Paginated TrackingPixel results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageTrackingPixelProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageTrackingPixelProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\TrackingPixelProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\TrackingPixelProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\TrackingPixelProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageThreadProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageThreadProjection Class Doc Comment
*
* @category Class
* @description Paginated email projection results. EmailProjections and EmailPreviews are essentially the same but have legacy naming issues. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full email entity use the projection ID with individual method calls. For emails there are several methods for fetching message bodies and attachments.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageThreadProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageThreadProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\ThreadProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\ThreadProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\ThreadProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageTemplateProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageTemplateProjection Class Doc Comment
*
* @category Class
* @description Paginated email template results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageTemplateProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageTemplateProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\TemplateProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\TemplateProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\TemplateProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageSmsProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageSmsProjection Class Doc Comment
*
* @category Class
* @description Paginated SMS messages. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageSmsProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageSmsProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\SmsProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\SmsProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\SmsProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageSentEmailWithQueueProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageSentEmailWithQueueProjection Class Doc Comment
*
* @category Class
* @description Paginated sent email results for emails sent with queue. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full sent email entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageSentEmailWithQueueProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageSentEmailWithQueueProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\SendWithQueueResult[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\SendWithQueueResult[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\SendWithQueueResult[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageSentEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageSentEmailProjection Class Doc Comment
*
* @category Class
* @description Paginated sent email results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full sent email entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageSentEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageSentEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\SentEmailProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\SentEmailProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\SentEmailProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageScheduledJobs
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageScheduledJobs Class Doc Comment
*
* @category Class
* @description Paginated scheduled jobs results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageScheduledJobs implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageScheduledJobs';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\ScheduledJob[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\ScheduledJob[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\ScheduledJob[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PagePhoneNumberProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PagePhoneNumberProjection Class Doc Comment
*
* @category Class
* @description Paginated phone numbers. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PagePhoneNumberProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PagePhoneNumberProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\PhoneNumberProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\PhoneNumberProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\PhoneNumberProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageOrganizationInboxProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageOrganizationInboxProjection Class Doc Comment
*
* @category Class
* @description Paginated organization inbox results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageOrganizationInboxProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageOrganizationInboxProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\OrganizationInboxProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\OrganizationInboxProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\OrganizationInboxProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageMissedEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageMissedEmailProjection Class Doc Comment
*
* @category Class
* @description Paginated MissedEmail results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageMissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageMissedEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\MissedEmailProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\MissedEmailProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\MissedEmailProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageListUnsubscribeRecipients
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageListUnsubscribeRecipients Class Doc Comment
*
* @category Class
* @description Paginated list unsubscribe recipients. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageListUnsubscribeRecipients implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageListUnsubscribeRecipients';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\ListUnsubscribeRecipientProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\ListUnsubscribeRecipientProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\ListUnsubscribeRecipientProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageInboxRulesetDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageInboxRulesetDto Class Doc Comment
*
* @category Class
* @description Paginated inbox ruleset results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageInboxRulesetDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageInboxRulesetDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\InboxRulesetDto[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\InboxRulesetDto[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\InboxRulesetDto[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageInboxReplierEvents
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageInboxReplierEvents Class Doc Comment
*
* @category Class
* @description Paginated inbox replier events. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageInboxReplierEvents implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageInboxReplierEvents';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\InboxReplierEventProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\InboxReplierEventProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\InboxReplierEventProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageInboxReplierDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageInboxReplierDto Class Doc Comment
*
* @category Class
* @description Paginated inbox replier results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageInboxReplierDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageInboxReplierDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\InboxReplierDto[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\InboxReplierDto[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\InboxReplierDto[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageInboxProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageInboxProjection Class Doc Comment
*
* @category Class
* @description Paginated inbox results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageInboxProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageInboxProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\InboxPreview[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\InboxPreview[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\InboxPreview[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageInboxForwarderEvents
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageInboxForwarderEvents Class Doc Comment
*
* @category Class
* @description Paginated inbox forwarder events. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageInboxForwarderEvents implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageInboxForwarderEvents';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\InboxForwarderEventProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\InboxForwarderEventProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\InboxForwarderEventProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageInboxForwarderDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageInboxForwarderDto Class Doc Comment
*
* @category Class
* @description Paginated inbox forwarder results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageInboxForwarderDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageInboxForwarderDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\InboxForwarderDto[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\InboxForwarderDto[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\InboxForwarderDto[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageGroupProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageGroupProjection Class Doc Comment
*
* @category Class
* @description Paginated missed email results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageGroupProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageGroupProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\GroupProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\GroupProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\GroupProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageExpiredInboxRecordProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageExpiredInboxRecordProjection Class Doc Comment
*
* @category Class
* @description Paginated expired inbox results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageExpiredInboxRecordProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageExpiredInboxRecordProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\ExpiredInboxRecordProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\ExpiredInboxRecordProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\ExpiredInboxRecordProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageEmailValidationRequest
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageEmailValidationRequest Class Doc Comment
*
* @category Class
* @description Paginated email validation request records. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageEmailValidationRequest implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageEmailValidationRequest';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\EmailValidationRequestDto[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\EmailValidationRequestDto[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\EmailValidationRequestDto[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageEmailProjection Class Doc Comment
*
* @category Class
* @description Paginated email projection results. EmailProjections and EmailPreviews are essentially the same but have legacy naming issues. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full email entity use the projection ID with individual method calls. For emails there are several methods for fetching message bodies and attachments.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\EmailProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\EmailProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\EmailProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageEmailPreview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageEmailPreview Class Doc Comment
*
* @category Class
* @description Paginated email preview results. EmailProjections and EmailPreviews are essentially the same but have legacy naming issues. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls. For emails there are several methods for fetching message bodies and attachments.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageEmailPreview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageEmailPreview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\EmailPreview[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\EmailPreview[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\EmailPreview[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageDeliveryStatus
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageDeliveryStatus Class Doc Comment
*
* @category Class
* @description Paginated delivery status results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageDeliveryStatus implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageDeliveryStatus';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\DeliveryStatusDto[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\DeliveryStatusDto[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\DeliveryStatusDto[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageContactProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageContactProjection Class Doc Comment
*
* @category Class
* @description Paginated contact results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageContactProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageContactProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\ContactProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\ContactProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\ContactProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageConnectorSyncEvents
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageConnectorSyncEvents Class Doc Comment
*
* @category Class
* @description Paginated inbox connector sync events. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageConnectorSyncEvents implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageConnectorSyncEvents';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\ConnectorSyncEventProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\ConnectorSyncEventProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\ConnectorSyncEventProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageConnector
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageConnector Class Doc Comment
*
* @category Class
* @description Paginated inbox connectors. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageConnector implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageConnector';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\ConnectorProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\ConnectorProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\ConnectorProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageComplaint
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageComplaint Class Doc Comment
*
* @category Class
* @description Paginated complaint email. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageComplaint implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageComplaint';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\Complaint[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\Complaint[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\Complaint[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageBouncedRecipients
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageBouncedRecipients Class Doc Comment
*
* @category Class
* @description Paginated bounced recipients. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageBouncedRecipients implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageBouncedRecipients';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\BounceRecipientProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\BounceRecipientProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\BounceRecipientProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageBouncedEmail
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageBouncedEmail Class Doc Comment
*
* @category Class
* @description Paginated bounced email. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageBouncedEmail implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageBouncedEmail';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\BounceProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\BounceProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\BounceProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageAttachmentEntity
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageAttachmentEntity Class Doc Comment
*
* @category Class
* @description Paginated attachment entity results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageAttachmentEntity implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageAttachmentEntity';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\AttachmentProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\AttachmentProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\AttachmentProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* PageAlias
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* PageAlias Class Doc Comment
*
* @category Class
* @description Paginated email alias results. Page index starts at zero. Projection results may omit larger entity fields. For fetching a full entity use the projection ID with individual method calls.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class PageAlias implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PageAlias';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => '\MailSlurp\Models\AliasProjection[]',
'pageable' => '\MailSlurp\Models\PageableObject',
'total_pages' => 'int',
'total_elements' => 'int',
'last' => 'bool',
'number_of_elements' => 'int',
'first' => 'bool',
'size' => 'int',
'number' => 'int',
'sort' => '\MailSlurp\Models\SortObject',
'empty' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'pageable' => null,
'total_pages' => 'int32',
'total_elements' => 'int64',
'last' => null,
'number_of_elements' => 'int32',
'first' => null,
'size' => 'int32',
'number' => 'int32',
'sort' => null,
'empty' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'pageable' => false,
'total_pages' => false,
'total_elements' => false,
'last' => false,
'number_of_elements' => false,
'first' => false,
'size' => false,
'number' => false,
'sort' => false,
'empty' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'pageable' => 'pageable',
'total_pages' => 'totalPages',
'total_elements' => 'totalElements',
'last' => 'last',
'number_of_elements' => 'numberOfElements',
'first' => 'first',
'size' => 'size',
'number' => 'number',
'sort' => 'sort',
'empty' => 'empty'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'pageable' => 'setPageable',
'total_pages' => 'setTotalPages',
'total_elements' => 'setTotalElements',
'last' => 'setLast',
'number_of_elements' => 'setNumberOfElements',
'first' => 'setFirst',
'size' => 'setSize',
'number' => 'setNumber',
'sort' => 'setSort',
'empty' => 'setEmpty'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'pageable' => 'getPageable',
'total_pages' => 'getTotalPages',
'total_elements' => 'getTotalElements',
'last' => 'getLast',
'number_of_elements' => 'getNumberOfElements',
'first' => 'getFirst',
'size' => 'getSize',
'number' => 'getNumber',
'sort' => 'getSort',
'empty' => 'getEmpty'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('pageable', $data ?? [], null);
$this->setIfExists('total_pages', $data ?? [], null);
$this->setIfExists('total_elements', $data ?? [], null);
$this->setIfExists('last', $data ?? [], null);
$this->setIfExists('number_of_elements', $data ?? [], null);
$this->setIfExists('first', $data ?? [], null);
$this->setIfExists('size', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('sort', $data ?? [], null);
$this->setIfExists('empty', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_pages'] === null) {
$invalidProperties[] = "'total_pages' can't be null";
}
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return \MailSlurp\Models\AliasProjection[]|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param \MailSlurp\Models\AliasProjection[]|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets pageable
*
* @return \MailSlurp\Models\PageableObject|null
*/
public function getPageable()
{
return $this->container['pageable'];
}
/**
* Sets pageable
*
* @param \MailSlurp\Models\PageableObject|null $pageable pageable
*
* @return self
*/
public function setPageable($pageable)
{
if (is_null($pageable)) {
throw new \InvalidArgumentException('non-nullable pageable cannot be null');
}
$this->container['pageable'] = $pageable;
return $this;
}
/**
* Gets total_pages
*
* @return int
*/
public function getTotalPages()
{
return $this->container['total_pages'];
}
/**
* Sets total_pages
*
* @param int $total_pages total_pages
*
* @return self
*/
public function setTotalPages($total_pages)
{
if (is_null($total_pages)) {
throw new \InvalidArgumentException('non-nullable total_pages cannot be null');
}
$this->container['total_pages'] = $total_pages;
return $this;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Gets last
*
* @return bool|null
*/
public function getLast()
{
return $this->container['last'];
}
/**
* Sets last
*
* @param bool|null $last last
*
* @return self
*/
public function setLast($last)
{
if (is_null($last)) {
throw new \InvalidArgumentException('non-nullable last cannot be null');
}
$this->container['last'] = $last;
return $this;
}
/**
* Gets number_of_elements
*
* @return int|null
*/
public function getNumberOfElements()
{
return $this->container['number_of_elements'];
}
/**
* Sets number_of_elements
*
* @param int|null $number_of_elements number_of_elements
*
* @return self
*/
public function setNumberOfElements($number_of_elements)
{
if (is_null($number_of_elements)) {
throw new \InvalidArgumentException('non-nullable number_of_elements cannot be null');
}
$this->container['number_of_elements'] = $number_of_elements;
return $this;
}
/**
* Gets first
*
* @return bool|null
*/
public function getFirst()
{
return $this->container['first'];
}
/**
* Sets first
*
* @param bool|null $first first
*
* @return self
*/
public function setFirst($first)
{
if (is_null($first)) {
throw new \InvalidArgumentException('non-nullable first cannot be null');
}
$this->container['first'] = $first;
return $this;
}
/**
* Gets size
*
* @return int|null
*/
public function getSize()
{
return $this->container['size'];
}
/**
* Sets size
*
* @param int|null $size size
*
* @return self
*/
public function setSize($size)
{
if (is_null($size)) {
throw new \InvalidArgumentException('non-nullable size cannot be null');
}
$this->container['size'] = $size;
return $this;
}
/**
* Gets number
*
* @return int|null
*/
public function getNumber()
{
return $this->container['number'];
}
/**
* Sets number
*
* @param int|null $number number
*
* @return self
*/
public function setNumber($number)
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
}
/**
* Gets sort
*
* @return \MailSlurp\Models\SortObject|null
*/
public function getSort()
{
return $this->container['sort'];
}
/**
* Sets sort
*
* @param \MailSlurp\Models\SortObject|null $sort sort
*
* @return self
*/
public function setSort($sort)
{
if (is_null($sort)) {
throw new \InvalidArgumentException('non-nullable sort cannot be null');
}
$this->container['sort'] = $sort;
return $this;
}
/**
* Gets empty
*
* @return bool|null
*/
public function getEmpty()
{
return $this->container['empty'];
}
/**
* Sets empty
*
* @param bool|null $empty empty
*
* @return self
*/
public function setEmpty($empty)
{
if (is_null($empty)) {
throw new \InvalidArgumentException('non-nullable empty cannot be null');
}
$this->container['empty'] = $empty;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* OrganizationInboxProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* OrganizationInboxProjection Class Doc Comment
*
* @category Class
* @description Organization team inbox
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class OrganizationInboxProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'OrganizationInboxProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'domain_id' => 'string',
'created_at' => '\DateTime',
'name' => 'string',
'email_address' => 'string',
'favourite' => 'bool',
'tags' => 'string[]',
'team_access' => 'bool',
'inbox_type' => 'string',
'read_only' => 'bool',
'virtual_inbox' => 'bool',
'functions_as' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'domain_id' => 'uuid',
'created_at' => 'date-time',
'name' => null,
'email_address' => null,
'favourite' => null,
'tags' => null,
'team_access' => null,
'inbox_type' => null,
'read_only' => null,
'virtual_inbox' => null,
'functions_as' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'domain_id' => true,
'created_at' => false,
'name' => true,
'email_address' => true,
'favourite' => false,
'tags' => true,
'team_access' => false,
'inbox_type' => true,
'read_only' => false,
'virtual_inbox' => false,
'functions_as' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'domain_id' => 'domainId',
'created_at' => 'createdAt',
'name' => 'name',
'email_address' => 'emailAddress',
'favourite' => 'favourite',
'tags' => 'tags',
'team_access' => 'teamAccess',
'inbox_type' => 'inboxType',
'read_only' => 'readOnly',
'virtual_inbox' => 'virtualInbox',
'functions_as' => 'functionsAs'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'domain_id' => 'setDomainId',
'created_at' => 'setCreatedAt',
'name' => 'setName',
'email_address' => 'setEmailAddress',
'favourite' => 'setFavourite',
'tags' => 'setTags',
'team_access' => 'setTeamAccess',
'inbox_type' => 'setInboxType',
'read_only' => 'setReadOnly',
'virtual_inbox' => 'setVirtualInbox',
'functions_as' => 'setFunctionsAs'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'domain_id' => 'getDomainId',
'created_at' => 'getCreatedAt',
'name' => 'getName',
'email_address' => 'getEmailAddress',
'favourite' => 'getFavourite',
'tags' => 'getTags',
'team_access' => 'getTeamAccess',
'inbox_type' => 'getInboxType',
'read_only' => 'getReadOnly',
'virtual_inbox' => 'getVirtualInbox',
'functions_as' => 'getFunctionsAs'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX';
public const FUNCTIONS_AS_ALIAS = 'ALIAS';
public const FUNCTIONS_AS_THREAD = 'THREAD';
public const FUNCTIONS_AS_CATCH_ALL = 'CATCH_ALL';
public const FUNCTIONS_AS_CONNECTOR = 'CONNECTOR';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getInboxTypeAllowableValues()
{
return [
self::INBOX_TYPE_HTTP_INBOX,
self::INBOX_TYPE_SMTP_INBOX,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFunctionsAsAllowableValues()
{
return [
self::FUNCTIONS_AS_ALIAS,
self::FUNCTIONS_AS_THREAD,
self::FUNCTIONS_AS_CATCH_ALL,
self::FUNCTIONS_AS_CONNECTOR,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('favourite', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('team_access', $data ?? [], null);
$this->setIfExists('inbox_type', $data ?? [], null);
$this->setIfExists('read_only', $data ?? [], null);
$this->setIfExists('virtual_inbox', $data ?? [], null);
$this->setIfExists('functions_as', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['favourite'] === null) {
$invalidProperties[] = "'favourite' can't be null";
}
if ($this->container['team_access'] === null) {
$invalidProperties[] = "'team_access' can't be null";
}
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'inbox_type', must be one of '%s'",
$this->container['inbox_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['read_only'] === null) {
$invalidProperties[] = "'read_only' can't be null";
}
if ($this->container['virtual_inbox'] === null) {
$invalidProperties[] = "'virtual_inbox' can't be null";
}
$allowedValues = $this->getFunctionsAsAllowableValues();
if (!is_null($this->container['functions_as']) && !in_array($this->container['functions_as'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'functions_as', must be one of '%s'",
$this->container['functions_as'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically.
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id ID of custom domain used by the inbox if any
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`.
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets email_address
*
* @return string|null
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string|null $email_address The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID.
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
array_push($this->openAPINullablesSetToNull, 'email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets favourite
*
* @return bool
*/
public function getFavourite()
{
return $this->container['favourite'];
}
/**
* Sets favourite
*
* @param bool $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering
*
* @return self
*/
public function setFavourite($favourite)
{
if (is_null($favourite)) {
throw new \InvalidArgumentException('non-nullable favourite cannot be null');
}
$this->container['favourite'] = $favourite;
return $this;
}
/**
* Gets tags
*
* @return string[]|null
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
array_push($this->openAPINullablesSetToNull, 'tags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('tags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets team_access
*
* @return bool
*/
public function getTeamAccess()
{
return $this->container['team_access'];
}
/**
* Sets team_access
*
* @param bool $team_access Does inbox permit team access for organization team members. If so team users can use inbox and emails associated with it. See the team access guide at https://www.mailslurp.com/guides/team-email-account-sharing/
*
* @return self
*/
public function setTeamAccess($team_access)
{
if (is_null($team_access)) {
throw new \InvalidArgumentException('non-nullable team_access cannot be null');
}
$this->container['team_access'] = $team_access;
return $this;
}
/**
* Gets inbox_type
*
* @return string|null
*/
public function getInboxType()
{
return $this->container['inbox_type'];
}
/**
* Sets inbox_type
*
* @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).
*
* @return self
*/
public function setInboxType($inbox_type)
{
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'inbox_type', must be one of '%s'",
$inbox_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($inbox_type)) {
array_push($this->openAPINullablesSetToNull, 'inbox_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_type'] = $inbox_type;
return $this;
}
/**
* Gets read_only
*
* @return bool
*/
public function getReadOnly()
{
return $this->container['read_only'];
}
/**
* Sets read_only
*
* @param bool $read_only Is the inbox readOnly for the caller. Read only means can not be deleted or modified. This flag is present when using team accounts and shared inboxes.
*
* @return self
*/
public function setReadOnly($read_only)
{
if (is_null($read_only)) {
throw new \InvalidArgumentException('non-nullable read_only cannot be null');
}
$this->container['read_only'] = $read_only;
return $this;
}
/**
* Gets virtual_inbox
*
* @return bool
*/
public function getVirtualInbox()
{
return $this->container['virtual_inbox'];
}
/**
* Sets virtual_inbox
*
* @param bool $virtual_inbox Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions.
*
* @return self
*/
public function setVirtualInbox($virtual_inbox)
{
if (is_null($virtual_inbox)) {
throw new \InvalidArgumentException('non-nullable virtual_inbox cannot be null');
}
$this->container['virtual_inbox'] = $virtual_inbox;
return $this;
}
/**
* Gets functions_as
*
* @return string|null
*/
public function getFunctionsAs()
{
return $this->container['functions_as'];
}
/**
* Sets functions_as
*
* @param string|null $functions_as Inbox function if used as a primitive for another system.
*
* @return self
*/
public function setFunctionsAs($functions_as)
{
$allowedValues = $this->getFunctionsAsAllowableValues();
if (!is_null($functions_as) && !in_array($functions_as, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'functions_as', must be one of '%s'",
$functions_as,
implode("', '", $allowedValues)
)
);
}
if (is_null($functions_as)) {
array_push($this->openAPINullablesSetToNull, 'functions_as');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('functions_as', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['functions_as'] = $functions_as;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* NewFakeEmailAddressResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* NewFakeEmailAddressResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class NewFakeEmailAddressResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'NewFakeEmailAddressResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_address' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_address' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_address' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_address' => 'emailAddress'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_address' => 'setEmailAddress'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_address' => 'getEmailAddress'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_address', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* NameServerRecord
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* NameServerRecord Class Doc Comment
*
* @category Class
* @description Name Server Record
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class NameServerRecord implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'NameServerRecord';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'raw' => 'string',
'record_type' => 'string',
'priority' => 'string',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'raw' => null,
'record_type' => null,
'priority' => null,
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'raw' => false,
'record_type' => false,
'priority' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'raw' => 'raw',
'record_type' => 'recordType',
'priority' => 'priority',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'raw' => 'setRaw',
'record_type' => 'setRecordType',
'priority' => 'setPriority',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'raw' => 'getRaw',
'record_type' => 'getRecordType',
'priority' => 'getPriority',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('raw', $data ?? [], null);
$this->setIfExists('record_type', $data ?? [], null);
$this->setIfExists('priority', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['raw'] === null) {
$invalidProperties[] = "'raw' can't be null";
}
if ($this->container['record_type'] === null) {
$invalidProperties[] = "'record_type' can't be null";
}
if ($this->container['priority'] === null) {
$invalidProperties[] = "'priority' can't be null";
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets raw
*
* @return string
*/
public function getRaw()
{
return $this->container['raw'];
}
/**
* Sets raw
*
* @param string $raw raw
*
* @return self
*/
public function setRaw($raw)
{
if (is_null($raw)) {
throw new \InvalidArgumentException('non-nullable raw cannot be null');
}
$this->container['raw'] = $raw;
return $this;
}
/**
* Gets record_type
*
* @return string
*/
public function getRecordType()
{
return $this->container['record_type'];
}
/**
* Sets record_type
*
* @param string $record_type record_type
*
* @return self
*/
public function setRecordType($record_type)
{
if (is_null($record_type)) {
throw new \InvalidArgumentException('non-nullable record_type cannot be null');
}
$this->container['record_type'] = $record_type;
return $this;
}
/**
* Gets priority
*
* @return string
*/
public function getPriority()
{
return $this->container['priority'];
}
/**
* Sets priority
*
* @param string $priority priority
*
* @return self
*/
public function setPriority($priority)
{
if (is_null($priority)) {
throw new \InvalidArgumentException('non-nullable priority cannot be null');
}
$this->container['priority'] = $priority;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value value
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ModelInterface
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp\Models
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
/**
* Interface abstracting model access.
*
* @package MailSlurp\Models
* @author OpenAPI Generator team
*/
interface ModelInterface
{
/**
* The original name of the model.
*
* @return string
*/
public function getModelName();
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes();
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats();
/**
* Array of attributes where the key is the local name, and the value is the original name
*
* @return array
*/
public static function attributeMap();
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters();
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters();
/**
* Show all the invalid properties with reasons.
*
* @return array
*/
public function listInvalidProperties();
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool
*/
public function valid();
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool;
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool;
}
<?php
/**
* MissedEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* MissedEmailProjection Class Doc Comment
*
* @category Class
* @description Missed email data
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class MissedEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'MissedEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'user_id' => 'string',
'subject' => 'string',
'id' => 'string',
'from' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'user_id' => 'uuid',
'subject' => null,
'id' => 'uuid',
'from' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'user_id' => true,
'subject' => true,
'id' => false,
'from' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'user_id' => 'userId',
'subject' => 'subject',
'id' => 'id',
'from' => 'from'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'user_id' => 'setUserId',
'subject' => 'setSubject',
'id' => 'setId',
'from' => 'setFrom'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'user_id' => 'getUserId',
'subject' => 'getSubject',
'id' => 'getId',
'from' => 'getFrom'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
array_push($this->openAPINullablesSetToNull, 'user_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('user_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from from
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* MissedEmailDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* MissedEmailDto Class Doc Comment
*
* @category Class
* @description Missed email
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class MissedEmailDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'MissedEmailDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'subject' => 'string',
'body_excerpt' => 'string',
'attachment_count' => 'int',
'from' => 'string',
'raw_url' => 'string',
'raw_key' => 'string',
'raw_bucket' => 'string',
'can_restore' => 'bool',
'to' => 'string[]',
'cc' => 'string[]',
'bcc' => 'string[]',
'inbox_ids' => 'string[]',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'subject' => null,
'body_excerpt' => null,
'attachment_count' => 'int32',
'from' => null,
'raw_url' => null,
'raw_key' => null,
'raw_bucket' => null,
'can_restore' => null,
'to' => null,
'cc' => null,
'bcc' => null,
'inbox_ids' => 'uuid',
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => true,
'subject' => true,
'body_excerpt' => true,
'attachment_count' => false,
'from' => true,
'raw_url' => true,
'raw_key' => true,
'raw_bucket' => true,
'can_restore' => true,
'to' => false,
'cc' => false,
'bcc' => false,
'inbox_ids' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'subject' => 'subject',
'body_excerpt' => 'bodyExcerpt',
'attachment_count' => 'attachmentCount',
'from' => 'from',
'raw_url' => 'rawUrl',
'raw_key' => 'rawKey',
'raw_bucket' => 'rawBucket',
'can_restore' => 'canRestore',
'to' => 'to',
'cc' => 'cc',
'bcc' => 'bcc',
'inbox_ids' => 'inboxIds',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'subject' => 'setSubject',
'body_excerpt' => 'setBodyExcerpt',
'attachment_count' => 'setAttachmentCount',
'from' => 'setFrom',
'raw_url' => 'setRawUrl',
'raw_key' => 'setRawKey',
'raw_bucket' => 'setRawBucket',
'can_restore' => 'setCanRestore',
'to' => 'setTo',
'cc' => 'setCc',
'bcc' => 'setBcc',
'inbox_ids' => 'setInboxIds',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'subject' => 'getSubject',
'body_excerpt' => 'getBodyExcerpt',
'attachment_count' => 'getAttachmentCount',
'from' => 'getFrom',
'raw_url' => 'getRawUrl',
'raw_key' => 'getRawKey',
'raw_bucket' => 'getRawBucket',
'can_restore' => 'getCanRestore',
'to' => 'getTo',
'cc' => 'getCc',
'bcc' => 'getBcc',
'inbox_ids' => 'getInboxIds',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('body_excerpt', $data ?? [], null);
$this->setIfExists('attachment_count', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('raw_url', $data ?? [], null);
$this->setIfExists('raw_key', $data ?? [], null);
$this->setIfExists('raw_bucket', $data ?? [], null);
$this->setIfExists('can_restore', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('inbox_ids', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['attachment_count'] === null) {
$invalidProperties[] = "'attachment_count' can't be null";
}
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
if ($this->container['cc'] === null) {
$invalidProperties[] = "'cc' can't be null";
}
if ($this->container['bcc'] === null) {
$invalidProperties[] = "'bcc' can't be null";
}
if ($this->container['inbox_ids'] === null) {
$invalidProperties[] = "'inbox_ids' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
array_push($this->openAPINullablesSetToNull, 'user_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('user_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets body_excerpt
*
* @return string|null
*/
public function getBodyExcerpt()
{
return $this->container['body_excerpt'];
}
/**
* Sets body_excerpt
*
* @param string|null $body_excerpt body_excerpt
*
* @return self
*/
public function setBodyExcerpt($body_excerpt)
{
if (is_null($body_excerpt)) {
array_push($this->openAPINullablesSetToNull, 'body_excerpt');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_excerpt', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_excerpt'] = $body_excerpt;
return $this;
}
/**
* Gets attachment_count
*
* @return int
*/
public function getAttachmentCount()
{
return $this->container['attachment_count'];
}
/**
* Sets attachment_count
*
* @param int $attachment_count attachment_count
*
* @return self
*/
public function setAttachmentCount($attachment_count)
{
if (is_null($attachment_count)) {
throw new \InvalidArgumentException('non-nullable attachment_count cannot be null');
}
$this->container['attachment_count'] = $attachment_count;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from from
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets raw_url
*
* @return string|null
*/
public function getRawUrl()
{
return $this->container['raw_url'];
}
/**
* Sets raw_url
*
* @param string|null $raw_url raw_url
*
* @return self
*/
public function setRawUrl($raw_url)
{
if (is_null($raw_url)) {
array_push($this->openAPINullablesSetToNull, 'raw_url');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('raw_url', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['raw_url'] = $raw_url;
return $this;
}
/**
* Gets raw_key
*
* @return string|null
*/
public function getRawKey()
{
return $this->container['raw_key'];
}
/**
* Sets raw_key
*
* @param string|null $raw_key raw_key
*
* @return self
*/
public function setRawKey($raw_key)
{
if (is_null($raw_key)) {
array_push($this->openAPINullablesSetToNull, 'raw_key');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('raw_key', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['raw_key'] = $raw_key;
return $this;
}
/**
* Gets raw_bucket
*
* @return string|null
*/
public function getRawBucket()
{
return $this->container['raw_bucket'];
}
/**
* Sets raw_bucket
*
* @param string|null $raw_bucket raw_bucket
*
* @return self
*/
public function setRawBucket($raw_bucket)
{
if (is_null($raw_bucket)) {
array_push($this->openAPINullablesSetToNull, 'raw_bucket');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('raw_bucket', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['raw_bucket'] = $raw_bucket;
return $this;
}
/**
* Gets can_restore
*
* @return bool|null
*/
public function getCanRestore()
{
return $this->container['can_restore'];
}
/**
* Sets can_restore
*
* @param bool|null $can_restore can_restore
*
* @return self
*/
public function setCanRestore($can_restore)
{
if (is_null($can_restore)) {
array_push($this->openAPINullablesSetToNull, 'can_restore');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('can_restore', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['can_restore'] = $can_restore;
return $this;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to to
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets cc
*
* @return string[]
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[] $cc cc
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
throw new \InvalidArgumentException('non-nullable cc cannot be null');
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets bcc
*
* @return string[]
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[] $bcc bcc
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
throw new \InvalidArgumentException('non-nullable bcc cannot be null');
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets inbox_ids
*
* @return string[]
*/
public function getInboxIds()
{
return $this->container['inbox_ids'];
}
/**
* Sets inbox_ids
*
* @param string[] $inbox_ids inbox_ids
*
* @return self
*/
public function setInboxIds($inbox_ids)
{
if (is_null($inbox_ids)) {
throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null');
}
$this->container['inbox_ids'] = $inbox_ids;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* MatchOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* MatchOptions Class Doc Comment
*
* @category Class
* @description Optional filter for matching emails based on fields. For instance filter results to only include emails whose `SUBJECT` value does `CONTAIN` given match value. An example payload would be `{ matches: [{ field: 'SUBJECT', should: 'CONTAIN', value: 'Welcome' }] }`. You can also pass conditions such as `HAS_ATTACHMENT`. If you wish to extract regex matches inside the email content see the `getEmailContentMatch` method in the EmailController.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class MatchOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'MatchOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'matches' => '\MailSlurp\Models\MatchOption[]',
'conditions' => '\MailSlurp\Models\ConditionOption[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'matches' => null,
'conditions' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'matches' => true,
'conditions' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'matches' => 'matches',
'conditions' => 'conditions'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'matches' => 'setMatches',
'conditions' => 'setConditions'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'matches' => 'getMatches',
'conditions' => 'getConditions'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('matches', $data ?? [], null);
$this->setIfExists('conditions', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets matches
*
* @return \MailSlurp\Models\MatchOption[]|null
*/
public function getMatches()
{
return $this->container['matches'];
}
/**
* Sets matches
*
* @param \MailSlurp\Models\MatchOption[]|null $matches Zero or more match options such as `{ field: 'SUBJECT', should: 'CONTAIN', value: 'Welcome' }`. Options are additive so if one does not match the email is excluded from results
*
* @return self
*/
public function setMatches($matches)
{
if (is_null($matches)) {
array_push($this->openAPINullablesSetToNull, 'matches');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('matches', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['matches'] = $matches;
return $this;
}
/**
* Gets conditions
*
* @return \MailSlurp\Models\ConditionOption[]|null
*/
public function getConditions()
{
return $this->container['conditions'];
}
/**
* Sets conditions
*
* @param \MailSlurp\Models\ConditionOption[]|null $conditions Zero or more conditions such as `{ condition: 'HAS_ATTACHMENTS', value: 'TRUE' }`. Note the values are the strings `TRUE|FALSE` not booleans.
*
* @return self
*/
public function setConditions($conditions)
{
if (is_null($conditions)) {
array_push($this->openAPINullablesSetToNull, 'conditions');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('conditions', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['conditions'] = $conditions;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* MatchOption
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* MatchOption Class Doc Comment
*
* @category Class
* @description Options for matching emails in an inbox. Each match option object contains a `field`, `should` and `value` property. Together they form logical conditions such as `SUBJECT` should `CONTAIN` value.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class MatchOption implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'MatchOption';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'field' => 'string',
'should' => 'string',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'field' => null,
'should' => null,
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'field' => false,
'should' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'field' => 'field',
'should' => 'should',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'field' => 'setField',
'should' => 'setShould',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'field' => 'getField',
'should' => 'getShould',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FIELD_SUBJECT = 'SUBJECT';
public const FIELD_TO = 'TO';
public const FIELD_BCC = 'BCC';
public const FIELD_CC = 'CC';
public const FIELD_FROM = 'FROM';
public const FIELD_HEADERS = 'HEADERS';
public const SHOULD_MATCH = 'MATCH';
public const SHOULD_CONTAIN = 'CONTAIN';
public const SHOULD_EQUAL = 'EQUAL';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFieldAllowableValues()
{
return [
self::FIELD_SUBJECT,
self::FIELD_TO,
self::FIELD_BCC,
self::FIELD_CC,
self::FIELD_FROM,
self::FIELD_HEADERS,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getShouldAllowableValues()
{
return [
self::SHOULD_MATCH,
self::SHOULD_CONTAIN,
self::SHOULD_EQUAL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('field', $data ?? [], null);
$this->setIfExists('should', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['field'] === null) {
$invalidProperties[] = "'field' can't be null";
}
$allowedValues = $this->getFieldAllowableValues();
if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'field', must be one of '%s'",
$this->container['field'],
implode("', '", $allowedValues)
);
}
if ($this->container['should'] === null) {
$invalidProperties[] = "'should' can't be null";
}
$allowedValues = $this->getShouldAllowableValues();
if (!is_null($this->container['should']) && !in_array($this->container['should'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'should', must be one of '%s'",
$this->container['should'],
implode("', '", $allowedValues)
);
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets field
*
* @return string
*/
public function getField()
{
return $this->container['field'];
}
/**
* Sets field
*
* @param string $field Fields of an email object that can be used to filter results
*
* @return self
*/
public function setField($field)
{
$allowedValues = $this->getFieldAllowableValues();
if (!in_array($field, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'field', must be one of '%s'",
$field,
implode("', '", $allowedValues)
)
);
}
if (is_null($field)) {
throw new \InvalidArgumentException('non-nullable field cannot be null');
}
$this->container['field'] = $field;
return $this;
}
/**
* Gets should
*
* @return string
*/
public function getShould()
{
return $this->container['should'];
}
/**
* Sets should
*
* @param string $should How the value of the email field specified should be compared to the value given in the match options.
*
* @return self
*/
public function setShould($should)
{
$allowedValues = $this->getShouldAllowableValues();
if (!in_array($should, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'should', must be one of '%s'",
$should,
implode("', '", $allowedValues)
)
);
}
if (is_null($should)) {
throw new \InvalidArgumentException('non-nullable should cannot be null');
}
$this->container['should'] = $should;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value The value you wish to compare with the value of the field specified using the `should` value passed. For example `BODY` should `CONTAIN` a value passed.
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupTlsReportingDomainResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupTlsReportingDomainResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupTlsReportingDomainResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupTlsReportingDomainResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'valid' => 'bool',
'query' => '\MailSlurp\Models\DNSLookupOptions',
'records' => '\MailSlurp\Models\DNSLookupResult[]',
'errors' => 'string[]',
'warnings' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'valid' => null,
'query' => null,
'records' => null,
'errors' => null,
'warnings' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'valid' => false,
'query' => false,
'records' => false,
'errors' => false,
'warnings' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'valid' => 'valid',
'query' => 'query',
'records' => 'records',
'errors' => 'errors',
'warnings' => 'warnings'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'valid' => 'setValid',
'query' => 'setQuery',
'records' => 'setRecords',
'errors' => 'setErrors',
'warnings' => 'setWarnings'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'valid' => 'getValid',
'query' => 'getQuery',
'records' => 'getRecords',
'errors' => 'getErrors',
'warnings' => 'getWarnings'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('valid', $data ?? [], null);
$this->setIfExists('query', $data ?? [], null);
$this->setIfExists('records', $data ?? [], null);
$this->setIfExists('errors', $data ?? [], null);
$this->setIfExists('warnings', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['valid'] === null) {
$invalidProperties[] = "'valid' can't be null";
}
if ($this->container['query'] === null) {
$invalidProperties[] = "'query' can't be null";
}
if ($this->container['records'] === null) {
$invalidProperties[] = "'records' can't be null";
}
if ($this->container['errors'] === null) {
$invalidProperties[] = "'errors' can't be null";
}
if ($this->container['warnings'] === null) {
$invalidProperties[] = "'warnings' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets valid
*
* @return bool
*/
public function getValid()
{
return $this->container['valid'];
}
/**
* Sets valid
*
* @param bool $valid valid
*
* @return self
*/
public function setValid($valid)
{
if (is_null($valid)) {
throw new \InvalidArgumentException('non-nullable valid cannot be null');
}
$this->container['valid'] = $valid;
return $this;
}
/**
* Gets query
*
* @return \MailSlurp\Models\DNSLookupOptions
*/
public function getQuery()
{
return $this->container['query'];
}
/**
* Sets query
*
* @param \MailSlurp\Models\DNSLookupOptions $query query
*
* @return self
*/
public function setQuery($query)
{
if (is_null($query)) {
throw new \InvalidArgumentException('non-nullable query cannot be null');
}
$this->container['query'] = $query;
return $this;
}
/**
* Gets records
*
* @return \MailSlurp\Models\DNSLookupResult[]
*/
public function getRecords()
{
return $this->container['records'];
}
/**
* Sets records
*
* @param \MailSlurp\Models\DNSLookupResult[] $records records
*
* @return self
*/
public function setRecords($records)
{
if (is_null($records)) {
throw new \InvalidArgumentException('non-nullable records cannot be null');
}
$this->container['records'] = $records;
return $this;
}
/**
* Gets errors
*
* @return string[]
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors
*
* @param string[] $errors errors
*
* @return self
*/
public function setErrors($errors)
{
if (is_null($errors)) {
throw new \InvalidArgumentException('non-nullable errors cannot be null');
}
$this->container['errors'] = $errors;
return $this;
}
/**
* Gets warnings
*
* @return string[]
*/
public function getWarnings()
{
return $this->container['warnings'];
}
/**
* Sets warnings
*
* @param string[] $warnings warnings
*
* @return self
*/
public function setWarnings($warnings)
{
if (is_null($warnings)) {
throw new \InvalidArgumentException('non-nullable warnings cannot be null');
}
$this->container['warnings'] = $warnings;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupTlsReportingDomainOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupTlsReportingDomainOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupTlsReportingDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupTlsReportingDomainOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'host' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'host' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'host' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'host' => 'host'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'host' => 'setHost'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'host' => 'getHost'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('host', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['host'] === null) {
$invalidProperties[] = "'host' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets host
*
* @return string
*/
public function getHost()
{
return $this->container['host'];
}
/**
* Sets host
*
* @param string $host host
*
* @return self
*/
public function setHost($host)
{
if (is_null($host)) {
throw new \InvalidArgumentException('non-nullable host cannot be null');
}
$this->container['host'] = $host;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupMtaStsDomainResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupMtaStsDomainResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupMtaStsDomainResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupMtaStsDomainResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'valid' => 'bool',
'query' => '\MailSlurp\Models\DNSLookupOptions',
'records' => '\MailSlurp\Models\DNSLookupResult[]',
'well_known_query' => 'string',
'well_known_present' => 'bool',
'well_known_value' => 'string',
'errors' => 'string[]',
'warnings' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'valid' => null,
'query' => null,
'records' => null,
'well_known_query' => null,
'well_known_present' => null,
'well_known_value' => null,
'errors' => null,
'warnings' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'valid' => false,
'query' => false,
'records' => false,
'well_known_query' => false,
'well_known_present' => false,
'well_known_value' => false,
'errors' => false,
'warnings' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'valid' => 'valid',
'query' => 'query',
'records' => 'records',
'well_known_query' => 'wellKnownQuery',
'well_known_present' => 'wellKnownPresent',
'well_known_value' => 'wellKnownValue',
'errors' => 'errors',
'warnings' => 'warnings'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'valid' => 'setValid',
'query' => 'setQuery',
'records' => 'setRecords',
'well_known_query' => 'setWellKnownQuery',
'well_known_present' => 'setWellKnownPresent',
'well_known_value' => 'setWellKnownValue',
'errors' => 'setErrors',
'warnings' => 'setWarnings'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'valid' => 'getValid',
'query' => 'getQuery',
'records' => 'getRecords',
'well_known_query' => 'getWellKnownQuery',
'well_known_present' => 'getWellKnownPresent',
'well_known_value' => 'getWellKnownValue',
'errors' => 'getErrors',
'warnings' => 'getWarnings'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('valid', $data ?? [], null);
$this->setIfExists('query', $data ?? [], null);
$this->setIfExists('records', $data ?? [], null);
$this->setIfExists('well_known_query', $data ?? [], null);
$this->setIfExists('well_known_present', $data ?? [], null);
$this->setIfExists('well_known_value', $data ?? [], null);
$this->setIfExists('errors', $data ?? [], null);
$this->setIfExists('warnings', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['valid'] === null) {
$invalidProperties[] = "'valid' can't be null";
}
if ($this->container['query'] === null) {
$invalidProperties[] = "'query' can't be null";
}
if ($this->container['records'] === null) {
$invalidProperties[] = "'records' can't be null";
}
if ($this->container['well_known_query'] === null) {
$invalidProperties[] = "'well_known_query' can't be null";
}
if ($this->container['well_known_present'] === null) {
$invalidProperties[] = "'well_known_present' can't be null";
}
if ($this->container['well_known_value'] === null) {
$invalidProperties[] = "'well_known_value' can't be null";
}
if ($this->container['errors'] === null) {
$invalidProperties[] = "'errors' can't be null";
}
if ($this->container['warnings'] === null) {
$invalidProperties[] = "'warnings' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets valid
*
* @return bool
*/
public function getValid()
{
return $this->container['valid'];
}
/**
* Sets valid
*
* @param bool $valid valid
*
* @return self
*/
public function setValid($valid)
{
if (is_null($valid)) {
throw new \InvalidArgumentException('non-nullable valid cannot be null');
}
$this->container['valid'] = $valid;
return $this;
}
/**
* Gets query
*
* @return \MailSlurp\Models\DNSLookupOptions
*/
public function getQuery()
{
return $this->container['query'];
}
/**
* Sets query
*
* @param \MailSlurp\Models\DNSLookupOptions $query query
*
* @return self
*/
public function setQuery($query)
{
if (is_null($query)) {
throw new \InvalidArgumentException('non-nullable query cannot be null');
}
$this->container['query'] = $query;
return $this;
}
/**
* Gets records
*
* @return \MailSlurp\Models\DNSLookupResult[]
*/
public function getRecords()
{
return $this->container['records'];
}
/**
* Sets records
*
* @param \MailSlurp\Models\DNSLookupResult[] $records records
*
* @return self
*/
public function setRecords($records)
{
if (is_null($records)) {
throw new \InvalidArgumentException('non-nullable records cannot be null');
}
$this->container['records'] = $records;
return $this;
}
/**
* Gets well_known_query
*
* @return string
*/
public function getWellKnownQuery()
{
return $this->container['well_known_query'];
}
/**
* Sets well_known_query
*
* @param string $well_known_query well_known_query
*
* @return self
*/
public function setWellKnownQuery($well_known_query)
{
if (is_null($well_known_query)) {
throw new \InvalidArgumentException('non-nullable well_known_query cannot be null');
}
$this->container['well_known_query'] = $well_known_query;
return $this;
}
/**
* Gets well_known_present
*
* @return bool
*/
public function getWellKnownPresent()
{
return $this->container['well_known_present'];
}
/**
* Sets well_known_present
*
* @param bool $well_known_present well_known_present
*
* @return self
*/
public function setWellKnownPresent($well_known_present)
{
if (is_null($well_known_present)) {
throw new \InvalidArgumentException('non-nullable well_known_present cannot be null');
}
$this->container['well_known_present'] = $well_known_present;
return $this;
}
/**
* Gets well_known_value
*
* @return string
*/
public function getWellKnownValue()
{
return $this->container['well_known_value'];
}
/**
* Sets well_known_value
*
* @param string $well_known_value well_known_value
*
* @return self
*/
public function setWellKnownValue($well_known_value)
{
if (is_null($well_known_value)) {
throw new \InvalidArgumentException('non-nullable well_known_value cannot be null');
}
$this->container['well_known_value'] = $well_known_value;
return $this;
}
/**
* Gets errors
*
* @return string[]
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors
*
* @param string[] $errors errors
*
* @return self
*/
public function setErrors($errors)
{
if (is_null($errors)) {
throw new \InvalidArgumentException('non-nullable errors cannot be null');
}
$this->container['errors'] = $errors;
return $this;
}
/**
* Gets warnings
*
* @return string[]
*/
public function getWarnings()
{
return $this->container['warnings'];
}
/**
* Sets warnings
*
* @param string[] $warnings warnings
*
* @return self
*/
public function setWarnings($warnings)
{
if (is_null($warnings)) {
throw new \InvalidArgumentException('non-nullable warnings cannot be null');
}
$this->container['warnings'] = $warnings;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupMtaStsDomainOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupMtaStsDomainOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupMtaStsDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupMtaStsDomainOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'host' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'host' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'host' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'host' => 'host'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'host' => 'setHost'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'host' => 'getHost'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('host', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['host'] === null) {
$invalidProperties[] = "'host' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets host
*
* @return string
*/
public function getHost()
{
return $this->container['host'];
}
/**
* Sets host
*
* @param string $host host
*
* @return self
*/
public function setHost($host)
{
if (is_null($host)) {
throw new \InvalidArgumentException('non-nullable host cannot be null');
}
$this->container['host'] = $host;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupDmarcDomainResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupDmarcDomainResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupDmarcDomainResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupDmarcDomainResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'valid' => 'bool',
'query' => '\MailSlurp\Models\DNSLookupOptions',
'records' => '\MailSlurp\Models\DNSLookupResult[]',
'errors' => 'string[]',
'warnings' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'valid' => null,
'query' => null,
'records' => null,
'errors' => null,
'warnings' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'valid' => false,
'query' => false,
'records' => false,
'errors' => false,
'warnings' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'valid' => 'valid',
'query' => 'query',
'records' => 'records',
'errors' => 'errors',
'warnings' => 'warnings'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'valid' => 'setValid',
'query' => 'setQuery',
'records' => 'setRecords',
'errors' => 'setErrors',
'warnings' => 'setWarnings'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'valid' => 'getValid',
'query' => 'getQuery',
'records' => 'getRecords',
'errors' => 'getErrors',
'warnings' => 'getWarnings'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('valid', $data ?? [], null);
$this->setIfExists('query', $data ?? [], null);
$this->setIfExists('records', $data ?? [], null);
$this->setIfExists('errors', $data ?? [], null);
$this->setIfExists('warnings', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['valid'] === null) {
$invalidProperties[] = "'valid' can't be null";
}
if ($this->container['query'] === null) {
$invalidProperties[] = "'query' can't be null";
}
if ($this->container['records'] === null) {
$invalidProperties[] = "'records' can't be null";
}
if ($this->container['errors'] === null) {
$invalidProperties[] = "'errors' can't be null";
}
if ($this->container['warnings'] === null) {
$invalidProperties[] = "'warnings' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets valid
*
* @return bool
*/
public function getValid()
{
return $this->container['valid'];
}
/**
* Sets valid
*
* @param bool $valid valid
*
* @return self
*/
public function setValid($valid)
{
if (is_null($valid)) {
throw new \InvalidArgumentException('non-nullable valid cannot be null');
}
$this->container['valid'] = $valid;
return $this;
}
/**
* Gets query
*
* @return \MailSlurp\Models\DNSLookupOptions
*/
public function getQuery()
{
return $this->container['query'];
}
/**
* Sets query
*
* @param \MailSlurp\Models\DNSLookupOptions $query query
*
* @return self
*/
public function setQuery($query)
{
if (is_null($query)) {
throw new \InvalidArgumentException('non-nullable query cannot be null');
}
$this->container['query'] = $query;
return $this;
}
/**
* Gets records
*
* @return \MailSlurp\Models\DNSLookupResult[]
*/
public function getRecords()
{
return $this->container['records'];
}
/**
* Sets records
*
* @param \MailSlurp\Models\DNSLookupResult[] $records records
*
* @return self
*/
public function setRecords($records)
{
if (is_null($records)) {
throw new \InvalidArgumentException('non-nullable records cannot be null');
}
$this->container['records'] = $records;
return $this;
}
/**
* Gets errors
*
* @return string[]
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors
*
* @param string[] $errors errors
*
* @return self
*/
public function setErrors($errors)
{
if (is_null($errors)) {
throw new \InvalidArgumentException('non-nullable errors cannot be null');
}
$this->container['errors'] = $errors;
return $this;
}
/**
* Gets warnings
*
* @return string[]
*/
public function getWarnings()
{
return $this->container['warnings'];
}
/**
* Sets warnings
*
* @param string[] $warnings warnings
*
* @return self
*/
public function setWarnings($warnings)
{
if (is_null($warnings)) {
throw new \InvalidArgumentException('non-nullable warnings cannot be null');
}
$this->container['warnings'] = $warnings;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupDmarcDomainOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupDmarcDomainOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupDmarcDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupDmarcDomainOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'host' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'host' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'host' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'host' => 'host'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'host' => 'setHost'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'host' => 'getHost'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('host', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['host'] === null) {
$invalidProperties[] = "'host' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets host
*
* @return string
*/
public function getHost()
{
return $this->container['host'];
}
/**
* Sets host
*
* @param string $host host
*
* @return self
*/
public function setHost($host)
{
if (is_null($host)) {
throw new \InvalidArgumentException('non-nullable host cannot be null');
}
$this->container['host'] = $host;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupBimiDomainResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupBimiDomainResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupBimiDomainResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupBimiDomainResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'valid' => 'bool',
'query' => '\MailSlurp\Models\DNSLookupOptions',
'records' => '\MailSlurp\Models\DNSLookupResult[]',
'errors' => 'string[]',
'warnings' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'valid' => null,
'query' => null,
'records' => null,
'errors' => null,
'warnings' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'valid' => false,
'query' => false,
'records' => false,
'errors' => false,
'warnings' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'valid' => 'valid',
'query' => 'query',
'records' => 'records',
'errors' => 'errors',
'warnings' => 'warnings'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'valid' => 'setValid',
'query' => 'setQuery',
'records' => 'setRecords',
'errors' => 'setErrors',
'warnings' => 'setWarnings'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'valid' => 'getValid',
'query' => 'getQuery',
'records' => 'getRecords',
'errors' => 'getErrors',
'warnings' => 'getWarnings'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('valid', $data ?? [], null);
$this->setIfExists('query', $data ?? [], null);
$this->setIfExists('records', $data ?? [], null);
$this->setIfExists('errors', $data ?? [], null);
$this->setIfExists('warnings', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['valid'] === null) {
$invalidProperties[] = "'valid' can't be null";
}
if ($this->container['query'] === null) {
$invalidProperties[] = "'query' can't be null";
}
if ($this->container['records'] === null) {
$invalidProperties[] = "'records' can't be null";
}
if ($this->container['errors'] === null) {
$invalidProperties[] = "'errors' can't be null";
}
if ($this->container['warnings'] === null) {
$invalidProperties[] = "'warnings' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets valid
*
* @return bool
*/
public function getValid()
{
return $this->container['valid'];
}
/**
* Sets valid
*
* @param bool $valid valid
*
* @return self
*/
public function setValid($valid)
{
if (is_null($valid)) {
throw new \InvalidArgumentException('non-nullable valid cannot be null');
}
$this->container['valid'] = $valid;
return $this;
}
/**
* Gets query
*
* @return \MailSlurp\Models\DNSLookupOptions
*/
public function getQuery()
{
return $this->container['query'];
}
/**
* Sets query
*
* @param \MailSlurp\Models\DNSLookupOptions $query query
*
* @return self
*/
public function setQuery($query)
{
if (is_null($query)) {
throw new \InvalidArgumentException('non-nullable query cannot be null');
}
$this->container['query'] = $query;
return $this;
}
/**
* Gets records
*
* @return \MailSlurp\Models\DNSLookupResult[]
*/
public function getRecords()
{
return $this->container['records'];
}
/**
* Sets records
*
* @param \MailSlurp\Models\DNSLookupResult[] $records records
*
* @return self
*/
public function setRecords($records)
{
if (is_null($records)) {
throw new \InvalidArgumentException('non-nullable records cannot be null');
}
$this->container['records'] = $records;
return $this;
}
/**
* Gets errors
*
* @return string[]
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors
*
* @param string[] $errors errors
*
* @return self
*/
public function setErrors($errors)
{
if (is_null($errors)) {
throw new \InvalidArgumentException('non-nullable errors cannot be null');
}
$this->container['errors'] = $errors;
return $this;
}
/**
* Gets warnings
*
* @return string[]
*/
public function getWarnings()
{
return $this->container['warnings'];
}
/**
* Sets warnings
*
* @param string[] $warnings warnings
*
* @return self
*/
public function setWarnings($warnings)
{
if (is_null($warnings)) {
throw new \InvalidArgumentException('non-nullable warnings cannot be null');
}
$this->container['warnings'] = $warnings;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LookupBimiDomainOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LookupBimiDomainOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LookupBimiDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LookupBimiDomainOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'host' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'host' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'host' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'host' => 'host'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'host' => 'setHost'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'host' => 'getHost'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('host', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['host'] === null) {
$invalidProperties[] = "'host' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets host
*
* @return string
*/
public function getHost()
{
return $this->container['host'];
}
/**
* Sets host
*
* @param string $host host
*
* @return self
*/
public function setHost($host)
{
if (is_null($host)) {
throw new \InvalidArgumentException('non-nullable host cannot be null');
}
$this->container['host'] = $host;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ListUnsubscribeRecipientProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ListUnsubscribeRecipientProjection Class Doc Comment
*
* @category Class
* @description List unsubscribe recipient
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ListUnsubscribeRecipientProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ListUnsubscribeRecipientProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'email_address' => 'string',
'domain_id' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'email_address' => null,
'domain_id' => 'uuid',
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'email_address' => false,
'domain_id' => true,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'email_address' => 'emailAddress',
'domain_id' => 'domainId',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'email_address' => 'setEmailAddress',
'domain_id' => 'setDomainId',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'email_address' => 'getEmailAddress',
'domain_id' => 'getDomainId',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id domain_id
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* LinkIssue
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* LinkIssue Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class LinkIssue implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'LinkIssue';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'url' => 'string',
'response_status' => 'int',
'severity' => 'string',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'url' => null,
'response_status' => 'int32',
'severity' => null,
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'url' => false,
'response_status' => false,
'severity' => false,
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'url' => 'url',
'response_status' => 'responseStatus',
'severity' => 'severity',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'url' => 'setUrl',
'response_status' => 'setResponseStatus',
'severity' => 'setSeverity',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'url' => 'getUrl',
'response_status' => 'getResponseStatus',
'severity' => 'getSeverity',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SEVERITY_WARNING = 'Warning';
public const SEVERITY_ERROR = 'Error';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSeverityAllowableValues()
{
return [
self::SEVERITY_WARNING,
self::SEVERITY_ERROR,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('response_status', $data ?? [], null);
$this->setIfExists('severity', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
if ($this->container['severity'] === null) {
$invalidProperties[] = "'severity' can't be null";
}
$allowedValues = $this->getSeverityAllowableValues();
if (!is_null($this->container['severity']) && !in_array($this->container['severity'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'severity', must be one of '%s'",
$this->container['severity'],
implode("', '", $allowedValues)
);
}
if ($this->container['message'] === null) {
$invalidProperties[] = "'message' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url url
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets response_status
*
* @return int|null
*/
public function getResponseStatus()
{
return $this->container['response_status'];
}
/**
* Sets response_status
*
* @param int|null $response_status response_status
*
* @return self
*/
public function setResponseStatus($response_status)
{
if (is_null($response_status)) {
throw new \InvalidArgumentException('non-nullable response_status cannot be null');
}
$this->container['response_status'] = $response_status;
return $this;
}
/**
* Gets severity
*
* @return string
*/
public function getSeverity()
{
return $this->container['severity'];
}
/**
* Sets severity
*
* @param string $severity severity
*
* @return self
*/
public function setSeverity($severity)
{
$allowedValues = $this->getSeverityAllowableValues();
if (!in_array($severity, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'severity', must be one of '%s'",
$severity,
implode("', '", $allowedValues)
)
);
}
if (is_null($severity)) {
throw new \InvalidArgumentException('non-nullable severity cannot be null');
}
$this->container['severity'] = $severity;
return $this;
}
/**
* Gets message
*
* @return string
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* JSONSchemaDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* JSONSchemaDto Class Doc Comment
*
* @category Class
* @description JSONSchema for payload
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class JSONSchemaDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'JSONSchemaDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value value
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxRulesetTestResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxRulesetTestResult Class Doc Comment
*
* @category Class
* @description Result of test of inbox ruleset
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxRulesetTestResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxRulesetTestResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'ruleset_matches' => 'array<string,bool>',
'matches' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'ruleset_matches' => null,
'matches' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'ruleset_matches' => false,
'matches' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'ruleset_matches' => 'rulesetMatches',
'matches' => 'matches'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'ruleset_matches' => 'setRulesetMatches',
'matches' => 'setMatches'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'ruleset_matches' => 'getRulesetMatches',
'matches' => 'getMatches'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('ruleset_matches', $data ?? [], null);
$this->setIfExists('matches', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['ruleset_matches'] === null) {
$invalidProperties[] = "'ruleset_matches' can't be null";
}
if ($this->container['matches'] === null) {
$invalidProperties[] = "'matches' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets ruleset_matches
*
* @return array<string,bool>
*/
public function getRulesetMatches()
{
return $this->container['ruleset_matches'];
}
/**
* Sets ruleset_matches
*
* @param array<string,bool> $ruleset_matches Map of inbox ruleset ID to boolean of if target matches
*
* @return self
*/
public function setRulesetMatches($ruleset_matches)
{
if (is_null($ruleset_matches)) {
throw new \InvalidArgumentException('non-nullable ruleset_matches cannot be null');
}
$this->container['ruleset_matches'] = $ruleset_matches;
return $this;
}
/**
* Gets matches
*
* @return bool
*/
public function getMatches()
{
return $this->container['matches'];
}
/**
* Sets matches
*
* @param bool $matches matches
*
* @return self
*/
public function setMatches($matches)
{
if (is_null($matches)) {
throw new \InvalidArgumentException('non-nullable matches cannot be null');
}
$this->container['matches'] = $matches;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxRulesetTestOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxRulesetTestOptions Class Doc Comment
*
* @category Class
* @description Test options for inbox ruleset
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxRulesetTestOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxRulesetTestOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'test_target' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'test_target' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'test_target' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'test_target' => 'testTarget'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'test_target' => 'setTestTarget'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'test_target' => 'getTestTarget'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('test_target', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['test_target'] === null) {
$invalidProperties[] = "'test_target' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets test_target
*
* @return string
*/
public function getTestTarget()
{
return $this->container['test_target'];
}
/**
* Sets test_target
*
* @param string $test_target test_target
*
* @return self
*/
public function setTestTarget($test_target)
{
if (is_null($test_target)) {
throw new \InvalidArgumentException('non-nullable test_target cannot be null');
}
$this->container['test_target'] = $test_target;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxRulesetDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxRulesetDto Class Doc Comment
*
* @category Class
* @description Rules for inbox
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxRulesetDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxRulesetDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'inbox_id' => 'string',
'scope' => 'string',
'action' => 'string',
'target' => 'string',
'handler' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'inbox_id' => 'uuid',
'scope' => null,
'action' => null,
'target' => null,
'handler' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'inbox_id' => true,
'scope' => false,
'action' => false,
'target' => false,
'handler' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'inbox_id' => 'inboxId',
'scope' => 'scope',
'action' => 'action',
'target' => 'target',
'handler' => 'handler',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'inbox_id' => 'setInboxId',
'scope' => 'setScope',
'action' => 'setAction',
'target' => 'setTarget',
'handler' => 'setHandler',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'inbox_id' => 'getInboxId',
'scope' => 'getScope',
'action' => 'getAction',
'target' => 'getTarget',
'handler' => 'getHandler',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SCOPE_RECEIVING_EMAILS = 'RECEIVING_EMAILS';
public const SCOPE_SENDING_EMAILS = 'SENDING_EMAILS';
public const ACTION_BLOCK = 'BLOCK';
public const ACTION_ALLOW = 'ALLOW';
public const ACTION_FILTER_REMOVE = 'FILTER_REMOVE';
public const HANDLER_EXCEPTION = 'EXCEPTION';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getScopeAllowableValues()
{
return [
self::SCOPE_RECEIVING_EMAILS,
self::SCOPE_SENDING_EMAILS,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getActionAllowableValues()
{
return [
self::ACTION_BLOCK,
self::ACTION_ALLOW,
self::ACTION_FILTER_REMOVE,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getHandlerAllowableValues()
{
return [
self::HANDLER_EXCEPTION,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('scope', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('target', $data ?? [], null);
$this->setIfExists('handler', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['scope'] === null) {
$invalidProperties[] = "'scope' can't be null";
}
$allowedValues = $this->getScopeAllowableValues();
if (!is_null($this->container['scope']) && !in_array($this->container['scope'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'scope', must be one of '%s'",
$this->container['scope'],
implode("', '", $allowedValues)
);
}
if ($this->container['action'] === null) {
$invalidProperties[] = "'action' can't be null";
}
$allowedValues = $this->getActionAllowableValues();
if (!is_null($this->container['action']) && !in_array($this->container['action'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'action', must be one of '%s'",
$this->container['action'],
implode("', '", $allowedValues)
);
}
if ($this->container['target'] === null) {
$invalidProperties[] = "'target' can't be null";
}
if ($this->container['handler'] === null) {
$invalidProperties[] = "'handler' can't be null";
}
$allowedValues = $this->getHandlerAllowableValues();
if (!is_null($this->container['handler']) && !in_array($this->container['handler'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'handler', must be one of '%s'",
$this->container['handler'],
implode("', '", $allowedValues)
);
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets scope
*
* @return string
*/
public function getScope()
{
return $this->container['scope'];
}
/**
* Sets scope
*
* @param string $scope scope
*
* @return self
*/
public function setScope($scope)
{
$allowedValues = $this->getScopeAllowableValues();
if (!in_array($scope, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'scope', must be one of '%s'",
$scope,
implode("', '", $allowedValues)
)
);
}
if (is_null($scope)) {
throw new \InvalidArgumentException('non-nullable scope cannot be null');
}
$this->container['scope'] = $scope;
return $this;
}
/**
* Gets action
*
* @return string
*/
public function getAction()
{
return $this->container['action'];
}
/**
* Sets action
*
* @param string $action action
*
* @return self
*/
public function setAction($action)
{
$allowedValues = $this->getActionAllowableValues();
if (!in_array($action, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'action', must be one of '%s'",
$action,
implode("', '", $allowedValues)
)
);
}
if (is_null($action)) {
throw new \InvalidArgumentException('non-nullable action cannot be null');
}
$this->container['action'] = $action;
return $this;
}
/**
* Gets target
*
* @return string
*/
public function getTarget()
{
return $this->container['target'];
}
/**
* Sets target
*
* @param string $target target
*
* @return self
*/
public function setTarget($target)
{
if (is_null($target)) {
throw new \InvalidArgumentException('non-nullable target cannot be null');
}
$this->container['target'] = $target;
return $this;
}
/**
* Gets handler
*
* @return string
*/
public function getHandler()
{
return $this->container['handler'];
}
/**
* Sets handler
*
* @param string $handler handler
*
* @return self
*/
public function setHandler($handler)
{
$allowedValues = $this->getHandlerAllowableValues();
if (!in_array($handler, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'handler', must be one of '%s'",
$handler,
implode("', '", $allowedValues)
)
);
}
if (is_null($handler)) {
throw new \InvalidArgumentException('non-nullable handler cannot be null');
}
$this->container['handler'] = $handler;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxReplierEventProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxReplierEventProjection Class Doc Comment
*
* @category Class
* @description Inbox replier event
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxReplierEventProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxReplierEventProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'replier_id' => 'string',
'recipients' => 'string[]',
'email_id' => 'string',
'inbox_id' => 'string',
'user_id' => 'string',
'sent_id' => 'string',
'message' => 'string',
'id' => 'string',
'status' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'replier_id' => 'uuid',
'recipients' => null,
'email_id' => 'uuid',
'inbox_id' => 'uuid',
'user_id' => 'uuid',
'sent_id' => 'uuid',
'message' => null,
'id' => 'uuid',
'status' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'replier_id' => true,
'recipients' => true,
'email_id' => true,
'inbox_id' => true,
'user_id' => true,
'sent_id' => true,
'message' => true,
'id' => true,
'status' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'replier_id' => 'replierId',
'recipients' => 'recipients',
'email_id' => 'emailId',
'inbox_id' => 'inboxId',
'user_id' => 'userId',
'sent_id' => 'sentId',
'message' => 'message',
'id' => 'id',
'status' => 'status'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'replier_id' => 'setReplierId',
'recipients' => 'setRecipients',
'email_id' => 'setEmailId',
'inbox_id' => 'setInboxId',
'user_id' => 'setUserId',
'sent_id' => 'setSentId',
'message' => 'setMessage',
'id' => 'setId',
'status' => 'setStatus'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'replier_id' => 'getReplierId',
'recipients' => 'getRecipients',
'email_id' => 'getEmailId',
'inbox_id' => 'getInboxId',
'user_id' => 'getUserId',
'sent_id' => 'getSentId',
'message' => 'getMessage',
'id' => 'getId',
'status' => 'getStatus'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_SUCCESS = 'SUCCESS';
public const STATUS_FAILURE = 'FAILURE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_SUCCESS,
self::STATUS_FAILURE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('replier_id', $data ?? [], null);
$this->setIfExists('recipients', $data ?? [], null);
$this->setIfExists('email_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('sent_id', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets replier_id
*
* @return string|null
*/
public function getReplierId()
{
return $this->container['replier_id'];
}
/**
* Sets replier_id
*
* @param string|null $replier_id replier_id
*
* @return self
*/
public function setReplierId($replier_id)
{
if (is_null($replier_id)) {
array_push($this->openAPINullablesSetToNull, 'replier_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('replier_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['replier_id'] = $replier_id;
return $this;
}
/**
* Gets recipients
*
* @return string[]|null
*/
public function getRecipients()
{
return $this->container['recipients'];
}
/**
* Sets recipients
*
* @param string[]|null $recipients recipients
*
* @return self
*/
public function setRecipients($recipients)
{
if (is_null($recipients)) {
array_push($this->openAPINullablesSetToNull, 'recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['recipients'] = $recipients;
return $this;
}
/**
* Gets email_id
*
* @return string|null
*/
public function getEmailId()
{
return $this->container['email_id'];
}
/**
* Sets email_id
*
* @param string|null $email_id email_id
*
* @return self
*/
public function setEmailId($email_id)
{
if (is_null($email_id)) {
array_push($this->openAPINullablesSetToNull, 'email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_id'] = $email_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
array_push($this->openAPINullablesSetToNull, 'user_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('user_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets sent_id
*
* @return string|null
*/
public function getSentId()
{
return $this->container['sent_id'];
}
/**
* Sets sent_id
*
* @param string|null $sent_id sent_id
*
* @return self
*/
public function setSentId($sent_id)
{
if (is_null($sent_id)) {
array_push($this->openAPINullablesSetToNull, 'sent_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_id'] = $sent_id;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
array_push($this->openAPINullablesSetToNull, 'id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets status
*
* @return string|null
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string|null $status status
*
* @return self
*/
public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($status) && !in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
if (is_null($status)) {
array_push($this->openAPINullablesSetToNull, 'status');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('status', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['status'] = $status;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxReplierDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxReplierDto Class Doc Comment
*
* @category Class
* @description Inbox replier. Will automatically reply to inbound emails that match given field for an inbox.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxReplierDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxReplierDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'inbox_id' => 'string',
'name' => 'string',
'field' => 'string',
'match' => 'string',
'reply_to' => 'string',
'subject' => 'string',
'from' => 'string',
'charset' => 'string',
'is_html' => 'bool',
'template_id' => 'string',
'template_variables' => 'array<string,object>',
'ignore_reply_to' => 'bool',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'inbox_id' => 'uuid',
'name' => null,
'field' => null,
'match' => null,
'reply_to' => null,
'subject' => null,
'from' => null,
'charset' => null,
'is_html' => null,
'template_id' => 'uuid',
'template_variables' => null,
'ignore_reply_to' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'inbox_id' => false,
'name' => true,
'field' => false,
'match' => false,
'reply_to' => true,
'subject' => true,
'from' => true,
'charset' => true,
'is_html' => false,
'template_id' => true,
'template_variables' => true,
'ignore_reply_to' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'inbox_id' => 'inboxId',
'name' => 'name',
'field' => 'field',
'match' => 'match',
'reply_to' => 'replyTo',
'subject' => 'subject',
'from' => 'from',
'charset' => 'charset',
'is_html' => 'isHTML',
'template_id' => 'templateId',
'template_variables' => 'templateVariables',
'ignore_reply_to' => 'ignoreReplyTo',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'inbox_id' => 'setInboxId',
'name' => 'setName',
'field' => 'setField',
'match' => 'setMatch',
'reply_to' => 'setReplyTo',
'subject' => 'setSubject',
'from' => 'setFrom',
'charset' => 'setCharset',
'is_html' => 'setIsHtml',
'template_id' => 'setTemplateId',
'template_variables' => 'setTemplateVariables',
'ignore_reply_to' => 'setIgnoreReplyTo',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'inbox_id' => 'getInboxId',
'name' => 'getName',
'field' => 'getField',
'match' => 'getMatch',
'reply_to' => 'getReplyTo',
'subject' => 'getSubject',
'from' => 'getFrom',
'charset' => 'getCharset',
'is_html' => 'getIsHtml',
'template_id' => 'getTemplateId',
'template_variables' => 'getTemplateVariables',
'ignore_reply_to' => 'getIgnoreReplyTo',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FIELD_RECIPIENTS = 'RECIPIENTS';
public const FIELD_SENDER = 'SENDER';
public const FIELD_SUBJECT = 'SUBJECT';
public const FIELD_ATTACHMENTS = 'ATTACHMENTS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFieldAllowableValues()
{
return [
self::FIELD_RECIPIENTS,
self::FIELD_SENDER,
self::FIELD_SUBJECT,
self::FIELD_ATTACHMENTS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('field', $data ?? [], null);
$this->setIfExists('match', $data ?? [], null);
$this->setIfExists('reply_to', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('template_id', $data ?? [], null);
$this->setIfExists('template_variables', $data ?? [], null);
$this->setIfExists('ignore_reply_to', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['field'] === null) {
$invalidProperties[] = "'field' can't be null";
}
$allowedValues = $this->getFieldAllowableValues();
if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'field', must be one of '%s'",
$this->container['field'],
implode("', '", $allowedValues)
);
}
if ($this->container['match'] === null) {
$invalidProperties[] = "'match' can't be null";
}
if ($this->container['is_html'] === null) {
$invalidProperties[] = "'is_html' can't be null";
}
if ($this->container['ignore_reply_to'] === null) {
$invalidProperties[] = "'ignore_reply_to' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets field
*
* @return string
*/
public function getField()
{
return $this->container['field'];
}
/**
* Sets field
*
* @param string $field field
*
* @return self
*/
public function setField($field)
{
$allowedValues = $this->getFieldAllowableValues();
if (!in_array($field, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'field', must be one of '%s'",
$field,
implode("', '", $allowedValues)
)
);
}
if (is_null($field)) {
throw new \InvalidArgumentException('non-nullable field cannot be null');
}
$this->container['field'] = $field;
return $this;
}
/**
* Gets match
*
* @return string
*/
public function getMatch()
{
return $this->container['match'];
}
/**
* Sets match
*
* @param string $match match
*
* @return self
*/
public function setMatch($match)
{
if (is_null($match)) {
throw new \InvalidArgumentException('non-nullable match cannot be null');
}
$this->container['match'] = $match;
return $this;
}
/**
* Gets reply_to
*
* @return string|null
*/
public function getReplyTo()
{
return $this->container['reply_to'];
}
/**
* Sets reply_to
*
* @param string|null $reply_to reply_to
*
* @return self
*/
public function setReplyTo($reply_to)
{
if (is_null($reply_to)) {
array_push($this->openAPINullablesSetToNull, 'reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reply_to'] = $reply_to;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from from
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset charset
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets is_html
*
* @return bool
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool $is_html is_html
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
throw new \InvalidArgumentException('non-nullable is_html cannot be null');
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets template_id
*
* @return string|null
*/
public function getTemplateId()
{
return $this->container['template_id'];
}
/**
* Sets template_id
*
* @param string|null $template_id template_id
*
* @return self
*/
public function setTemplateId($template_id)
{
if (is_null($template_id)) {
array_push($this->openAPINullablesSetToNull, 'template_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_id'] = $template_id;
return $this;
}
/**
* Gets template_variables
*
* @return array<string,object>|null
*/
public function getTemplateVariables()
{
return $this->container['template_variables'];
}
/**
* Sets template_variables
*
* @param array<string,object>|null $template_variables template_variables
*
* @return self
*/
public function setTemplateVariables($template_variables)
{
if (is_null($template_variables)) {
array_push($this->openAPINullablesSetToNull, 'template_variables');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_variables', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_variables'] = $template_variables;
return $this;
}
/**
* Gets ignore_reply_to
*
* @return bool
*/
public function getIgnoreReplyTo()
{
return $this->container['ignore_reply_to'];
}
/**
* Sets ignore_reply_to
*
* @param bool $ignore_reply_to ignore_reply_to
*
* @return self
*/
public function setIgnoreReplyTo($ignore_reply_to)
{
if (is_null($ignore_reply_to)) {
throw new \InvalidArgumentException('non-nullable ignore_reply_to cannot be null');
}
$this->container['ignore_reply_to'] = $ignore_reply_to;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxPreview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxPreview Class Doc Comment
*
* @category Class
* @description Inbox data preview element.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxPreview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxPreview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'domain_id' => 'string',
'email_address' => 'string',
'created_at' => '\DateTime',
'favourite' => 'bool',
'name' => 'string',
'tags' => 'string[]',
'team_access' => 'bool',
'inbox_type' => 'string',
'virtual_inbox' => 'bool',
'expires_at' => 'string',
'functions_as' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'domain_id' => 'uuid',
'email_address' => null,
'created_at' => 'date-time',
'favourite' => null,
'name' => null,
'tags' => null,
'team_access' => null,
'inbox_type' => null,
'virtual_inbox' => null,
'expires_at' => null,
'functions_as' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'domain_id' => true,
'email_address' => true,
'created_at' => false,
'favourite' => false,
'name' => true,
'tags' => true,
'team_access' => false,
'inbox_type' => true,
'virtual_inbox' => false,
'expires_at' => true,
'functions_as' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'domain_id' => 'domainId',
'email_address' => 'emailAddress',
'created_at' => 'createdAt',
'favourite' => 'favourite',
'name' => 'name',
'tags' => 'tags',
'team_access' => 'teamAccess',
'inbox_type' => 'inboxType',
'virtual_inbox' => 'virtualInbox',
'expires_at' => 'expiresAt',
'functions_as' => 'functionsAs'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'domain_id' => 'setDomainId',
'email_address' => 'setEmailAddress',
'created_at' => 'setCreatedAt',
'favourite' => 'setFavourite',
'name' => 'setName',
'tags' => 'setTags',
'team_access' => 'setTeamAccess',
'inbox_type' => 'setInboxType',
'virtual_inbox' => 'setVirtualInbox',
'expires_at' => 'setExpiresAt',
'functions_as' => 'setFunctionsAs'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'domain_id' => 'getDomainId',
'email_address' => 'getEmailAddress',
'created_at' => 'getCreatedAt',
'favourite' => 'getFavourite',
'name' => 'getName',
'tags' => 'getTags',
'team_access' => 'getTeamAccess',
'inbox_type' => 'getInboxType',
'virtual_inbox' => 'getVirtualInbox',
'expires_at' => 'getExpiresAt',
'functions_as' => 'getFunctionsAs'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX';
public const FUNCTIONS_AS_ALIAS = 'ALIAS';
public const FUNCTIONS_AS_THREAD = 'THREAD';
public const FUNCTIONS_AS_CATCH_ALL = 'CATCH_ALL';
public const FUNCTIONS_AS_CONNECTOR = 'CONNECTOR';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getInboxTypeAllowableValues()
{
return [
self::INBOX_TYPE_HTTP_INBOX,
self::INBOX_TYPE_SMTP_INBOX,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFunctionsAsAllowableValues()
{
return [
self::FUNCTIONS_AS_ALIAS,
self::FUNCTIONS_AS_THREAD,
self::FUNCTIONS_AS_CATCH_ALL,
self::FUNCTIONS_AS_CONNECTOR,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('favourite', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('team_access', $data ?? [], null);
$this->setIfExists('inbox_type', $data ?? [], null);
$this->setIfExists('virtual_inbox', $data ?? [], null);
$this->setIfExists('expires_at', $data ?? [], null);
$this->setIfExists('functions_as', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['favourite'] === null) {
$invalidProperties[] = "'favourite' can't be null";
}
if ($this->container['team_access'] === null) {
$invalidProperties[] = "'team_access' can't be null";
}
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'inbox_type', must be one of '%s'",
$this->container['inbox_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['virtual_inbox'] === null) {
$invalidProperties[] = "'virtual_inbox' can't be null";
}
$allowedValues = $this->getFunctionsAsAllowableValues();
if (!is_null($this->container['functions_as']) && !in_array($this->container['functions_as'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'functions_as', must be one of '%s'",
$this->container['functions_as'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically.
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id ID of custom domain used by the inbox if any
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets email_address
*
* @return string|null
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string|null $email_address The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID.
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
array_push($this->openAPINullablesSetToNull, 'email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`.
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets favourite
*
* @return bool
*/
public function getFavourite()
{
return $this->container['favourite'];
}
/**
* Sets favourite
*
* @param bool $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering
*
* @return self
*/
public function setFavourite($favourite)
{
if (is_null($favourite)) {
throw new \InvalidArgumentException('non-nullable favourite cannot be null');
}
$this->container['favourite'] = $favourite;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets tags
*
* @return string[]|null
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
array_push($this->openAPINullablesSetToNull, 'tags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('tags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets team_access
*
* @return bool
*/
public function getTeamAccess()
{
return $this->container['team_access'];
}
/**
* Sets team_access
*
* @param bool $team_access Does inbox permit team access for organization team members. If so team users can use inbox and emails associated with it. See the team access guide at https://www.mailslurp.com/guides/team-email-account-sharing/
*
* @return self
*/
public function setTeamAccess($team_access)
{
if (is_null($team_access)) {
throw new \InvalidArgumentException('non-nullable team_access cannot be null');
}
$this->container['team_access'] = $team_access;
return $this;
}
/**
* Gets inbox_type
*
* @return string|null
*/
public function getInboxType()
{
return $this->container['inbox_type'];
}
/**
* Sets inbox_type
*
* @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).
*
* @return self
*/
public function setInboxType($inbox_type)
{
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'inbox_type', must be one of '%s'",
$inbox_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($inbox_type)) {
array_push($this->openAPINullablesSetToNull, 'inbox_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_type'] = $inbox_type;
return $this;
}
/**
* Gets virtual_inbox
*
* @return bool
*/
public function getVirtualInbox()
{
return $this->container['virtual_inbox'];
}
/**
* Sets virtual_inbox
*
* @param bool $virtual_inbox Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions.
*
* @return self
*/
public function setVirtualInbox($virtual_inbox)
{
if (is_null($virtual_inbox)) {
throw new \InvalidArgumentException('non-nullable virtual_inbox cannot be null');
}
$this->container['virtual_inbox'] = $virtual_inbox;
return $this;
}
/**
* Gets expires_at
*
* @return string|null
*/
public function getExpiresAt()
{
return $this->container['expires_at'];
}
/**
* Sets expires_at
*
* @param string|null $expires_at Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email.
*
* @return self
*/
public function setExpiresAt($expires_at)
{
if (is_null($expires_at)) {
array_push($this->openAPINullablesSetToNull, 'expires_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('expires_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['expires_at'] = $expires_at;
return $this;
}
/**
* Gets functions_as
*
* @return string|null
*/
public function getFunctionsAs()
{
return $this->container['functions_as'];
}
/**
* Sets functions_as
*
* @param string|null $functions_as Inbox function if used as a primitive for another system.
*
* @return self
*/
public function setFunctionsAs($functions_as)
{
$allowedValues = $this->getFunctionsAsAllowableValues();
if (!is_null($functions_as) && !in_array($functions_as, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'functions_as', must be one of '%s'",
$functions_as,
implode("', '", $allowedValues)
)
);
}
if (is_null($functions_as)) {
array_push($this->openAPINullablesSetToNull, 'functions_as');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('functions_as', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['functions_as'] = $functions_as;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxIdsResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxIdsResult Class Doc Comment
*
* @category Class
* @description List of inbox IDs and email addresses
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxIdsResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxIdsResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_ids' => '\MailSlurp\Models\InboxIdItem[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_ids' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_ids' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_ids' => 'inboxIds'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_ids' => 'setInboxIds'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_ids' => 'getInboxIds'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_ids', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_ids'] === null) {
$invalidProperties[] = "'inbox_ids' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_ids
*
* @return \MailSlurp\Models\InboxIdItem[]
*/
public function getInboxIds()
{
return $this->container['inbox_ids'];
}
/**
* Sets inbox_ids
*
* @param \MailSlurp\Models\InboxIdItem[] $inbox_ids inbox_ids
*
* @return self
*/
public function setInboxIds($inbox_ids)
{
if (is_null($inbox_ids)) {
throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null');
}
$this->container['inbox_ids'] = $inbox_ids;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxIdItem
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxIdItem Class Doc Comment
*
* @category Class
* @description Inbox ID and email address pair
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxIdItem implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxIdItem';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'email_address' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'email_address' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'email_address' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'email_address' => 'emailAddress'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'email_address' => 'setEmailAddress'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'email_address' => 'getEmailAddress'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxForwarderTestResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxForwarderTestResult Class Doc Comment
*
* @category Class
* @description Results of inbox forwarder test
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxForwarderTestResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxForwarderTestResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'matches' => 'array<string,bool>',
'does_match' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'matches' => null,
'does_match' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'matches' => false,
'does_match' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'matches' => 'matches',
'does_match' => 'doesMatch'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'matches' => 'setMatches',
'does_match' => 'setDoesMatch'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'matches' => 'getMatches',
'does_match' => 'getDoesMatch'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('matches', $data ?? [], null);
$this->setIfExists('does_match', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['matches'] === null) {
$invalidProperties[] = "'matches' can't be null";
}
if ($this->container['does_match'] === null) {
$invalidProperties[] = "'does_match' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets matches
*
* @return array<string,bool>
*/
public function getMatches()
{
return $this->container['matches'];
}
/**
* Sets matches
*
* @param array<string,bool> $matches matches
*
* @return self
*/
public function setMatches($matches)
{
if (is_null($matches)) {
throw new \InvalidArgumentException('non-nullable matches cannot be null');
}
$this->container['matches'] = $matches;
return $this;
}
/**
* Gets does_match
*
* @return bool
*/
public function getDoesMatch()
{
return $this->container['does_match'];
}
/**
* Sets does_match
*
* @param bool $does_match does_match
*
* @return self
*/
public function setDoesMatch($does_match)
{
if (is_null($does_match)) {
throw new \InvalidArgumentException('non-nullable does_match cannot be null');
}
$this->container['does_match'] = $does_match;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxForwarderTestOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxForwarderTestOptions Class Doc Comment
*
* @category Class
* @description Options for testing an inbox forwarder against a value
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxForwarderTestOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxForwarderTestOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'test_value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'test_value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'test_value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'test_value' => 'testValue'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'test_value' => 'setTestValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'test_value' => 'getTestValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('test_value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['test_value'] === null) {
$invalidProperties[] = "'test_value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets test_value
*
* @return string
*/
public function getTestValue()
{
return $this->container['test_value'];
}
/**
* Sets test_value
*
* @param string $test_value test_value
*
* @return self
*/
public function setTestValue($test_value)
{
if (is_null($test_value)) {
throw new \InvalidArgumentException('non-nullable test_value cannot be null');
}
$this->container['test_value'] = $test_value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxForwarderEventProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxForwarderEventProjection Class Doc Comment
*
* @category Class
* @description Inbox forwarder event
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxForwarderEventProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxForwarderEventProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'email_id' => 'string',
'inbox_id' => 'string',
'user_id' => 'string',
'forwarder_id' => 'string',
'message' => 'string',
'id' => 'string',
'status' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'email_id' => 'uuid',
'inbox_id' => 'uuid',
'user_id' => 'uuid',
'forwarder_id' => 'uuid',
'message' => null,
'id' => 'uuid',
'status' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'email_id' => true,
'inbox_id' => true,
'user_id' => true,
'forwarder_id' => true,
'message' => true,
'id' => true,
'status' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'email_id' => 'emailId',
'inbox_id' => 'inboxId',
'user_id' => 'userId',
'forwarder_id' => 'forwarderId',
'message' => 'message',
'id' => 'id',
'status' => 'status'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'email_id' => 'setEmailId',
'inbox_id' => 'setInboxId',
'user_id' => 'setUserId',
'forwarder_id' => 'setForwarderId',
'message' => 'setMessage',
'id' => 'setId',
'status' => 'setStatus'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'email_id' => 'getEmailId',
'inbox_id' => 'getInboxId',
'user_id' => 'getUserId',
'forwarder_id' => 'getForwarderId',
'message' => 'getMessage',
'id' => 'getId',
'status' => 'getStatus'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_SUCCESS = 'SUCCESS';
public const STATUS_FAILURE = 'FAILURE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_SUCCESS,
self::STATUS_FAILURE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('email_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('forwarder_id', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets email_id
*
* @return string|null
*/
public function getEmailId()
{
return $this->container['email_id'];
}
/**
* Sets email_id
*
* @param string|null $email_id email_id
*
* @return self
*/
public function setEmailId($email_id)
{
if (is_null($email_id)) {
array_push($this->openAPINullablesSetToNull, 'email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_id'] = $email_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
array_push($this->openAPINullablesSetToNull, 'user_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('user_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets forwarder_id
*
* @return string|null
*/
public function getForwarderId()
{
return $this->container['forwarder_id'];
}
/**
* Sets forwarder_id
*
* @param string|null $forwarder_id forwarder_id
*
* @return self
*/
public function setForwarderId($forwarder_id)
{
if (is_null($forwarder_id)) {
array_push($this->openAPINullablesSetToNull, 'forwarder_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('forwarder_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['forwarder_id'] = $forwarder_id;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
array_push($this->openAPINullablesSetToNull, 'id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets status
*
* @return string|null
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string|null $status status
*
* @return self
*/
public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($status) && !in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
if (is_null($status)) {
array_push($this->openAPINullablesSetToNull, 'status');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('status', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['status'] = $status;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxForwarderEventDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxForwarderEventDto Class Doc Comment
*
* @category Class
* @description Inbox forwarder event. Describes how an email was handled by an inbox forwarder.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxForwarderEventDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxForwarderEventDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'inbox_id' => 'string',
'email_id' => 'string',
'user_id' => 'string',
'forwarder_id' => 'string',
'message' => 'string',
'status' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'inbox_id' => 'uuid',
'email_id' => 'uuid',
'user_id' => 'uuid',
'forwarder_id' => 'uuid',
'message' => null,
'status' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => true,
'inbox_id' => true,
'email_id' => true,
'user_id' => true,
'forwarder_id' => true,
'message' => true,
'status' => true,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'inbox_id' => 'inboxId',
'email_id' => 'emailId',
'user_id' => 'userId',
'forwarder_id' => 'forwarderId',
'message' => 'message',
'status' => 'status',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'inbox_id' => 'setInboxId',
'email_id' => 'setEmailId',
'user_id' => 'setUserId',
'forwarder_id' => 'setForwarderId',
'message' => 'setMessage',
'status' => 'setStatus',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'inbox_id' => 'getInboxId',
'email_id' => 'getEmailId',
'user_id' => 'getUserId',
'forwarder_id' => 'getForwarderId',
'message' => 'getMessage',
'status' => 'getStatus',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_SUCCESS = 'SUCCESS';
public const STATUS_FAILURE = 'FAILURE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_SUCCESS,
self::STATUS_FAILURE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('email_id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('forwarder_id', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
array_push($this->openAPINullablesSetToNull, 'id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets email_id
*
* @return string|null
*/
public function getEmailId()
{
return $this->container['email_id'];
}
/**
* Sets email_id
*
* @param string|null $email_id email_id
*
* @return self
*/
public function setEmailId($email_id)
{
if (is_null($email_id)) {
array_push($this->openAPINullablesSetToNull, 'email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_id'] = $email_id;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
array_push($this->openAPINullablesSetToNull, 'user_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('user_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets forwarder_id
*
* @return string|null
*/
public function getForwarderId()
{
return $this->container['forwarder_id'];
}
/**
* Sets forwarder_id
*
* @param string|null $forwarder_id forwarder_id
*
* @return self
*/
public function setForwarderId($forwarder_id)
{
if (is_null($forwarder_id)) {
array_push($this->openAPINullablesSetToNull, 'forwarder_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('forwarder_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['forwarder_id'] = $forwarder_id;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets status
*
* @return string|null
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string|null $status status
*
* @return self
*/
public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($status) && !in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
if (is_null($status)) {
array_push($this->openAPINullablesSetToNull, 'status');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('status', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxForwarderDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxForwarderDto Class Doc Comment
*
* @category Class
* @description Inbox forwarder. Describes how an inbox will forward matching emails to designated recipients.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxForwarderDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxForwarderDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'inbox_id' => 'string',
'name' => 'string',
'field' => 'string',
'match' => 'string',
'forward_to_recipients' => 'string[]',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'inbox_id' => 'uuid',
'name' => null,
'field' => null,
'match' => null,
'forward_to_recipients' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'inbox_id' => false,
'name' => true,
'field' => false,
'match' => false,
'forward_to_recipients' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'inbox_id' => 'inboxId',
'name' => 'name',
'field' => 'field',
'match' => 'match',
'forward_to_recipients' => 'forwardToRecipients',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'inbox_id' => 'setInboxId',
'name' => 'setName',
'field' => 'setField',
'match' => 'setMatch',
'forward_to_recipients' => 'setForwardToRecipients',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'inbox_id' => 'getInboxId',
'name' => 'getName',
'field' => 'getField',
'match' => 'getMatch',
'forward_to_recipients' => 'getForwardToRecipients',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FIELD_RECIPIENTS = 'RECIPIENTS';
public const FIELD_SENDER = 'SENDER';
public const FIELD_SUBJECT = 'SUBJECT';
public const FIELD_ATTACHMENTS = 'ATTACHMENTS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFieldAllowableValues()
{
return [
self::FIELD_RECIPIENTS,
self::FIELD_SENDER,
self::FIELD_SUBJECT,
self::FIELD_ATTACHMENTS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('field', $data ?? [], null);
$this->setIfExists('match', $data ?? [], null);
$this->setIfExists('forward_to_recipients', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['field'] === null) {
$invalidProperties[] = "'field' can't be null";
}
$allowedValues = $this->getFieldAllowableValues();
if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'field', must be one of '%s'",
$this->container['field'],
implode("', '", $allowedValues)
);
}
if ($this->container['match'] === null) {
$invalidProperties[] = "'match' can't be null";
}
if ($this->container['forward_to_recipients'] === null) {
$invalidProperties[] = "'forward_to_recipients' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of inbox forwarder
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets field
*
* @return string
*/
public function getField()
{
return $this->container['field'];
}
/**
* Sets field
*
* @param string $field Which field to match against
*
* @return self
*/
public function setField($field)
{
$allowedValues = $this->getFieldAllowableValues();
if (!in_array($field, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'field', must be one of '%s'",
$field,
implode("', '", $allowedValues)
)
);
}
if (is_null($field)) {
throw new \InvalidArgumentException('non-nullable field cannot be null');
}
$this->container['field'] = $field;
return $this;
}
/**
* Gets match
*
* @return string
*/
public function getMatch()
{
return $this->container['match'];
}
/**
* Sets match
*
* @param string $match Wild-card type pattern to apply to field
*
* @return self
*/
public function setMatch($match)
{
if (is_null($match)) {
throw new \InvalidArgumentException('non-nullable match cannot be null');
}
$this->container['match'] = $match;
return $this;
}
/**
* Gets forward_to_recipients
*
* @return string[]
*/
public function getForwardToRecipients()
{
return $this->container['forward_to_recipients'];
}
/**
* Sets forward_to_recipients
*
* @param string[] $forward_to_recipients Who to send forwarded email to
*
* @return self
*/
public function setForwardToRecipients($forward_to_recipients)
{
if (is_null($forward_to_recipients)) {
throw new \InvalidArgumentException('non-nullable forward_to_recipients cannot be null');
}
$this->container['forward_to_recipients'] = $forward_to_recipients;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxExistsDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxExistsDto Class Doc Comment
*
* @category Class
* @description Result of email exists query
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxExistsDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxExistsDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'exists' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'exists' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'exists' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'exists' => 'exists'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'exists' => 'setExists'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'exists' => 'getExists'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('exists', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['exists'] === null) {
$invalidProperties[] = "'exists' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets exists
*
* @return bool
*/
public function getExists()
{
return $this->container['exists'];
}
/**
* Sets exists
*
* @param bool $exists exists
*
* @return self
*/
public function setExists($exists)
{
if (is_null($exists)) {
throw new \InvalidArgumentException('non-nullable exists cannot be null');
}
$this->container['exists'] = $exists;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxDto Class Doc Comment
*
* @category Class
* @description Representation of a MailSlurp inbox. An inbox has an ID and a real email address. Emails can be sent to or from this email address. Inboxes are either `SMTP` or `HTTP` mailboxes. The default, `HTTP` inboxes, use AWS SES to process emails and are best suited as test email accounts and do not support IMAP or POP3. `SMTP` inboxes use a custom mail server at `mxslurp.click` and support SMTP login, IMAP and POP3. Use the `EmailController` or the `InboxController` methods to send and receive emails and attachments. Inboxes may have a description, name, and tags for display purposes. You can also favourite an inbox for easier searching.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'created_at' => '\DateTime',
'name' => 'string',
'domain_id' => 'string',
'description' => 'string',
'email_address' => 'string',
'expires_at' => 'string',
'favourite' => 'bool',
'tags' => 'string[]',
'inbox_type' => 'string',
'read_only' => 'bool',
'virtual_inbox' => 'bool',
'functions_as' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'created_at' => 'date-time',
'name' => null,
'domain_id' => 'uuid',
'description' => null,
'email_address' => null,
'expires_at' => null,
'favourite' => null,
'tags' => null,
'inbox_type' => null,
'read_only' => null,
'virtual_inbox' => null,
'functions_as' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => true,
'created_at' => false,
'name' => true,
'domain_id' => true,
'description' => true,
'email_address' => false,
'expires_at' => true,
'favourite' => false,
'tags' => true,
'inbox_type' => true,
'read_only' => false,
'virtual_inbox' => false,
'functions_as' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'created_at' => 'createdAt',
'name' => 'name',
'domain_id' => 'domainId',
'description' => 'description',
'email_address' => 'emailAddress',
'expires_at' => 'expiresAt',
'favourite' => 'favourite',
'tags' => 'tags',
'inbox_type' => 'inboxType',
'read_only' => 'readOnly',
'virtual_inbox' => 'virtualInbox',
'functions_as' => 'functionsAs'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'created_at' => 'setCreatedAt',
'name' => 'setName',
'domain_id' => 'setDomainId',
'description' => 'setDescription',
'email_address' => 'setEmailAddress',
'expires_at' => 'setExpiresAt',
'favourite' => 'setFavourite',
'tags' => 'setTags',
'inbox_type' => 'setInboxType',
'read_only' => 'setReadOnly',
'virtual_inbox' => 'setVirtualInbox',
'functions_as' => 'setFunctionsAs'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'created_at' => 'getCreatedAt',
'name' => 'getName',
'domain_id' => 'getDomainId',
'description' => 'getDescription',
'email_address' => 'getEmailAddress',
'expires_at' => 'getExpiresAt',
'favourite' => 'getFavourite',
'tags' => 'getTags',
'inbox_type' => 'getInboxType',
'read_only' => 'getReadOnly',
'virtual_inbox' => 'getVirtualInbox',
'functions_as' => 'getFunctionsAs'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX';
public const FUNCTIONS_AS_ALIAS = 'ALIAS';
public const FUNCTIONS_AS_THREAD = 'THREAD';
public const FUNCTIONS_AS_CATCH_ALL = 'CATCH_ALL';
public const FUNCTIONS_AS_CONNECTOR = 'CONNECTOR';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getInboxTypeAllowableValues()
{
return [
self::INBOX_TYPE_HTTP_INBOX,
self::INBOX_TYPE_SMTP_INBOX,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFunctionsAsAllowableValues()
{
return [
self::FUNCTIONS_AS_ALIAS,
self::FUNCTIONS_AS_THREAD,
self::FUNCTIONS_AS_CATCH_ALL,
self::FUNCTIONS_AS_CONNECTOR,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('expires_at', $data ?? [], null);
$this->setIfExists('favourite', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('inbox_type', $data ?? [], null);
$this->setIfExists('read_only', $data ?? [], null);
$this->setIfExists('virtual_inbox', $data ?? [], null);
$this->setIfExists('functions_as', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['favourite'] === null) {
$invalidProperties[] = "'favourite' can't be null";
}
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'inbox_type', must be one of '%s'",
$this->container['inbox_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['read_only'] === null) {
$invalidProperties[] = "'read_only' can't be null";
}
if ($this->container['virtual_inbox'] === null) {
$invalidProperties[] = "'virtual_inbox' can't be null";
}
$allowedValues = $this->getFunctionsAsAllowableValues();
if (!is_null($this->container['functions_as']) && !in_array($this->container['functions_as'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'functions_as', must be one of '%s'",
$this->container['functions_as'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of the inbox. The ID is a UUID-V4 format string. Use the inboxId for calls to Inbox and Email Controller endpoints. See the emailAddress property for the email address or the inbox. To get emails in an inbox use the WaitFor and Inbox Controller methods `waitForLatestEmail` and `getEmails` methods respectively. Inboxes can be used with aliases to forward emails automatically.
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id ID of user that inbox belongs to
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
array_push($this->openAPINullablesSetToNull, 'user_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('user_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at When the inbox was created. Time stamps are in ISO DateTime Format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX` e.g. `2000-10-31T01:30:00.000-05:00`.
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of the inbox and used as the sender name when sending emails .Displayed in the dashboard for easier search
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id ID of custom domain used by the inbox if any
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description Description of an inbox for labelling and searching purposes
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
array_push($this->openAPINullablesSetToNull, 'description');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('description', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['description'] = $description;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address The inbox's email address. Inbox projections and previews may not include the email address. To view the email address fetch the inbox entity directly. Send an email to this address and the inbox will receive and store it for you. Note the email address in MailSlurp match characters exactly and are case sensitive so `+123` additions are considered different addresses. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID.
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets expires_at
*
* @return string|null
*/
public function getExpiresAt()
{
return $this->container['expires_at'];
}
/**
* Sets expires_at
*
* @param string|null $expires_at Inbox expiration time. When, if ever, the inbox should expire and be deleted. If null then this inbox is permanent and the emails in it won't be deleted. This is the default behavior unless expiration date is set. If an expiration date is set and the time is reached MailSlurp will expire the inbox and move it to an expired inbox entity. You can still access the emails belonging to it but it can no longer send or receive email.
*
* @return self
*/
public function setExpiresAt($expires_at)
{
if (is_null($expires_at)) {
array_push($this->openAPINullablesSetToNull, 'expires_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('expires_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['expires_at'] = $expires_at;
return $this;
}
/**
* Gets favourite
*
* @return bool
*/
public function getFavourite()
{
return $this->container['favourite'];
}
/**
* Sets favourite
*
* @param bool $favourite Is the inbox a favorite inbox. Make an inbox a favorite is typically done in the dashboard for quick access or filtering
*
* @return self
*/
public function setFavourite($favourite)
{
if (is_null($favourite)) {
throw new \InvalidArgumentException('non-nullable favourite cannot be null');
}
$this->container['favourite'] = $favourite;
return $this;
}
/**
* Gets tags
*
* @return string[]|null
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
array_push($this->openAPINullablesSetToNull, 'tags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('tags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets inbox_type
*
* @return string|null
*/
public function getInboxType()
{
return $this->container['inbox_type'];
}
/**
* Sets inbox_type
*
* @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).
*
* @return self
*/
public function setInboxType($inbox_type)
{
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'inbox_type', must be one of '%s'",
$inbox_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($inbox_type)) {
array_push($this->openAPINullablesSetToNull, 'inbox_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_type'] = $inbox_type;
return $this;
}
/**
* Gets read_only
*
* @return bool
*/
public function getReadOnly()
{
return $this->container['read_only'];
}
/**
* Sets read_only
*
* @param bool $read_only Is the inbox readOnly for the caller. Read only means can not be deleted or modified. This flag is present when using team accounts and shared inboxes.
*
* @return self
*/
public function setReadOnly($read_only)
{
if (is_null($read_only)) {
throw new \InvalidArgumentException('non-nullable read_only cannot be null');
}
$this->container['read_only'] = $read_only;
return $this;
}
/**
* Gets virtual_inbox
*
* @return bool
*/
public function getVirtualInbox()
{
return $this->container['virtual_inbox'];
}
/**
* Sets virtual_inbox
*
* @param bool $virtual_inbox Virtual inbox can receive email but will not send emails to real recipients. Will save sent email record but never send an actual email. Perfect for testing mail server actions.
*
* @return self
*/
public function setVirtualInbox($virtual_inbox)
{
if (is_null($virtual_inbox)) {
throw new \InvalidArgumentException('non-nullable virtual_inbox cannot be null');
}
$this->container['virtual_inbox'] = $virtual_inbox;
return $this;
}
/**
* Gets functions_as
*
* @return string|null
*/
public function getFunctionsAs()
{
return $this->container['functions_as'];
}
/**
* Sets functions_as
*
* @param string|null $functions_as Inbox function if used as a primitive for another system.
*
* @return self
*/
public function setFunctionsAs($functions_as)
{
$allowedValues = $this->getFunctionsAsAllowableValues();
if (!is_null($functions_as) && !in_array($functions_as, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'functions_as', must be one of '%s'",
$functions_as,
implode("', '", $allowedValues)
)
);
}
if (is_null($functions_as)) {
array_push($this->openAPINullablesSetToNull, 'functions_as');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('functions_as', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['functions_as'] = $functions_as;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxByNameResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxByNameResult Class Doc Comment
*
* @category Class
* @description Result of search for inbox by name
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxByNameResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxByNameResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_id' => 'string',
'exists' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_id' => 'uuid',
'exists' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_id' => true,
'exists' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_id' => 'inboxId',
'exists' => 'exists'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_id' => 'setInboxId',
'exists' => 'setExists'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_id' => 'getInboxId',
'exists' => 'getExists'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('exists', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['exists'] === null) {
$invalidProperties[] = "'exists' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets exists
*
* @return bool
*/
public function getExists()
{
return $this->container['exists'];
}
/**
* Sets exists
*
* @param bool $exists exists
*
* @return self
*/
public function setExists($exists)
{
if (is_null($exists)) {
throw new \InvalidArgumentException('non-nullable exists cannot be null');
}
$this->container['exists'] = $exists;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* InboxByEmailAddressResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* InboxByEmailAddressResult Class Doc Comment
*
* @category Class
* @description Result of search for inbox by email address
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class InboxByEmailAddressResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'InboxByEmailAddressResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_id' => 'string',
'exists' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_id' => 'uuid',
'exists' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_id' => true,
'exists' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_id' => 'inboxId',
'exists' => 'exists'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_id' => 'setInboxId',
'exists' => 'setExists'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_id' => 'getInboxId',
'exists' => 'getExists'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('exists', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['exists'] === null) {
$invalidProperties[] = "'exists' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets exists
*
* @return bool
*/
public function getExists()
{
return $this->container['exists'];
}
/**
* Sets exists
*
* @param bool $exists exists
*
* @return self
*/
public function setExists($exists)
{
if (is_null($exists)) {
throw new \InvalidArgumentException('non-nullable exists cannot be null');
}
$this->container['exists'] = $exists;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapUpdateFlagsOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapUpdateFlagsOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapUpdateFlagsOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapUpdateFlagsOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'operation' => 'string',
'flags' => 'string[]',
'uid_set' => 'string',
'seq_set' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'operation' => null,
'flags' => null,
'uid_set' => null,
'seq_set' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'operation' => false,
'flags' => true,
'uid_set' => true,
'seq_set' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'operation' => 'operation',
'flags' => 'flags',
'uid_set' => 'uidSet',
'seq_set' => 'seqSet'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'operation' => 'setOperation',
'flags' => 'setFlags',
'uid_set' => 'setUidSet',
'seq_set' => 'setSeqSet'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'operation' => 'getOperation',
'flags' => 'getFlags',
'uid_set' => 'getUidSet',
'seq_set' => 'getSeqSet'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('operation', $data ?? [], null);
$this->setIfExists('flags', $data ?? [], null);
$this->setIfExists('uid_set', $data ?? [], null);
$this->setIfExists('seq_set', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['operation'] === null) {
$invalidProperties[] = "'operation' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets operation
*
* @return string
*/
public function getOperation()
{
return $this->container['operation'];
}
/**
* Sets operation
*
* @param string $operation operation
*
* @return self
*/
public function setOperation($operation)
{
if (is_null($operation)) {
throw new \InvalidArgumentException('non-nullable operation cannot be null');
}
$this->container['operation'] = $operation;
return $this;
}
/**
* Gets flags
*
* @return string[]|null
*/
public function getFlags()
{
return $this->container['flags'];
}
/**
* Sets flags
*
* @param string[]|null $flags flags
*
* @return self
*/
public function setFlags($flags)
{
if (is_null($flags)) {
array_push($this->openAPINullablesSetToNull, 'flags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('flags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['flags'] = $flags;
return $this;
}
/**
* Gets uid_set
*
* @return string|null
*/
public function getUidSet()
{
return $this->container['uid_set'];
}
/**
* Sets uid_set
*
* @param string|null $uid_set uid_set
*
* @return self
*/
public function setUidSet($uid_set)
{
if (is_null($uid_set)) {
array_push($this->openAPINullablesSetToNull, 'uid_set');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('uid_set', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['uid_set'] = $uid_set;
return $this;
}
/**
* Gets seq_set
*
* @return string|null
*/
public function getSeqSet()
{
return $this->container['seq_set'];
}
/**
* Sets seq_set
*
* @param string|null $seq_set seq_set
*
* @return self
*/
public function setSeqSet($seq_set)
{
if (is_null($seq_set)) {
array_push($this->openAPINullablesSetToNull, 'seq_set');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('seq_set', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['seq_set'] = $seq_set;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapSmtpAccessServers
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapSmtpAccessServers Class Doc Comment
*
* @category Class
* @description IMAP and SMTP server endpoints for MailSlurp
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapSmtpAccessServers implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapSmtpAccessServers';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'imap_server' => '\MailSlurp\Models\ServerEndpoints',
'secure_imap_server' => '\MailSlurp\Models\ServerEndpoints',
'smtp_server' => '\MailSlurp\Models\ServerEndpoints',
'secure_smtp_server' => '\MailSlurp\Models\ServerEndpoints'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'imap_server' => null,
'secure_imap_server' => null,
'smtp_server' => null,
'secure_smtp_server' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'imap_server' => false,
'secure_imap_server' => false,
'smtp_server' => false,
'secure_smtp_server' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'imap_server' => 'imapServer',
'secure_imap_server' => 'secureImapServer',
'smtp_server' => 'smtpServer',
'secure_smtp_server' => 'secureSmtpServer'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'imap_server' => 'setImapServer',
'secure_imap_server' => 'setSecureImapServer',
'smtp_server' => 'setSmtpServer',
'secure_smtp_server' => 'setSecureSmtpServer'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'imap_server' => 'getImapServer',
'secure_imap_server' => 'getSecureImapServer',
'smtp_server' => 'getSmtpServer',
'secure_smtp_server' => 'getSecureSmtpServer'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('imap_server', $data ?? [], null);
$this->setIfExists('secure_imap_server', $data ?? [], null);
$this->setIfExists('smtp_server', $data ?? [], null);
$this->setIfExists('secure_smtp_server', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['imap_server'] === null) {
$invalidProperties[] = "'imap_server' can't be null";
}
if ($this->container['secure_imap_server'] === null) {
$invalidProperties[] = "'secure_imap_server' can't be null";
}
if ($this->container['smtp_server'] === null) {
$invalidProperties[] = "'smtp_server' can't be null";
}
if ($this->container['secure_smtp_server'] === null) {
$invalidProperties[] = "'secure_smtp_server' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets imap_server
*
* @return \MailSlurp\Models\ServerEndpoints
*/
public function getImapServer()
{
return $this->container['imap_server'];
}
/**
* Sets imap_server
*
* @param \MailSlurp\Models\ServerEndpoints $imap_server imap_server
*
* @return self
*/
public function setImapServer($imap_server)
{
if (is_null($imap_server)) {
throw new \InvalidArgumentException('non-nullable imap_server cannot be null');
}
$this->container['imap_server'] = $imap_server;
return $this;
}
/**
* Gets secure_imap_server
*
* @return \MailSlurp\Models\ServerEndpoints
*/
public function getSecureImapServer()
{
return $this->container['secure_imap_server'];
}
/**
* Sets secure_imap_server
*
* @param \MailSlurp\Models\ServerEndpoints $secure_imap_server secure_imap_server
*
* @return self
*/
public function setSecureImapServer($secure_imap_server)
{
if (is_null($secure_imap_server)) {
throw new \InvalidArgumentException('non-nullable secure_imap_server cannot be null');
}
$this->container['secure_imap_server'] = $secure_imap_server;
return $this;
}
/**
* Gets smtp_server
*
* @return \MailSlurp\Models\ServerEndpoints
*/
public function getSmtpServer()
{
return $this->container['smtp_server'];
}
/**
* Sets smtp_server
*
* @param \MailSlurp\Models\ServerEndpoints $smtp_server smtp_server
*
* @return self
*/
public function setSmtpServer($smtp_server)
{
if (is_null($smtp_server)) {
throw new \InvalidArgumentException('non-nullable smtp_server cannot be null');
}
$this->container['smtp_server'] = $smtp_server;
return $this;
}
/**
* Gets secure_smtp_server
*
* @return \MailSlurp\Models\ServerEndpoints
*/
public function getSecureSmtpServer()
{
return $this->container['secure_smtp_server'];
}
/**
* Sets secure_smtp_server
*
* @param \MailSlurp\Models\ServerEndpoints $secure_smtp_server secure_smtp_server
*
* @return self
*/
public function setSecureSmtpServer($secure_smtp_server)
{
if (is_null($secure_smtp_server)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_server cannot be null');
}
$this->container['secure_smtp_server'] = $secure_smtp_server;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapSmtpAccessDetails
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapSmtpAccessDetails Class Doc Comment
*
* @category Class
* @description Access details for inbox using SMTP or IMAP
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapSmtpAccessDetails implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapSmtpAccessDetails';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'secure_smtp_server_host' => 'string',
'secure_smtp_server_port' => 'int',
'secure_smtp_username' => 'string',
'secure_smtp_password' => 'string',
'smtp_server_host' => 'string',
'smtp_server_port' => 'int',
'smtp_username' => 'string',
'smtp_password' => 'string',
'secure_imap_server_host' => 'string',
'secure_imap_server_port' => 'int',
'secure_imap_username' => 'string',
'secure_imap_password' => 'string',
'imap_server_host' => 'string',
'imap_server_port' => 'int',
'imap_username' => 'string',
'imap_password' => 'string',
'imap_mailbox' => 'string',
'mail_from_domain' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'secure_smtp_server_host' => null,
'secure_smtp_server_port' => 'int32',
'secure_smtp_username' => null,
'secure_smtp_password' => null,
'smtp_server_host' => null,
'smtp_server_port' => 'int32',
'smtp_username' => null,
'smtp_password' => null,
'secure_imap_server_host' => null,
'secure_imap_server_port' => 'int32',
'secure_imap_username' => null,
'secure_imap_password' => null,
'imap_server_host' => null,
'imap_server_port' => 'int32',
'imap_username' => null,
'imap_password' => null,
'imap_mailbox' => null,
'mail_from_domain' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'secure_smtp_server_host' => false,
'secure_smtp_server_port' => false,
'secure_smtp_username' => false,
'secure_smtp_password' => false,
'smtp_server_host' => false,
'smtp_server_port' => false,
'smtp_username' => false,
'smtp_password' => false,
'secure_imap_server_host' => false,
'secure_imap_server_port' => false,
'secure_imap_username' => false,
'secure_imap_password' => false,
'imap_server_host' => false,
'imap_server_port' => false,
'imap_username' => false,
'imap_password' => false,
'imap_mailbox' => false,
'mail_from_domain' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'secure_smtp_server_host' => 'secureSmtpServerHost',
'secure_smtp_server_port' => 'secureSmtpServerPort',
'secure_smtp_username' => 'secureSmtpUsername',
'secure_smtp_password' => 'secureSmtpPassword',
'smtp_server_host' => 'smtpServerHost',
'smtp_server_port' => 'smtpServerPort',
'smtp_username' => 'smtpUsername',
'smtp_password' => 'smtpPassword',
'secure_imap_server_host' => 'secureImapServerHost',
'secure_imap_server_port' => 'secureImapServerPort',
'secure_imap_username' => 'secureImapUsername',
'secure_imap_password' => 'secureImapPassword',
'imap_server_host' => 'imapServerHost',
'imap_server_port' => 'imapServerPort',
'imap_username' => 'imapUsername',
'imap_password' => 'imapPassword',
'imap_mailbox' => 'imapMailbox',
'mail_from_domain' => 'mailFromDomain'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'secure_smtp_server_host' => 'setSecureSmtpServerHost',
'secure_smtp_server_port' => 'setSecureSmtpServerPort',
'secure_smtp_username' => 'setSecureSmtpUsername',
'secure_smtp_password' => 'setSecureSmtpPassword',
'smtp_server_host' => 'setSmtpServerHost',
'smtp_server_port' => 'setSmtpServerPort',
'smtp_username' => 'setSmtpUsername',
'smtp_password' => 'setSmtpPassword',
'secure_imap_server_host' => 'setSecureImapServerHost',
'secure_imap_server_port' => 'setSecureImapServerPort',
'secure_imap_username' => 'setSecureImapUsername',
'secure_imap_password' => 'setSecureImapPassword',
'imap_server_host' => 'setImapServerHost',
'imap_server_port' => 'setImapServerPort',
'imap_username' => 'setImapUsername',
'imap_password' => 'setImapPassword',
'imap_mailbox' => 'setImapMailbox',
'mail_from_domain' => 'setMailFromDomain'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'secure_smtp_server_host' => 'getSecureSmtpServerHost',
'secure_smtp_server_port' => 'getSecureSmtpServerPort',
'secure_smtp_username' => 'getSecureSmtpUsername',
'secure_smtp_password' => 'getSecureSmtpPassword',
'smtp_server_host' => 'getSmtpServerHost',
'smtp_server_port' => 'getSmtpServerPort',
'smtp_username' => 'getSmtpUsername',
'smtp_password' => 'getSmtpPassword',
'secure_imap_server_host' => 'getSecureImapServerHost',
'secure_imap_server_port' => 'getSecureImapServerPort',
'secure_imap_username' => 'getSecureImapUsername',
'secure_imap_password' => 'getSecureImapPassword',
'imap_server_host' => 'getImapServerHost',
'imap_server_port' => 'getImapServerPort',
'imap_username' => 'getImapUsername',
'imap_password' => 'getImapPassword',
'imap_mailbox' => 'getImapMailbox',
'mail_from_domain' => 'getMailFromDomain'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('secure_smtp_server_host', $data ?? [], null);
$this->setIfExists('secure_smtp_server_port', $data ?? [], null);
$this->setIfExists('secure_smtp_username', $data ?? [], null);
$this->setIfExists('secure_smtp_password', $data ?? [], null);
$this->setIfExists('smtp_server_host', $data ?? [], null);
$this->setIfExists('smtp_server_port', $data ?? [], null);
$this->setIfExists('smtp_username', $data ?? [], null);
$this->setIfExists('smtp_password', $data ?? [], null);
$this->setIfExists('secure_imap_server_host', $data ?? [], null);
$this->setIfExists('secure_imap_server_port', $data ?? [], null);
$this->setIfExists('secure_imap_username', $data ?? [], null);
$this->setIfExists('secure_imap_password', $data ?? [], null);
$this->setIfExists('imap_server_host', $data ?? [], null);
$this->setIfExists('imap_server_port', $data ?? [], null);
$this->setIfExists('imap_username', $data ?? [], null);
$this->setIfExists('imap_password', $data ?? [], null);
$this->setIfExists('imap_mailbox', $data ?? [], null);
$this->setIfExists('mail_from_domain', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['secure_smtp_server_host'] === null) {
$invalidProperties[] = "'secure_smtp_server_host' can't be null";
}
if ($this->container['secure_smtp_server_port'] === null) {
$invalidProperties[] = "'secure_smtp_server_port' can't be null";
}
if ($this->container['secure_smtp_username'] === null) {
$invalidProperties[] = "'secure_smtp_username' can't be null";
}
if ($this->container['secure_smtp_password'] === null) {
$invalidProperties[] = "'secure_smtp_password' can't be null";
}
if ($this->container['smtp_server_host'] === null) {
$invalidProperties[] = "'smtp_server_host' can't be null";
}
if ($this->container['smtp_server_port'] === null) {
$invalidProperties[] = "'smtp_server_port' can't be null";
}
if ($this->container['smtp_username'] === null) {
$invalidProperties[] = "'smtp_username' can't be null";
}
if ($this->container['smtp_password'] === null) {
$invalidProperties[] = "'smtp_password' can't be null";
}
if ($this->container['secure_imap_server_host'] === null) {
$invalidProperties[] = "'secure_imap_server_host' can't be null";
}
if ($this->container['secure_imap_server_port'] === null) {
$invalidProperties[] = "'secure_imap_server_port' can't be null";
}
if ($this->container['secure_imap_username'] === null) {
$invalidProperties[] = "'secure_imap_username' can't be null";
}
if ($this->container['secure_imap_password'] === null) {
$invalidProperties[] = "'secure_imap_password' can't be null";
}
if ($this->container['imap_server_host'] === null) {
$invalidProperties[] = "'imap_server_host' can't be null";
}
if ($this->container['imap_server_port'] === null) {
$invalidProperties[] = "'imap_server_port' can't be null";
}
if ($this->container['imap_username'] === null) {
$invalidProperties[] = "'imap_username' can't be null";
}
if ($this->container['imap_password'] === null) {
$invalidProperties[] = "'imap_password' can't be null";
}
if ($this->container['imap_mailbox'] === null) {
$invalidProperties[] = "'imap_mailbox' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets secure_smtp_server_host
*
* @return string
*/
public function getSecureSmtpServerHost()
{
return $this->container['secure_smtp_server_host'];
}
/**
* Sets secure_smtp_server_host
*
* @param string $secure_smtp_server_host Secure TLS SMTP server host domain
*
* @return self
*/
public function setSecureSmtpServerHost($secure_smtp_server_host)
{
if (is_null($secure_smtp_server_host)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_server_host cannot be null');
}
$this->container['secure_smtp_server_host'] = $secure_smtp_server_host;
return $this;
}
/**
* Gets secure_smtp_server_port
*
* @return int
*/
public function getSecureSmtpServerPort()
{
return $this->container['secure_smtp_server_port'];
}
/**
* Sets secure_smtp_server_port
*
* @param int $secure_smtp_server_port Secure TLS SMTP server host port
*
* @return self
*/
public function setSecureSmtpServerPort($secure_smtp_server_port)
{
if (is_null($secure_smtp_server_port)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_server_port cannot be null');
}
$this->container['secure_smtp_server_port'] = $secure_smtp_server_port;
return $this;
}
/**
* Gets secure_smtp_username
*
* @return string
*/
public function getSecureSmtpUsername()
{
return $this->container['secure_smtp_username'];
}
/**
* Sets secure_smtp_username
*
* @param string $secure_smtp_username Secure TLS SMTP username for login
*
* @return self
*/
public function setSecureSmtpUsername($secure_smtp_username)
{
if (is_null($secure_smtp_username)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_username cannot be null');
}
$this->container['secure_smtp_username'] = $secure_smtp_username;
return $this;
}
/**
* Gets secure_smtp_password
*
* @return string
*/
public function getSecureSmtpPassword()
{
return $this->container['secure_smtp_password'];
}
/**
* Sets secure_smtp_password
*
* @param string $secure_smtp_password Secure TLS SMTP password for login
*
* @return self
*/
public function setSecureSmtpPassword($secure_smtp_password)
{
if (is_null($secure_smtp_password)) {
throw new \InvalidArgumentException('non-nullable secure_smtp_password cannot be null');
}
$this->container['secure_smtp_password'] = $secure_smtp_password;
return $this;
}
/**
* Gets smtp_server_host
*
* @return string
*/
public function getSmtpServerHost()
{
return $this->container['smtp_server_host'];
}
/**
* Sets smtp_server_host
*
* @param string $smtp_server_host SMTP server host domain
*
* @return self
*/
public function setSmtpServerHost($smtp_server_host)
{
if (is_null($smtp_server_host)) {
throw new \InvalidArgumentException('non-nullable smtp_server_host cannot be null');
}
$this->container['smtp_server_host'] = $smtp_server_host;
return $this;
}
/**
* Gets smtp_server_port
*
* @return int
*/
public function getSmtpServerPort()
{
return $this->container['smtp_server_port'];
}
/**
* Sets smtp_server_port
*
* @param int $smtp_server_port SMTP server host port
*
* @return self
*/
public function setSmtpServerPort($smtp_server_port)
{
if (is_null($smtp_server_port)) {
throw new \InvalidArgumentException('non-nullable smtp_server_port cannot be null');
}
$this->container['smtp_server_port'] = $smtp_server_port;
return $this;
}
/**
* Gets smtp_username
*
* @return string
*/
public function getSmtpUsername()
{
return $this->container['smtp_username'];
}
/**
* Sets smtp_username
*
* @param string $smtp_username SMTP username for login
*
* @return self
*/
public function setSmtpUsername($smtp_username)
{
if (is_null($smtp_username)) {
throw new \InvalidArgumentException('non-nullable smtp_username cannot be null');
}
$this->container['smtp_username'] = $smtp_username;
return $this;
}
/**
* Gets smtp_password
*
* @return string
*/
public function getSmtpPassword()
{
return $this->container['smtp_password'];
}
/**
* Sets smtp_password
*
* @param string $smtp_password SMTP password for login
*
* @return self
*/
public function setSmtpPassword($smtp_password)
{
if (is_null($smtp_password)) {
throw new \InvalidArgumentException('non-nullable smtp_password cannot be null');
}
$this->container['smtp_password'] = $smtp_password;
return $this;
}
/**
* Gets secure_imap_server_host
*
* @return string
*/
public function getSecureImapServerHost()
{
return $this->container['secure_imap_server_host'];
}
/**
* Sets secure_imap_server_host
*
* @param string $secure_imap_server_host Secure TLS IMAP server host domain
*
* @return self
*/
public function setSecureImapServerHost($secure_imap_server_host)
{
if (is_null($secure_imap_server_host)) {
throw new \InvalidArgumentException('non-nullable secure_imap_server_host cannot be null');
}
$this->container['secure_imap_server_host'] = $secure_imap_server_host;
return $this;
}
/**
* Gets secure_imap_server_port
*
* @return int
*/
public function getSecureImapServerPort()
{
return $this->container['secure_imap_server_port'];
}
/**
* Sets secure_imap_server_port
*
* @param int $secure_imap_server_port Secure TLS IMAP server host port
*
* @return self
*/
public function setSecureImapServerPort($secure_imap_server_port)
{
if (is_null($secure_imap_server_port)) {
throw new \InvalidArgumentException('non-nullable secure_imap_server_port cannot be null');
}
$this->container['secure_imap_server_port'] = $secure_imap_server_port;
return $this;
}
/**
* Gets secure_imap_username
*
* @return string
*/
public function getSecureImapUsername()
{
return $this->container['secure_imap_username'];
}
/**
* Sets secure_imap_username
*
* @param string $secure_imap_username Secure TLS IMAP username for login
*
* @return self
*/
public function setSecureImapUsername($secure_imap_username)
{
if (is_null($secure_imap_username)) {
throw new \InvalidArgumentException('non-nullable secure_imap_username cannot be null');
}
$this->container['secure_imap_username'] = $secure_imap_username;
return $this;
}
/**
* Gets secure_imap_password
*
* @return string
*/
public function getSecureImapPassword()
{
return $this->container['secure_imap_password'];
}
/**
* Sets secure_imap_password
*
* @param string $secure_imap_password Secure TLS IMAP password for login
*
* @return self
*/
public function setSecureImapPassword($secure_imap_password)
{
if (is_null($secure_imap_password)) {
throw new \InvalidArgumentException('non-nullable secure_imap_password cannot be null');
}
$this->container['secure_imap_password'] = $secure_imap_password;
return $this;
}
/**
* Gets imap_server_host
*
* @return string
*/
public function getImapServerHost()
{
return $this->container['imap_server_host'];
}
/**
* Sets imap_server_host
*
* @param string $imap_server_host IMAP server host domain
*
* @return self
*/
public function setImapServerHost($imap_server_host)
{
if (is_null($imap_server_host)) {
throw new \InvalidArgumentException('non-nullable imap_server_host cannot be null');
}
$this->container['imap_server_host'] = $imap_server_host;
return $this;
}
/**
* Gets imap_server_port
*
* @return int
*/
public function getImapServerPort()
{
return $this->container['imap_server_port'];
}
/**
* Sets imap_server_port
*
* @param int $imap_server_port IMAP server host port
*
* @return self
*/
public function setImapServerPort($imap_server_port)
{
if (is_null($imap_server_port)) {
throw new \InvalidArgumentException('non-nullable imap_server_port cannot be null');
}
$this->container['imap_server_port'] = $imap_server_port;
return $this;
}
/**
* Gets imap_username
*
* @return string
*/
public function getImapUsername()
{
return $this->container['imap_username'];
}
/**
* Sets imap_username
*
* @param string $imap_username IMAP username for login
*
* @return self
*/
public function setImapUsername($imap_username)
{
if (is_null($imap_username)) {
throw new \InvalidArgumentException('non-nullable imap_username cannot be null');
}
$this->container['imap_username'] = $imap_username;
return $this;
}
/**
* Gets imap_password
*
* @return string
*/
public function getImapPassword()
{
return $this->container['imap_password'];
}
/**
* Sets imap_password
*
* @param string $imap_password IMAP password for login
*
* @return self
*/
public function setImapPassword($imap_password)
{
if (is_null($imap_password)) {
throw new \InvalidArgumentException('non-nullable imap_password cannot be null');
}
$this->container['imap_password'] = $imap_password;
return $this;
}
/**
* Gets imap_mailbox
*
* @return string
*/
public function getImapMailbox()
{
return $this->container['imap_mailbox'];
}
/**
* Sets imap_mailbox
*
* @param string $imap_mailbox IMAP mailbox to SELECT
*
* @return self
*/
public function setImapMailbox($imap_mailbox)
{
if (is_null($imap_mailbox)) {
throw new \InvalidArgumentException('non-nullable imap_mailbox cannot be null');
}
$this->container['imap_mailbox'] = $imap_mailbox;
return $this;
}
/**
* Gets mail_from_domain
*
* @return string|null
*/
public function getMailFromDomain()
{
return $this->container['mail_from_domain'];
}
/**
* Sets mail_from_domain
*
* @param string|null $mail_from_domain Mail from domain or SMTP HELO value
*
* @return self
*/
public function setMailFromDomain($mail_from_domain)
{
if (is_null($mail_from_domain)) {
array_push($this->openAPINullablesSetToNull, 'mail_from_domain');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('mail_from_domain', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['mail_from_domain'] = $mail_from_domain;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerStatusResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerStatusResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerStatusResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerStatusResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'result' => '\MailSlurp\Models\ImapMailboxStatus'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'result' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'result' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'result' => 'result'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'result' => 'setResult'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'result' => 'getResult'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('result', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets result
*
* @return \MailSlurp\Models\ImapMailboxStatus|null
*/
public function getResult()
{
return $this->container['result'];
}
/**
* Sets result
*
* @param \MailSlurp\Models\ImapMailboxStatus|null $result result
*
* @return self
*/
public function setResult($result)
{
if (is_null($result)) {
array_push($this->openAPINullablesSetToNull, 'result');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('result', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['result'] = $result;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerStatusOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerStatusOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerStatusOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerStatusOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'status_items' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'status_items' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => true,
'status_items' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'status_items' => 'statusItems'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'status_items' => 'setStatusItems'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'status_items' => 'getStatusItems'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_ITEMS_MESSAGES = 'MESSAGES';
public const STATUS_ITEMS_RECENT = 'RECENT';
public const STATUS_ITEMS_UIDNEXT = 'UIDNEXT';
public const STATUS_ITEMS_UIDVALIDITY = 'UIDVALIDITY';
public const STATUS_ITEMS_UNSEEN = 'UNSEEN';
public const STATUS_ITEMS_APPENDLIMIT = 'APPENDLIMIT';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusItemsAllowableValues()
{
return [
self::STATUS_ITEMS_MESSAGES,
self::STATUS_ITEMS_RECENT,
self::STATUS_ITEMS_UIDNEXT,
self::STATUS_ITEMS_UIDVALIDITY,
self::STATUS_ITEMS_UNSEEN,
self::STATUS_ITEMS_APPENDLIMIT,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('status_items', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets status_items
*
* @return string[]|null
*/
public function getStatusItems()
{
return $this->container['status_items'];
}
/**
* Sets status_items
*
* @param string[]|null $status_items status_items
*
* @return self
*/
public function setStatusItems($status_items)
{
$allowedValues = $this->getStatusItemsAllowableValues();
if (!is_null($status_items) && array_diff($status_items, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'status_items', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
if (is_null($status_items)) {
array_push($this->openAPINullablesSetToNull, 'status_items');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('status_items', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['status_items'] = $status_items;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerSearchResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerSearchResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerSearchResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerSearchResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'results' => '\MailSlurp\Models\ImapEmailProjection[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'results' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'results' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'results' => 'results'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'results' => 'setResults'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'results' => 'getResults'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('results', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['results'] === null) {
$invalidProperties[] = "'results' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets results
*
* @return \MailSlurp\Models\ImapEmailProjection[]
*/
public function getResults()
{
return $this->container['results'];
}
/**
* Sets results
*
* @param \MailSlurp\Models\ImapEmailProjection[] $results results
*
* @return self
*/
public function setResults($results)
{
if (is_null($results)) {
throw new \InvalidArgumentException('non-nullable results cannot be null');
}
$this->container['results'] = $results;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerSearchOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerSearchOptions Class Doc Comment
*
* @category Class
* @description IMAP server search options
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerSearchOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerSearchOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'seq_num' => 'string',
'uid' => 'string',
'since' => '\DateTime',
'before' => '\DateTime',
'sent_since' => '\DateTime',
'sent_before' => '\DateTime',
'header' => 'array<string,string[]>',
'body' => 'string[]',
'text' => 'string[]',
'with_flags' => 'string[]',
'without_flags' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'seq_num' => null,
'uid' => null,
'since' => 'date-time',
'before' => 'date-time',
'sent_since' => 'date-time',
'sent_before' => 'date-time',
'header' => null,
'body' => null,
'text' => null,
'with_flags' => null,
'without_flags' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'seq_num' => true,
'uid' => true,
'since' => true,
'before' => true,
'sent_since' => true,
'sent_before' => true,
'header' => true,
'body' => true,
'text' => true,
'with_flags' => true,
'without_flags' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'seq_num' => 'seqNum',
'uid' => 'uid',
'since' => 'since',
'before' => 'before',
'sent_since' => 'sentSince',
'sent_before' => 'sentBefore',
'header' => 'header',
'body' => 'body',
'text' => 'text',
'with_flags' => 'withFlags',
'without_flags' => 'withoutFlags'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'seq_num' => 'setSeqNum',
'uid' => 'setUid',
'since' => 'setSince',
'before' => 'setBefore',
'sent_since' => 'setSentSince',
'sent_before' => 'setSentBefore',
'header' => 'setHeader',
'body' => 'setBody',
'text' => 'setText',
'with_flags' => 'setWithFlags',
'without_flags' => 'setWithoutFlags'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'seq_num' => 'getSeqNum',
'uid' => 'getUid',
'since' => 'getSince',
'before' => 'getBefore',
'sent_since' => 'getSentSince',
'sent_before' => 'getSentBefore',
'header' => 'getHeader',
'body' => 'getBody',
'text' => 'getText',
'with_flags' => 'getWithFlags',
'without_flags' => 'getWithoutFlags'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('seq_num', $data ?? [], null);
$this->setIfExists('uid', $data ?? [], null);
$this->setIfExists('since', $data ?? [], null);
$this->setIfExists('before', $data ?? [], null);
$this->setIfExists('sent_since', $data ?? [], null);
$this->setIfExists('sent_before', $data ?? [], null);
$this->setIfExists('header', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('text', $data ?? [], null);
$this->setIfExists('with_flags', $data ?? [], null);
$this->setIfExists('without_flags', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets seq_num
*
* @return string|null
*/
public function getSeqNum()
{
return $this->container['seq_num'];
}
/**
* Sets seq_num
*
* @param string|null $seq_num seq_num
*
* @return self
*/
public function setSeqNum($seq_num)
{
if (is_null($seq_num)) {
array_push($this->openAPINullablesSetToNull, 'seq_num');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('seq_num', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['seq_num'] = $seq_num;
return $this;
}
/**
* Gets uid
*
* @return string|null
*/
public function getUid()
{
return $this->container['uid'];
}
/**
* Sets uid
*
* @param string|null $uid uid
*
* @return self
*/
public function setUid($uid)
{
if (is_null($uid)) {
array_push($this->openAPINullablesSetToNull, 'uid');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('uid', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['uid'] = $uid;
return $this;
}
/**
* Gets since
*
* @return \DateTime|null
*/
public function getSince()
{
return $this->container['since'];
}
/**
* Sets since
*
* @param \DateTime|null $since since
*
* @return self
*/
public function setSince($since)
{
if (is_null($since)) {
array_push($this->openAPINullablesSetToNull, 'since');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('since', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['since'] = $since;
return $this;
}
/**
* Gets before
*
* @return \DateTime|null
*/
public function getBefore()
{
return $this->container['before'];
}
/**
* Sets before
*
* @param \DateTime|null $before before
*
* @return self
*/
public function setBefore($before)
{
if (is_null($before)) {
array_push($this->openAPINullablesSetToNull, 'before');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('before', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['before'] = $before;
return $this;
}
/**
* Gets sent_since
*
* @return \DateTime|null
*/
public function getSentSince()
{
return $this->container['sent_since'];
}
/**
* Sets sent_since
*
* @param \DateTime|null $sent_since sent_since
*
* @return self
*/
public function setSentSince($sent_since)
{
if (is_null($sent_since)) {
array_push($this->openAPINullablesSetToNull, 'sent_since');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_since', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_since'] = $sent_since;
return $this;
}
/**
* Gets sent_before
*
* @return \DateTime|null
*/
public function getSentBefore()
{
return $this->container['sent_before'];
}
/**
* Sets sent_before
*
* @param \DateTime|null $sent_before sent_before
*
* @return self
*/
public function setSentBefore($sent_before)
{
if (is_null($sent_before)) {
array_push($this->openAPINullablesSetToNull, 'sent_before');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_before', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_before'] = $sent_before;
return $this;
}
/**
* Gets header
*
* @return array<string,string[]>|null
*/
public function getHeader()
{
return $this->container['header'];
}
/**
* Sets header
*
* @param array<string,string[]>|null $header header
*
* @return self
*/
public function setHeader($header)
{
if (is_null($header)) {
array_push($this->openAPINullablesSetToNull, 'header');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('header', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['header'] = $header;
return $this;
}
/**
* Gets body
*
* @return string[]|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string[]|null $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
array_push($this->openAPINullablesSetToNull, 'body');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets text
*
* @return string[]|null
*/
public function getText()
{
return $this->container['text'];
}
/**
* Sets text
*
* @param string[]|null $text text
*
* @return self
*/
public function setText($text)
{
if (is_null($text)) {
array_push($this->openAPINullablesSetToNull, 'text');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('text', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['text'] = $text;
return $this;
}
/**
* Gets with_flags
*
* @return string[]|null
*/
public function getWithFlags()
{
return $this->container['with_flags'];
}
/**
* Sets with_flags
*
* @param string[]|null $with_flags with_flags
*
* @return self
*/
public function setWithFlags($with_flags)
{
if (is_null($with_flags)) {
array_push($this->openAPINullablesSetToNull, 'with_flags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('with_flags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['with_flags'] = $with_flags;
return $this;
}
/**
* Gets without_flags
*
* @return string[]|null
*/
public function getWithoutFlags()
{
return $this->container['without_flags'];
}
/**
* Sets without_flags
*
* @param string[]|null $without_flags without_flags
*
* @return self
*/
public function setWithoutFlags($without_flags)
{
if (is_null($without_flags)) {
array_push($this->openAPINullablesSetToNull, 'without_flags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('without_flags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['without_flags'] = $without_flags;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerMailboxResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerMailboxResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerMailboxResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerMailboxResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message' => 'string',
'success' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message' => null,
'success' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message' => true,
'success' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message' => 'message',
'success' => 'success'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message' => 'setMessage',
'success' => 'setSuccess'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message' => 'getMessage',
'success' => 'getSuccess'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('success', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['success'] === null) {
$invalidProperties[] = "'success' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets success
*
* @return bool
*/
public function getSuccess()
{
return $this->container['success'];
}
/**
* Sets success
*
* @param bool $success success
*
* @return self
*/
public function setSuccess($success)
{
if (is_null($success)) {
throw new \InvalidArgumentException('non-nullable success cannot be null');
}
$this->container['success'] = $success;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerListResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerListResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerListResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerListResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'results' => '\MailSlurp\Models\ImapEmailProjection[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'results' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'results' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'results' => 'results'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'results' => 'setResults'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'results' => 'getResults'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('results', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['results'] === null) {
$invalidProperties[] = "'results' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets results
*
* @return \MailSlurp\Models\ImapEmailProjection[]
*/
public function getResults()
{
return $this->container['results'];
}
/**
* Sets results
*
* @param \MailSlurp\Models\ImapEmailProjection[] $results results
*
* @return self
*/
public function setResults($results)
{
if (is_null($results)) {
throw new \InvalidArgumentException('non-nullable results cannot be null');
}
$this->container['results'] = $results;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerListOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerListOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerListOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerListOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'uid_set' => 'string',
'seq_set' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'uid_set' => null,
'seq_set' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'uid_set' => true,
'seq_set' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'uid_set' => 'uidSet',
'seq_set' => 'seqSet'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'uid_set' => 'setUidSet',
'seq_set' => 'setSeqSet'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'uid_set' => 'getUidSet',
'seq_set' => 'getSeqSet'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('uid_set', $data ?? [], null);
$this->setIfExists('seq_set', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets uid_set
*
* @return string|null
*/
public function getUidSet()
{
return $this->container['uid_set'];
}
/**
* Sets uid_set
*
* @param string|null $uid_set uid_set
*
* @return self
*/
public function setUidSet($uid_set)
{
if (is_null($uid_set)) {
array_push($this->openAPINullablesSetToNull, 'uid_set');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('uid_set', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['uid_set'] = $uid_set;
return $this;
}
/**
* Gets seq_set
*
* @return string|null
*/
public function getSeqSet()
{
return $this->container['seq_set'];
}
/**
* Sets seq_set
*
* @param string|null $seq_set seq_set
*
* @return self
*/
public function setSeqSet($seq_set)
{
if (is_null($seq_set)) {
array_push($this->openAPINullablesSetToNull, 'seq_set');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('seq_set', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['seq_set'] = $seq_set;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerGetResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerGetResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerGetResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerGetResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'result' => '\MailSlurp\Models\ImapEmailProjection'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'result' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'result' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'result' => 'result'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'result' => 'setResult'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'result' => 'getResult'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('result', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets result
*
* @return \MailSlurp\Models\ImapEmailProjection|null
*/
public function getResult()
{
return $this->container['result'];
}
/**
* Sets result
*
* @param \MailSlurp\Models\ImapEmailProjection|null $result result
*
* @return self
*/
public function setResult($result)
{
if (is_null($result)) {
throw new \InvalidArgumentException('non-nullable result cannot be null');
}
$this->container['result'] = $result;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerFetchResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerFetchResult Class Doc Comment
*
* @category Class
* @description IMAP fetch email result
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerFetchResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerFetchResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'result' => '\MailSlurp\Models\ImapServerFetchItem'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'result' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'result' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'result' => 'result'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'result' => 'setResult'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'result' => 'getResult'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('result', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets result
*
* @return \MailSlurp\Models\ImapServerFetchItem|null
*/
public function getResult()
{
return $this->container['result'];
}
/**
* Sets result
*
* @param \MailSlurp\Models\ImapServerFetchItem|null $result result
*
* @return self
*/
public function setResult($result)
{
if (is_null($result)) {
array_push($this->openAPINullablesSetToNull, 'result');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('result', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['result'] = $result;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapServerFetchItem
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapServerFetchItem Class Doc Comment
*
* @category Class
* @description IMAP fetch content in raw format
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapServerFetchItem implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapServerFetchItem';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => 'string',
'id' => 'string',
'uid' => 'int',
'seq_num' => 'int',
'read' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null,
'id' => 'uuid',
'uid' => 'int64',
'seq_num' => 'int64',
'read' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => false,
'id' => false,
'uid' => false,
'seq_num' => false,
'read' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content',
'id' => 'id',
'uid' => 'uid',
'seq_num' => 'seqNum',
'read' => 'read'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent',
'id' => 'setId',
'uid' => 'setUid',
'seq_num' => 'setSeqNum',
'read' => 'setRead'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent',
'id' => 'getId',
'uid' => 'getUid',
'seq_num' => 'getSeqNum',
'read' => 'getRead'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('uid', $data ?? [], null);
$this->setIfExists('seq_num', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['content'] === null) {
$invalidProperties[] = "'content' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['uid'] === null) {
$invalidProperties[] = "'uid' can't be null";
}
if ($this->container['seq_num'] === null) {
$invalidProperties[] = "'seq_num' can't be null";
}
if ($this->container['read'] === null) {
$invalidProperties[] = "'read' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return string
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param string $content Content of the email
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of the email
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets uid
*
* @return int
*/
public function getUid()
{
return $this->container['uid'];
}
/**
* Sets uid
*
* @param int $uid UID of the email
*
* @return self
*/
public function setUid($uid)
{
if (is_null($uid)) {
throw new \InvalidArgumentException('non-nullable uid cannot be null');
}
$this->container['uid'] = $uid;
return $this;
}
/**
* Gets seq_num
*
* @return int
*/
public function getSeqNum()
{
return $this->container['seq_num'];
}
/**
* Sets seq_num
*
* @param int $seq_num Sequence number of the email
*
* @return self
*/
public function setSeqNum($seq_num)
{
if (is_null($seq_num)) {
throw new \InvalidArgumentException('non-nullable seq_num cannot be null');
}
$this->container['seq_num'] = $seq_num;
return $this;
}
/**
* Gets read
*
* @return bool
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool $read Read status of the email
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
throw new \InvalidArgumentException('non-nullable read cannot be null');
}
$this->container['read'] = $read;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapMailboxStatus
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapMailboxStatus Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapMailboxStatus implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapMailboxStatus';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'read_only' => 'bool',
'items' => 'object',
'flags' => 'string[]',
'permanent_flags' => 'string[]',
'unseen_seq_num' => 'int',
'messages' => 'int',
'recent' => 'int',
'unseen' => 'int',
'uid_next' => 'int',
'uid_validity' => 'int',
'append_limit' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'read_only' => null,
'items' => null,
'flags' => null,
'permanent_flags' => null,
'unseen_seq_num' => 'int64',
'messages' => 'int32',
'recent' => 'int32',
'unseen' => 'int32',
'uid_next' => 'int64',
'uid_validity' => 'int32',
'append_limit' => 'int32'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'read_only' => false,
'items' => true,
'flags' => true,
'permanent_flags' => true,
'unseen_seq_num' => false,
'messages' => false,
'recent' => false,
'unseen' => false,
'uid_next' => false,
'uid_validity' => false,
'append_limit' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'read_only' => 'readOnly',
'items' => 'items',
'flags' => 'flags',
'permanent_flags' => 'permanentFlags',
'unseen_seq_num' => 'unseenSeqNum',
'messages' => 'messages',
'recent' => 'recent',
'unseen' => 'unseen',
'uid_next' => 'uidNext',
'uid_validity' => 'uidValidity',
'append_limit' => 'appendLimit'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'read_only' => 'setReadOnly',
'items' => 'setItems',
'flags' => 'setFlags',
'permanent_flags' => 'setPermanentFlags',
'unseen_seq_num' => 'setUnseenSeqNum',
'messages' => 'setMessages',
'recent' => 'setRecent',
'unseen' => 'setUnseen',
'uid_next' => 'setUidNext',
'uid_validity' => 'setUidValidity',
'append_limit' => 'setAppendLimit'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'read_only' => 'getReadOnly',
'items' => 'getItems',
'flags' => 'getFlags',
'permanent_flags' => 'getPermanentFlags',
'unseen_seq_num' => 'getUnseenSeqNum',
'messages' => 'getMessages',
'recent' => 'getRecent',
'unseen' => 'getUnseen',
'uid_next' => 'getUidNext',
'uid_validity' => 'getUidValidity',
'append_limit' => 'getAppendLimit'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('read_only', $data ?? [], null);
$this->setIfExists('items', $data ?? [], null);
$this->setIfExists('flags', $data ?? [], null);
$this->setIfExists('permanent_flags', $data ?? [], null);
$this->setIfExists('unseen_seq_num', $data ?? [], null);
$this->setIfExists('messages', $data ?? [], null);
$this->setIfExists('recent', $data ?? [], null);
$this->setIfExists('unseen', $data ?? [], null);
$this->setIfExists('uid_next', $data ?? [], null);
$this->setIfExists('uid_validity', $data ?? [], null);
$this->setIfExists('append_limit', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['read_only'] === null) {
$invalidProperties[] = "'read_only' can't be null";
}
if ($this->container['items'] === null) {
$invalidProperties[] = "'items' can't be null";
}
if ($this->container['flags'] === null) {
$invalidProperties[] = "'flags' can't be null";
}
if ($this->container['permanent_flags'] === null) {
$invalidProperties[] = "'permanent_flags' can't be null";
}
if ($this->container['unseen_seq_num'] === null) {
$invalidProperties[] = "'unseen_seq_num' can't be null";
}
if ($this->container['messages'] === null) {
$invalidProperties[] = "'messages' can't be null";
}
if ($this->container['recent'] === null) {
$invalidProperties[] = "'recent' can't be null";
}
if ($this->container['unseen'] === null) {
$invalidProperties[] = "'unseen' can't be null";
}
if ($this->container['uid_next'] === null) {
$invalidProperties[] = "'uid_next' can't be null";
}
if ($this->container['uid_validity'] === null) {
$invalidProperties[] = "'uid_validity' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name The mailbox name.
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets read_only
*
* @return bool
*/
public function getReadOnly()
{
return $this->container['read_only'];
}
/**
* Sets read_only
*
* @param bool $read_only True if the mailbox is open in read-only mode.
*
* @return self
*/
public function setReadOnly($read_only)
{
if (is_null($read_only)) {
throw new \InvalidArgumentException('non-nullable read_only cannot be null');
}
$this->container['read_only'] = $read_only;
return $this;
}
/**
* Gets items
*
* @return object
*/
public function getItems()
{
return $this->container['items'];
}
/**
* Sets items
*
* @param object $items Results map
*
* @return self
*/
public function setItems($items)
{
if (is_null($items)) {
array_push($this->openAPINullablesSetToNull, 'items');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('items', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['items'] = $items;
return $this;
}
/**
* Gets flags
*
* @return string[]
*/
public function getFlags()
{
return $this->container['flags'];
}
/**
* Sets flags
*
* @param string[] $flags The mailbox flags.
*
* @return self
*/
public function setFlags($flags)
{
if (is_null($flags)) {
array_push($this->openAPINullablesSetToNull, 'flags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('flags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['flags'] = $flags;
return $this;
}
/**
* Gets permanent_flags
*
* @return string[]
*/
public function getPermanentFlags()
{
return $this->container['permanent_flags'];
}
/**
* Sets permanent_flags
*
* @param string[] $permanent_flags The mailbox permanent flags.
*
* @return self
*/
public function setPermanentFlags($permanent_flags)
{
if (is_null($permanent_flags)) {
array_push($this->openAPINullablesSetToNull, 'permanent_flags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('permanent_flags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['permanent_flags'] = $permanent_flags;
return $this;
}
/**
* Gets unseen_seq_num
*
* @return int
*/
public function getUnseenSeqNum()
{
return $this->container['unseen_seq_num'];
}
/**
* Sets unseen_seq_num
*
* @param int $unseen_seq_num The sequence number of the first unseen message in the mailbox.
*
* @return self
*/
public function setUnseenSeqNum($unseen_seq_num)
{
if (is_null($unseen_seq_num)) {
throw new \InvalidArgumentException('non-nullable unseen_seq_num cannot be null');
}
$this->container['unseen_seq_num'] = $unseen_seq_num;
return $this;
}
/**
* Gets messages
*
* @return int
*/
public function getMessages()
{
return $this->container['messages'];
}
/**
* Sets messages
*
* @param int $messages The number of messages in this mailbox.
*
* @return self
*/
public function setMessages($messages)
{
if (is_null($messages)) {
throw new \InvalidArgumentException('non-nullable messages cannot be null');
}
$this->container['messages'] = $messages;
return $this;
}
/**
* Gets recent
*
* @return int
*/
public function getRecent()
{
return $this->container['recent'];
}
/**
* Sets recent
*
* @param int $recent The number of messages not seen since the last time the mailbox was opened.
*
* @return self
*/
public function setRecent($recent)
{
if (is_null($recent)) {
throw new \InvalidArgumentException('non-nullable recent cannot be null');
}
$this->container['recent'] = $recent;
return $this;
}
/**
* Gets unseen
*
* @return int
*/
public function getUnseen()
{
return $this->container['unseen'];
}
/**
* Sets unseen
*
* @param int $unseen The number of unread messages.
*
* @return self
*/
public function setUnseen($unseen)
{
if (is_null($unseen)) {
throw new \InvalidArgumentException('non-nullable unseen cannot be null');
}
$this->container['unseen'] = $unseen;
return $this;
}
/**
* Gets uid_next
*
* @return int
*/
public function getUidNext()
{
return $this->container['uid_next'];
}
/**
* Sets uid_next
*
* @param int $uid_next The next UID.
*
* @return self
*/
public function setUidNext($uid_next)
{
if (is_null($uid_next)) {
throw new \InvalidArgumentException('non-nullable uid_next cannot be null');
}
$this->container['uid_next'] = $uid_next;
return $this;
}
/**
* Gets uid_validity
*
* @return int
*/
public function getUidValidity()
{
return $this->container['uid_validity'];
}
/**
* Sets uid_validity
*
* @param int $uid_validity Together with a UID, it is a unique identifier for a message. Must be greater than or equal to 1.
*
* @return self
*/
public function setUidValidity($uid_validity)
{
if (is_null($uid_validity)) {
throw new \InvalidArgumentException('non-nullable uid_validity cannot be null');
}
$this->container['uid_validity'] = $uid_validity;
return $this;
}
/**
* Gets append_limit
*
* @return int|null
*/
public function getAppendLimit()
{
return $this->container['append_limit'];
}
/**
* Sets append_limit
*
* @param int|null $append_limit Per-mailbox limit of message size. Set only if server supports the APPENDLIMIT extension
*
* @return self
*/
public function setAppendLimit($append_limit)
{
if (is_null($append_limit)) {
array_push($this->openAPINullablesSetToNull, 'append_limit');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('append_limit', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['append_limit'] = $append_limit;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapFlagOperationOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapFlagOperationOptions Class Doc Comment
*
* @category Class
* @description IMAP operation flags
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapFlagOperationOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapFlagOperationOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'flag_operation' => 'string',
'flags' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'flag_operation' => null,
'flags' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'flag_operation' => false,
'flags' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'flag_operation' => 'flagOperation',
'flags' => 'flags'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'flag_operation' => 'setFlagOperation',
'flags' => 'setFlags'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'flag_operation' => 'getFlagOperation',
'flags' => 'getFlags'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FLAG_OPERATION_SET_FLAGS = 'SET_FLAGS';
public const FLAG_OPERATION_ADD_FLAGS = 'ADD_FLAGS';
public const FLAG_OPERATION_REMOVE_FLAGS = 'REMOVE_FLAGS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFlagOperationAllowableValues()
{
return [
self::FLAG_OPERATION_SET_FLAGS,
self::FLAG_OPERATION_ADD_FLAGS,
self::FLAG_OPERATION_REMOVE_FLAGS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('flag_operation', $data ?? [], null);
$this->setIfExists('flags', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['flag_operation'] === null) {
$invalidProperties[] = "'flag_operation' can't be null";
}
$allowedValues = $this->getFlagOperationAllowableValues();
if (!is_null($this->container['flag_operation']) && !in_array($this->container['flag_operation'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'flag_operation', must be one of '%s'",
$this->container['flag_operation'],
implode("', '", $allowedValues)
);
}
if ($this->container['flags'] === null) {
$invalidProperties[] = "'flags' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets flag_operation
*
* @return string
*/
public function getFlagOperation()
{
return $this->container['flag_operation'];
}
/**
* Sets flag_operation
*
* @param string $flag_operation flag_operation
*
* @return self
*/
public function setFlagOperation($flag_operation)
{
$allowedValues = $this->getFlagOperationAllowableValues();
if (!in_array($flag_operation, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'flag_operation', must be one of '%s'",
$flag_operation,
implode("', '", $allowedValues)
)
);
}
if (is_null($flag_operation)) {
throw new \InvalidArgumentException('non-nullable flag_operation cannot be null');
}
$this->container['flag_operation'] = $flag_operation;
return $this;
}
/**
* Gets flags
*
* @return string[]
*/
public function getFlags()
{
return $this->container['flags'];
}
/**
* Sets flags
*
* @param string[] $flags flags
*
* @return self
*/
public function setFlags($flags)
{
if (is_null($flags)) {
throw new \InvalidArgumentException('non-nullable flags cannot be null');
}
$this->container['flags'] = $flags;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapEmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapEmailProjection Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapEmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapEmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'read' => 'bool',
'uid' => 'int',
'seq_num' => 'int',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'read' => null,
'uid' => 'int64',
'seq_num' => 'int64',
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'read' => true,
'uid' => false,
'seq_num' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'read' => 'read',
'uid' => 'uid',
'seq_num' => 'seqNum',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'read' => 'setRead',
'uid' => 'setUid',
'seq_num' => 'setSeqNum',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'read' => 'getRead',
'uid' => 'getUid',
'seq_num' => 'getSeqNum',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
$this->setIfExists('uid', $data ?? [], null);
$this->setIfExists('seq_num', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['uid'] === null) {
$invalidProperties[] = "'uid' can't be null";
}
if ($this->container['seq_num'] === null) {
$invalidProperties[] = "'seq_num' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets read
*
* @return bool|null
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool|null $read read
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
array_push($this->openAPINullablesSetToNull, 'read');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('read', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['read'] = $read;
return $this;
}
/**
* Gets uid
*
* @return int
*/
public function getUid()
{
return $this->container['uid'];
}
/**
* Sets uid
*
* @param int $uid uid
*
* @return self
*/
public function setUid($uid)
{
if (is_null($uid)) {
throw new \InvalidArgumentException('non-nullable uid cannot be null');
}
$this->container['uid'] = $uid;
return $this;
}
/**
* Gets seq_num
*
* @return int
*/
public function getSeqNum()
{
return $this->container['seq_num'];
}
/**
* Sets seq_num
*
* @param int $seq_num seq_num
*
* @return self
*/
public function setSeqNum($seq_num)
{
if (is_null($seq_num)) {
throw new \InvalidArgumentException('non-nullable seq_num cannot be null');
}
$this->container['seq_num'] = $seq_num;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImapAccessDetails
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImapAccessDetails Class Doc Comment
*
* @category Class
* @description Access details for inbox using IMAP
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImapAccessDetails implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImapAccessDetails';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'secure_imap_server_host' => 'string',
'secure_imap_server_port' => 'int',
'secure_imap_username' => 'string',
'secure_imap_password' => 'string',
'imap_server_host' => 'string',
'imap_server_port' => 'int',
'imap_username' => 'string',
'imap_password' => 'string',
'imap_mailbox' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'secure_imap_server_host' => null,
'secure_imap_server_port' => 'int32',
'secure_imap_username' => null,
'secure_imap_password' => null,
'imap_server_host' => null,
'imap_server_port' => 'int32',
'imap_username' => null,
'imap_password' => null,
'imap_mailbox' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'secure_imap_server_host' => false,
'secure_imap_server_port' => false,
'secure_imap_username' => false,
'secure_imap_password' => false,
'imap_server_host' => false,
'imap_server_port' => false,
'imap_username' => false,
'imap_password' => false,
'imap_mailbox' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'secure_imap_server_host' => 'secureImapServerHost',
'secure_imap_server_port' => 'secureImapServerPort',
'secure_imap_username' => 'secureImapUsername',
'secure_imap_password' => 'secureImapPassword',
'imap_server_host' => 'imapServerHost',
'imap_server_port' => 'imapServerPort',
'imap_username' => 'imapUsername',
'imap_password' => 'imapPassword',
'imap_mailbox' => 'imapMailbox'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'secure_imap_server_host' => 'setSecureImapServerHost',
'secure_imap_server_port' => 'setSecureImapServerPort',
'secure_imap_username' => 'setSecureImapUsername',
'secure_imap_password' => 'setSecureImapPassword',
'imap_server_host' => 'setImapServerHost',
'imap_server_port' => 'setImapServerPort',
'imap_username' => 'setImapUsername',
'imap_password' => 'setImapPassword',
'imap_mailbox' => 'setImapMailbox'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'secure_imap_server_host' => 'getSecureImapServerHost',
'secure_imap_server_port' => 'getSecureImapServerPort',
'secure_imap_username' => 'getSecureImapUsername',
'secure_imap_password' => 'getSecureImapPassword',
'imap_server_host' => 'getImapServerHost',
'imap_server_port' => 'getImapServerPort',
'imap_username' => 'getImapUsername',
'imap_password' => 'getImapPassword',
'imap_mailbox' => 'getImapMailbox'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('secure_imap_server_host', $data ?? [], null);
$this->setIfExists('secure_imap_server_port', $data ?? [], null);
$this->setIfExists('secure_imap_username', $data ?? [], null);
$this->setIfExists('secure_imap_password', $data ?? [], null);
$this->setIfExists('imap_server_host', $data ?? [], null);
$this->setIfExists('imap_server_port', $data ?? [], null);
$this->setIfExists('imap_username', $data ?? [], null);
$this->setIfExists('imap_password', $data ?? [], null);
$this->setIfExists('imap_mailbox', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['secure_imap_server_host'] === null) {
$invalidProperties[] = "'secure_imap_server_host' can't be null";
}
if ($this->container['secure_imap_server_port'] === null) {
$invalidProperties[] = "'secure_imap_server_port' can't be null";
}
if ($this->container['secure_imap_username'] === null) {
$invalidProperties[] = "'secure_imap_username' can't be null";
}
if ($this->container['secure_imap_password'] === null) {
$invalidProperties[] = "'secure_imap_password' can't be null";
}
if ($this->container['imap_server_host'] === null) {
$invalidProperties[] = "'imap_server_host' can't be null";
}
if ($this->container['imap_server_port'] === null) {
$invalidProperties[] = "'imap_server_port' can't be null";
}
if ($this->container['imap_username'] === null) {
$invalidProperties[] = "'imap_username' can't be null";
}
if ($this->container['imap_password'] === null) {
$invalidProperties[] = "'imap_password' can't be null";
}
if ($this->container['imap_mailbox'] === null) {
$invalidProperties[] = "'imap_mailbox' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets secure_imap_server_host
*
* @return string
*/
public function getSecureImapServerHost()
{
return $this->container['secure_imap_server_host'];
}
/**
* Sets secure_imap_server_host
*
* @param string $secure_imap_server_host Secure TLS IMAP server host domain
*
* @return self
*/
public function setSecureImapServerHost($secure_imap_server_host)
{
if (is_null($secure_imap_server_host)) {
throw new \InvalidArgumentException('non-nullable secure_imap_server_host cannot be null');
}
$this->container['secure_imap_server_host'] = $secure_imap_server_host;
return $this;
}
/**
* Gets secure_imap_server_port
*
* @return int
*/
public function getSecureImapServerPort()
{
return $this->container['secure_imap_server_port'];
}
/**
* Sets secure_imap_server_port
*
* @param int $secure_imap_server_port Secure TLS IMAP server host port
*
* @return self
*/
public function setSecureImapServerPort($secure_imap_server_port)
{
if (is_null($secure_imap_server_port)) {
throw new \InvalidArgumentException('non-nullable secure_imap_server_port cannot be null');
}
$this->container['secure_imap_server_port'] = $secure_imap_server_port;
return $this;
}
/**
* Gets secure_imap_username
*
* @return string
*/
public function getSecureImapUsername()
{
return $this->container['secure_imap_username'];
}
/**
* Sets secure_imap_username
*
* @param string $secure_imap_username Secure TLS IMAP username for login
*
* @return self
*/
public function setSecureImapUsername($secure_imap_username)
{
if (is_null($secure_imap_username)) {
throw new \InvalidArgumentException('non-nullable secure_imap_username cannot be null');
}
$this->container['secure_imap_username'] = $secure_imap_username;
return $this;
}
/**
* Gets secure_imap_password
*
* @return string
*/
public function getSecureImapPassword()
{
return $this->container['secure_imap_password'];
}
/**
* Sets secure_imap_password
*
* @param string $secure_imap_password Secure TLS IMAP password for login
*
* @return self
*/
public function setSecureImapPassword($secure_imap_password)
{
if (is_null($secure_imap_password)) {
throw new \InvalidArgumentException('non-nullable secure_imap_password cannot be null');
}
$this->container['secure_imap_password'] = $secure_imap_password;
return $this;
}
/**
* Gets imap_server_host
*
* @return string
*/
public function getImapServerHost()
{
return $this->container['imap_server_host'];
}
/**
* Sets imap_server_host
*
* @param string $imap_server_host IMAP server host domain
*
* @return self
*/
public function setImapServerHost($imap_server_host)
{
if (is_null($imap_server_host)) {
throw new \InvalidArgumentException('non-nullable imap_server_host cannot be null');
}
$this->container['imap_server_host'] = $imap_server_host;
return $this;
}
/**
* Gets imap_server_port
*
* @return int
*/
public function getImapServerPort()
{
return $this->container['imap_server_port'];
}
/**
* Sets imap_server_port
*
* @param int $imap_server_port IMAP server host port
*
* @return self
*/
public function setImapServerPort($imap_server_port)
{
if (is_null($imap_server_port)) {
throw new \InvalidArgumentException('non-nullable imap_server_port cannot be null');
}
$this->container['imap_server_port'] = $imap_server_port;
return $this;
}
/**
* Gets imap_username
*
* @return string
*/
public function getImapUsername()
{
return $this->container['imap_username'];
}
/**
* Sets imap_username
*
* @param string $imap_username IMAP username for login
*
* @return self
*/
public function setImapUsername($imap_username)
{
if (is_null($imap_username)) {
throw new \InvalidArgumentException('non-nullable imap_username cannot be null');
}
$this->container['imap_username'] = $imap_username;
return $this;
}
/**
* Gets imap_password
*
* @return string
*/
public function getImapPassword()
{
return $this->container['imap_password'];
}
/**
* Sets imap_password
*
* @param string $imap_password IMAP password for login
*
* @return self
*/
public function setImapPassword($imap_password)
{
if (is_null($imap_password)) {
throw new \InvalidArgumentException('non-nullable imap_password cannot be null');
}
$this->container['imap_password'] = $imap_password;
return $this;
}
/**
* Gets imap_mailbox
*
* @return string
*/
public function getImapMailbox()
{
return $this->container['imap_mailbox'];
}
/**
* Sets imap_mailbox
*
* @param string $imap_mailbox IMAP mailbox to SELECT
*
* @return self
*/
public function setImapMailbox($imap_mailbox)
{
if (is_null($imap_mailbox)) {
throw new \InvalidArgumentException('non-nullable imap_mailbox cannot be null');
}
$this->container['imap_mailbox'] = $imap_mailbox;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ImageIssue
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ImageIssue Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ImageIssue implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ImageIssue';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'url' => 'string',
'response_status' => 'int',
'severity' => 'string',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'url' => null,
'response_status' => 'int32',
'severity' => null,
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'url' => false,
'response_status' => false,
'severity' => false,
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'url' => 'url',
'response_status' => 'responseStatus',
'severity' => 'severity',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'url' => 'setUrl',
'response_status' => 'setResponseStatus',
'severity' => 'setSeverity',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'url' => 'getUrl',
'response_status' => 'getResponseStatus',
'severity' => 'getSeverity',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SEVERITY_WARNING = 'Warning';
public const SEVERITY_ERROR = 'Error';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSeverityAllowableValues()
{
return [
self::SEVERITY_WARNING,
self::SEVERITY_ERROR,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('response_status', $data ?? [], null);
$this->setIfExists('severity', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
if ($this->container['severity'] === null) {
$invalidProperties[] = "'severity' can't be null";
}
$allowedValues = $this->getSeverityAllowableValues();
if (!is_null($this->container['severity']) && !in_array($this->container['severity'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'severity', must be one of '%s'",
$this->container['severity'],
implode("', '", $allowedValues)
);
}
if ($this->container['message'] === null) {
$invalidProperties[] = "'message' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url url
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets response_status
*
* @return int|null
*/
public function getResponseStatus()
{
return $this->container['response_status'];
}
/**
* Sets response_status
*
* @param int|null $response_status response_status
*
* @return self
*/
public function setResponseStatus($response_status)
{
if (is_null($response_status)) {
throw new \InvalidArgumentException('non-nullable response_status cannot be null');
}
$this->container['response_status'] = $response_status;
return $this;
}
/**
* Gets severity
*
* @return string
*/
public function getSeverity()
{
return $this->container['severity'];
}
/**
* Sets severity
*
* @param string $severity severity
*
* @return self
*/
public function setSeverity($severity)
{
$allowedValues = $this->getSeverityAllowableValues();
if (!in_array($severity, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'severity', must be one of '%s'",
$severity,
implode("', '", $allowedValues)
)
);
}
if (is_null($severity)) {
throw new \InvalidArgumentException('non-nullable severity cannot be null');
}
$this->container['severity'] = $severity;
return $this;
}
/**
* Gets message
*
* @return string
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* IPAddressResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* IPAddressResult Class Doc Comment
*
* @category Class
* @description IP Address look up result for a given domain / hostname
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class IPAddressResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'IPAddressResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'address' => 'string',
'hostname' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'address' => null,
'hostname' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'address' => false,
'hostname' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'address' => 'address',
'hostname' => 'hostname'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'address' => 'setAddress',
'hostname' => 'setHostname'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'address' => 'getAddress',
'hostname' => 'getHostname'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('address', $data ?? [], null);
$this->setIfExists('hostname', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['address'] === null) {
$invalidProperties[] = "'address' can't be null";
}
if ($this->container['hostname'] === null) {
$invalidProperties[] = "'hostname' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets address
*
* @return string
*/
public function getAddress()
{
return $this->container['address'];
}
/**
* Sets address
*
* @param string $address address
*
* @return self
*/
public function setAddress($address)
{
if (is_null($address)) {
throw new \InvalidArgumentException('non-nullable address cannot be null');
}
$this->container['address'] = $address;
return $this;
}
/**
* Gets hostname
*
* @return string
*/
public function getHostname()
{
return $this->container['hostname'];
}
/**
* Sets hostname
*
* @param string $hostname hostname
*
* @return self
*/
public function setHostname($hostname)
{
if (is_null($hostname)) {
throw new \InvalidArgumentException('non-nullable hostname cannot be null');
}
$this->container['hostname'] = $hostname;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* HTMLValidationResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* HTMLValidationResult Class Doc Comment
*
* @category Class
* @description HTML Validation Results
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class HTMLValidationResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'HTMLValidationResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'is_valid' => 'bool',
'infos' => '\MailSlurp\Models\ValidationMessage[]',
'errors' => '\MailSlurp\Models\ValidationMessage[]',
'warnings' => '\MailSlurp\Models\ValidationMessage[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'is_valid' => null,
'infos' => null,
'errors' => null,
'warnings' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'is_valid' => false,
'infos' => false,
'errors' => false,
'warnings' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'is_valid' => 'isValid',
'infos' => 'infos',
'errors' => 'errors',
'warnings' => 'warnings'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'is_valid' => 'setIsValid',
'infos' => 'setInfos',
'errors' => 'setErrors',
'warnings' => 'setWarnings'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'is_valid' => 'getIsValid',
'infos' => 'getInfos',
'errors' => 'getErrors',
'warnings' => 'getWarnings'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('is_valid', $data ?? [], null);
$this->setIfExists('infos', $data ?? [], null);
$this->setIfExists('errors', $data ?? [], null);
$this->setIfExists('warnings', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['is_valid'] === null) {
$invalidProperties[] = "'is_valid' can't be null";
}
if ($this->container['infos'] === null) {
$invalidProperties[] = "'infos' can't be null";
}
if ($this->container['errors'] === null) {
$invalidProperties[] = "'errors' can't be null";
}
if ($this->container['warnings'] === null) {
$invalidProperties[] = "'warnings' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets is_valid
*
* @return bool
*/
public function getIsValid()
{
return $this->container['is_valid'];
}
/**
* Sets is_valid
*
* @param bool $is_valid Is HTML validation result valid
*
* @return self
*/
public function setIsValid($is_valid)
{
if (is_null($is_valid)) {
throw new \InvalidArgumentException('non-nullable is_valid cannot be null');
}
$this->container['is_valid'] = $is_valid;
return $this;
}
/**
* Gets infos
*
* @return \MailSlurp\Models\ValidationMessage[]
*/
public function getInfos()
{
return $this->container['infos'];
}
/**
* Sets infos
*
* @param \MailSlurp\Models\ValidationMessage[] $infos Optional infos resulting from HTML validation
*
* @return self
*/
public function setInfos($infos)
{
if (is_null($infos)) {
throw new \InvalidArgumentException('non-nullable infos cannot be null');
}
$this->container['infos'] = $infos;
return $this;
}
/**
* Gets errors
*
* @return \MailSlurp\Models\ValidationMessage[]
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors
*
* @param \MailSlurp\Models\ValidationMessage[] $errors Optional errors resulting from HTML validation
*
* @return self
*/
public function setErrors($errors)
{
if (is_null($errors)) {
throw new \InvalidArgumentException('non-nullable errors cannot be null');
}
$this->container['errors'] = $errors;
return $this;
}
/**
* Gets warnings
*
* @return \MailSlurp\Models\ValidationMessage[]
*/
public function getWarnings()
{
return $this->container['warnings'];
}
/**
* Sets warnings
*
* @param \MailSlurp\Models\ValidationMessage[] $warnings Optional warnings resulting from HTML validation
*
* @return self
*/
public function setWarnings($warnings)
{
if (is_null($warnings)) {
throw new \InvalidArgumentException('non-nullable warnings cannot be null');
}
$this->container['warnings'] = $warnings;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GroupProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GroupProjection Class Doc Comment
*
* @category Class
* @description Data for contact group
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GroupProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GroupProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'name' => 'string',
'id' => 'string',
'description' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'name' => null,
'id' => 'uuid',
'description' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'name' => false,
'id' => false,
'description' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'name' => 'name',
'id' => 'id',
'description' => 'description'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'name' => 'setName',
'id' => 'setId',
'description' => 'setDescription'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'name' => 'getName',
'id' => 'getId',
'description' => 'getDescription'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description description
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
array_push($this->openAPINullablesSetToNull, 'description');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('description', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['description'] = $description;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GroupDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GroupDto Class Doc Comment
*
* @category Class
* @description Contact group data
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GroupDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GroupDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'name' => 'string',
'description' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'name' => null,
'description' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'name' => false,
'description' => true,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'name' => 'name',
'description' => 'description',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'name' => 'setName',
'description' => 'setDescription',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'name' => 'getName',
'description' => 'getDescription',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description description
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
array_push($this->openAPINullablesSetToNull, 'description');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('description', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['description'] = $description;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GroupContactsDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GroupContactsDto Class Doc Comment
*
* @category Class
* @description Describes contacts attached to a contact group
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GroupContactsDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GroupContactsDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'group' => '\MailSlurp\Models\GroupDto',
'contacts' => '\MailSlurp\Models\ContactDto[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'group' => null,
'contacts' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'group' => false,
'contacts' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'group' => 'group',
'contacts' => 'contacts'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'group' => 'setGroup',
'contacts' => 'setContacts'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'group' => 'getGroup',
'contacts' => 'getContacts'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('group', $data ?? [], null);
$this->setIfExists('contacts', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['group'] === null) {
$invalidProperties[] = "'group' can't be null";
}
if ($this->container['contacts'] === null) {
$invalidProperties[] = "'contacts' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets group
*
* @return \MailSlurp\Models\GroupDto
*/
public function getGroup()
{
return $this->container['group'];
}
/**
* Sets group
*
* @param \MailSlurp\Models\GroupDto $group group
*
* @return self
*/
public function setGroup($group)
{
if (is_null($group)) {
throw new \InvalidArgumentException('non-nullable group cannot be null');
}
$this->container['group'] = $group;
return $this;
}
/**
* Gets contacts
*
* @return \MailSlurp\Models\ContactDto[]
*/
public function getContacts()
{
return $this->container['contacts'];
}
/**
* Sets contacts
*
* @param \MailSlurp\Models\ContactDto[] $contacts contacts
*
* @return self
*/
public function setContacts($contacts)
{
if (is_null($contacts)) {
throw new \InvalidArgumentException('non-nullable contacts cannot be null');
}
$this->container['contacts'] = $contacts;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GravatarUrl
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GravatarUrl Class Doc Comment
*
* @category Class
* @description User image
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GravatarUrl implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GravatarUrl';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'url' => 'string',
'hash' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'url' => null,
'hash' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'url' => false,
'hash' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'url' => 'url',
'hash' => 'hash'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'url' => 'setUrl',
'hash' => 'setHash'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'url' => 'getUrl',
'hash' => 'getHash'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('hash', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
if ($this->container['hash'] === null) {
$invalidProperties[] = "'hash' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url url
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets hash
*
* @return string
*/
public function getHash()
{
return $this->container['hash'];
}
/**
* Sets hash
*
* @param string $hash hash
*
* @return self
*/
public function setHash($hash)
{
if (is_null($hash)) {
throw new \InvalidArgumentException('non-nullable hash cannot be null');
}
$this->container['hash'] = $hash;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GetEmailScreenshotOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GetEmailScreenshotOptions Class Doc Comment
*
* @category Class
* @description Options taking a screenshot capture of a rendered email
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GetEmailScreenshotOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GetEmailScreenshotOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'height' => 'int',
'width' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'height' => 'int32',
'width' => 'int32'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'height' => true,
'width' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'height' => 'height',
'width' => 'width'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'height' => 'setHeight',
'width' => 'setWidth'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'height' => 'getHeight',
'width' => 'getWidth'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('height', $data ?? [], null);
$this->setIfExists('width', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets height
*
* @return int|null
*/
public function getHeight()
{
return $this->container['height'];
}
/**
* Sets height
*
* @param int|null $height Window height in pixels
*
* @return self
*/
public function setHeight($height)
{
if (is_null($height)) {
array_push($this->openAPINullablesSetToNull, 'height');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('height', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['height'] = $height;
return $this;
}
/**
* Gets width
*
* @return int|null
*/
public function getWidth()
{
return $this->container['width'];
}
/**
* Sets width
*
* @param int|null $width Window width in pixels
*
* @return self
*/
public function setWidth($width)
{
if (is_null($width)) {
array_push($this->openAPINullablesSetToNull, 'width');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('width', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['width'] = $width;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateTlsReportingRecordResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateTlsReportingRecordResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateTlsReportingRecordResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateTlsReportingRecordResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'type' => 'string',
'ttl' => 'int',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'type' => null,
'ttl' => 'int32',
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'type' => false,
'ttl' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'type' => 'type',
'ttl' => 'ttl',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'type' => 'setType',
'ttl' => 'setTtl',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'type' => 'getType',
'ttl' => 'getTtl',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const TYPE_A = 'A';
public const TYPE_NS = 'NS';
public const TYPE_MD = 'MD';
public const TYPE_MF = 'MF';
public const TYPE_CNAME = 'CNAME';
public const TYPE_SOA = 'SOA';
public const TYPE_MB = 'MB';
public const TYPE_MG = 'MG';
public const TYPE_MR = 'MR';
public const TYPE_NULL = 'NULL';
public const TYPE_WKS = 'WKS';
public const TYPE_PTR = 'PTR';
public const TYPE_HINFO = 'HINFO';
public const TYPE_MINFO = 'MINFO';
public const TYPE_MX = 'MX';
public const TYPE_TXT = 'TXT';
public const TYPE_RP = 'RP';
public const TYPE_AFSDB = 'AFSDB';
public const TYPE_X25 = 'X25';
public const TYPE_ISDN = 'ISDN';
public const TYPE_RT = 'RT';
public const TYPE_NSAP = 'NSAP';
public const TYPE_NSAP_PTR = 'NSAP_PTR';
public const TYPE_SIG = 'SIG';
public const TYPE_KEY = 'KEY';
public const TYPE_PX = 'PX';
public const TYPE_GPOS = 'GPOS';
public const TYPE_AAAA = 'AAAA';
public const TYPE_LOC = 'LOC';
public const TYPE_NXT = 'NXT';
public const TYPE_EID = 'EID';
public const TYPE_NIMLOC = 'NIMLOC';
public const TYPE_SRV = 'SRV';
public const TYPE_ATMA = 'ATMA';
public const TYPE_NAPTR = 'NAPTR';
public const TYPE_KX = 'KX';
public const TYPE_CERT = 'CERT';
public const TYPE_A6 = 'A6';
public const TYPE_DNAME = 'DNAME';
public const TYPE_SINK = 'SINK';
public const TYPE_OPT = 'OPT';
public const TYPE_APL = 'APL';
public const TYPE_DS = 'DS';
public const TYPE_SSHFP = 'SSHFP';
public const TYPE_IPSECKEY = 'IPSECKEY';
public const TYPE_RRSIG = 'RRSIG';
public const TYPE_NSEC = 'NSEC';
public const TYPE_DNSKEY = 'DNSKEY';
public const TYPE_DHCID = 'DHCID';
public const TYPE_NSEC3 = 'NSEC3';
public const TYPE_NSEC3_PARAM = 'NSEC3PARAM';
public const TYPE_TLSA = 'TLSA';
public const TYPE_SMIMEA = 'SMIMEA';
public const TYPE_HIP = 'HIP';
public const TYPE_NINFO = 'NINFO';
public const TYPE_RKEY = 'RKEY';
public const TYPE_TALINK = 'TALINK';
public const TYPE_CDS = 'CDS';
public const TYPE_CDNSKEY = 'CDNSKEY';
public const TYPE_OPENPGPKEY = 'OPENPGPKEY';
public const TYPE_CSYNC = 'CSYNC';
public const TYPE_ZONEMD = 'ZONEMD';
public const TYPE_SVCB = 'SVCB';
public const TYPE_HTTPS = 'HTTPS';
public const TYPE_SPF = 'SPF';
public const TYPE_UINFO = 'UINFO';
public const TYPE_UID = 'UID';
public const TYPE_GID = 'GID';
public const TYPE_UNSPEC = 'UNSPEC';
public const TYPE_NID = 'NID';
public const TYPE_L32 = 'L32';
public const TYPE_L64 = 'L64';
public const TYPE_LP = 'LP';
public const TYPE_EUI48 = 'EUI48';
public const TYPE_EUI64 = 'EUI64';
public const TYPE_TKEY = 'TKEY';
public const TYPE_TSIG = 'TSIG';
public const TYPE_IXFR = 'IXFR';
public const TYPE_AXFR = 'AXFR';
public const TYPE_MAILB = 'MAILB';
public const TYPE_MAILA = 'MAILA';
public const TYPE_ANY = 'ANY';
public const TYPE_URI = 'URI';
public const TYPE_CAA = 'CAA';
public const TYPE_AVC = 'AVC';
public const TYPE_DOA = 'DOA';
public const TYPE_AMTRELAY = 'AMTRELAY';
public const TYPE_TA = 'TA';
public const TYPE_DLV = 'DLV';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getTypeAllowableValues()
{
return [
self::TYPE_A,
self::TYPE_NS,
self::TYPE_MD,
self::TYPE_MF,
self::TYPE_CNAME,
self::TYPE_SOA,
self::TYPE_MB,
self::TYPE_MG,
self::TYPE_MR,
self::TYPE_NULL,
self::TYPE_WKS,
self::TYPE_PTR,
self::TYPE_HINFO,
self::TYPE_MINFO,
self::TYPE_MX,
self::TYPE_TXT,
self::TYPE_RP,
self::TYPE_AFSDB,
self::TYPE_X25,
self::TYPE_ISDN,
self::TYPE_RT,
self::TYPE_NSAP,
self::TYPE_NSAP_PTR,
self::TYPE_SIG,
self::TYPE_KEY,
self::TYPE_PX,
self::TYPE_GPOS,
self::TYPE_AAAA,
self::TYPE_LOC,
self::TYPE_NXT,
self::TYPE_EID,
self::TYPE_NIMLOC,
self::TYPE_SRV,
self::TYPE_ATMA,
self::TYPE_NAPTR,
self::TYPE_KX,
self::TYPE_CERT,
self::TYPE_A6,
self::TYPE_DNAME,
self::TYPE_SINK,
self::TYPE_OPT,
self::TYPE_APL,
self::TYPE_DS,
self::TYPE_SSHFP,
self::TYPE_IPSECKEY,
self::TYPE_RRSIG,
self::TYPE_NSEC,
self::TYPE_DNSKEY,
self::TYPE_DHCID,
self::TYPE_NSEC3,
self::TYPE_NSEC3_PARAM,
self::TYPE_TLSA,
self::TYPE_SMIMEA,
self::TYPE_HIP,
self::TYPE_NINFO,
self::TYPE_RKEY,
self::TYPE_TALINK,
self::TYPE_CDS,
self::TYPE_CDNSKEY,
self::TYPE_OPENPGPKEY,
self::TYPE_CSYNC,
self::TYPE_ZONEMD,
self::TYPE_SVCB,
self::TYPE_HTTPS,
self::TYPE_SPF,
self::TYPE_UINFO,
self::TYPE_UID,
self::TYPE_GID,
self::TYPE_UNSPEC,
self::TYPE_NID,
self::TYPE_L32,
self::TYPE_L64,
self::TYPE_LP,
self::TYPE_EUI48,
self::TYPE_EUI64,
self::TYPE_TKEY,
self::TYPE_TSIG,
self::TYPE_IXFR,
self::TYPE_AXFR,
self::TYPE_MAILB,
self::TYPE_MAILA,
self::TYPE_ANY,
self::TYPE_URI,
self::TYPE_CAA,
self::TYPE_AVC,
self::TYPE_DOA,
self::TYPE_AMTRELAY,
self::TYPE_TA,
self::TYPE_DLV,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['type'] === null) {
$invalidProperties[] = "'type' can't be null";
}
$allowedValues = $this->getTypeAllowableValues();
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'type', must be one of '%s'",
$this->container['type'],
implode("', '", $allowedValues)
);
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets type
*
* @return string
*/
public function getType()
{
return $this->container['type'];
}
/**
* Sets type
*
* @param string $type Domain Name Server Record Types
*
* @return self
*/
public function setType($type)
{
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
$type,
implode("', '", $allowedValues)
)
);
}
if (is_null($type)) {
throw new \InvalidArgumentException('non-nullable type cannot be null');
}
$this->container['type'] = $type;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value value
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateTlsReportingRecordOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateTlsReportingRecordOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateTlsReportingRecordOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateTlsReportingRecordOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'reporting_addresses' => 'string[]',
'reporting_url' => 'string',
'host' => 'string',
'version' => 'string',
'ttl' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'reporting_addresses' => null,
'reporting_url' => null,
'host' => null,
'version' => null,
'ttl' => 'int32'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'reporting_addresses' => false,
'reporting_url' => false,
'host' => false,
'version' => false,
'ttl' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'reporting_addresses' => 'reportingAddresses',
'reporting_url' => 'reportingUrl',
'host' => 'host',
'version' => 'version',
'ttl' => 'ttl'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'reporting_addresses' => 'setReportingAddresses',
'reporting_url' => 'setReportingUrl',
'host' => 'setHost',
'version' => 'setVersion',
'ttl' => 'setTtl'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'reporting_addresses' => 'getReportingAddresses',
'reporting_url' => 'getReportingUrl',
'host' => 'getHost',
'version' => 'getVersion',
'ttl' => 'getTtl'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const VERSION_TLSRPTV1 = 'TLSRPTv1';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getVersionAllowableValues()
{
return [
self::VERSION_TLSRPTV1,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('reporting_addresses', $data ?? [], null);
$this->setIfExists('reporting_url', $data ?? [], null);
$this->setIfExists('host', $data ?? [], null);
$this->setIfExists('version', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['reporting_addresses'] === null) {
$invalidProperties[] = "'reporting_addresses' can't be null";
}
if ($this->container['host'] === null) {
$invalidProperties[] = "'host' can't be null";
}
if ($this->container['version'] === null) {
$invalidProperties[] = "'version' can't be null";
}
$allowedValues = $this->getVersionAllowableValues();
if (!is_null($this->container['version']) && !in_array($this->container['version'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'version', must be one of '%s'",
$this->container['version'],
implode("', '", $allowedValues)
);
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets reporting_addresses
*
* @return string[]
*/
public function getReportingAddresses()
{
return $this->container['reporting_addresses'];
}
/**
* Sets reporting_addresses
*
* @param string[] $reporting_addresses reporting_addresses
*
* @return self
*/
public function setReportingAddresses($reporting_addresses)
{
if (is_null($reporting_addresses)) {
throw new \InvalidArgumentException('non-nullable reporting_addresses cannot be null');
}
$this->container['reporting_addresses'] = $reporting_addresses;
return $this;
}
/**
* Gets reporting_url
*
* @return string|null
*/
public function getReportingUrl()
{
return $this->container['reporting_url'];
}
/**
* Sets reporting_url
*
* @param string|null $reporting_url reporting_url
*
* @return self
*/
public function setReportingUrl($reporting_url)
{
if (is_null($reporting_url)) {
throw new \InvalidArgumentException('non-nullable reporting_url cannot be null');
}
$this->container['reporting_url'] = $reporting_url;
return $this;
}
/**
* Gets host
*
* @return string
*/
public function getHost()
{
return $this->container['host'];
}
/**
* Sets host
*
* @param string $host host
*
* @return self
*/
public function setHost($host)
{
if (is_null($host)) {
throw new \InvalidArgumentException('non-nullable host cannot be null');
}
$this->container['host'] = $host;
return $this;
}
/**
* Gets version
*
* @return string
*/
public function getVersion()
{
return $this->container['version'];
}
/**
* Sets version
*
* @param string $version version
*
* @return self
*/
public function setVersion($version)
{
$allowedValues = $this->getVersionAllowableValues();
if (!in_array($version, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'version', must be one of '%s'",
$version,
implode("', '", $allowedValues)
)
);
}
if (is_null($version)) {
throw new \InvalidArgumentException('non-nullable version cannot be null');
}
$this->container['version'] = $version;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateMtaStsRecordResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateMtaStsRecordResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateMtaStsRecordResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateMtaStsRecordResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'type' => 'string',
'ttl' => 'int',
'value' => 'string',
'well_known_value' => 'string',
'well_known_url' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'type' => null,
'ttl' => 'int32',
'value' => null,
'well_known_value' => null,
'well_known_url' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'type' => false,
'ttl' => false,
'value' => false,
'well_known_value' => false,
'well_known_url' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'type' => 'type',
'ttl' => 'ttl',
'value' => 'value',
'well_known_value' => 'wellKnownValue',
'well_known_url' => 'wellKnownUrl'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'type' => 'setType',
'ttl' => 'setTtl',
'value' => 'setValue',
'well_known_value' => 'setWellKnownValue',
'well_known_url' => 'setWellKnownUrl'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'type' => 'getType',
'ttl' => 'getTtl',
'value' => 'getValue',
'well_known_value' => 'getWellKnownValue',
'well_known_url' => 'getWellKnownUrl'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const TYPE_A = 'A';
public const TYPE_NS = 'NS';
public const TYPE_MD = 'MD';
public const TYPE_MF = 'MF';
public const TYPE_CNAME = 'CNAME';
public const TYPE_SOA = 'SOA';
public const TYPE_MB = 'MB';
public const TYPE_MG = 'MG';
public const TYPE_MR = 'MR';
public const TYPE_NULL = 'NULL';
public const TYPE_WKS = 'WKS';
public const TYPE_PTR = 'PTR';
public const TYPE_HINFO = 'HINFO';
public const TYPE_MINFO = 'MINFO';
public const TYPE_MX = 'MX';
public const TYPE_TXT = 'TXT';
public const TYPE_RP = 'RP';
public const TYPE_AFSDB = 'AFSDB';
public const TYPE_X25 = 'X25';
public const TYPE_ISDN = 'ISDN';
public const TYPE_RT = 'RT';
public const TYPE_NSAP = 'NSAP';
public const TYPE_NSAP_PTR = 'NSAP_PTR';
public const TYPE_SIG = 'SIG';
public const TYPE_KEY = 'KEY';
public const TYPE_PX = 'PX';
public const TYPE_GPOS = 'GPOS';
public const TYPE_AAAA = 'AAAA';
public const TYPE_LOC = 'LOC';
public const TYPE_NXT = 'NXT';
public const TYPE_EID = 'EID';
public const TYPE_NIMLOC = 'NIMLOC';
public const TYPE_SRV = 'SRV';
public const TYPE_ATMA = 'ATMA';
public const TYPE_NAPTR = 'NAPTR';
public const TYPE_KX = 'KX';
public const TYPE_CERT = 'CERT';
public const TYPE_A6 = 'A6';
public const TYPE_DNAME = 'DNAME';
public const TYPE_SINK = 'SINK';
public const TYPE_OPT = 'OPT';
public const TYPE_APL = 'APL';
public const TYPE_DS = 'DS';
public const TYPE_SSHFP = 'SSHFP';
public const TYPE_IPSECKEY = 'IPSECKEY';
public const TYPE_RRSIG = 'RRSIG';
public const TYPE_NSEC = 'NSEC';
public const TYPE_DNSKEY = 'DNSKEY';
public const TYPE_DHCID = 'DHCID';
public const TYPE_NSEC3 = 'NSEC3';
public const TYPE_NSEC3_PARAM = 'NSEC3PARAM';
public const TYPE_TLSA = 'TLSA';
public const TYPE_SMIMEA = 'SMIMEA';
public const TYPE_HIP = 'HIP';
public const TYPE_NINFO = 'NINFO';
public const TYPE_RKEY = 'RKEY';
public const TYPE_TALINK = 'TALINK';
public const TYPE_CDS = 'CDS';
public const TYPE_CDNSKEY = 'CDNSKEY';
public const TYPE_OPENPGPKEY = 'OPENPGPKEY';
public const TYPE_CSYNC = 'CSYNC';
public const TYPE_ZONEMD = 'ZONEMD';
public const TYPE_SVCB = 'SVCB';
public const TYPE_HTTPS = 'HTTPS';
public const TYPE_SPF = 'SPF';
public const TYPE_UINFO = 'UINFO';
public const TYPE_UID = 'UID';
public const TYPE_GID = 'GID';
public const TYPE_UNSPEC = 'UNSPEC';
public const TYPE_NID = 'NID';
public const TYPE_L32 = 'L32';
public const TYPE_L64 = 'L64';
public const TYPE_LP = 'LP';
public const TYPE_EUI48 = 'EUI48';
public const TYPE_EUI64 = 'EUI64';
public const TYPE_TKEY = 'TKEY';
public const TYPE_TSIG = 'TSIG';
public const TYPE_IXFR = 'IXFR';
public const TYPE_AXFR = 'AXFR';
public const TYPE_MAILB = 'MAILB';
public const TYPE_MAILA = 'MAILA';
public const TYPE_ANY = 'ANY';
public const TYPE_URI = 'URI';
public const TYPE_CAA = 'CAA';
public const TYPE_AVC = 'AVC';
public const TYPE_DOA = 'DOA';
public const TYPE_AMTRELAY = 'AMTRELAY';
public const TYPE_TA = 'TA';
public const TYPE_DLV = 'DLV';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getTypeAllowableValues()
{
return [
self::TYPE_A,
self::TYPE_NS,
self::TYPE_MD,
self::TYPE_MF,
self::TYPE_CNAME,
self::TYPE_SOA,
self::TYPE_MB,
self::TYPE_MG,
self::TYPE_MR,
self::TYPE_NULL,
self::TYPE_WKS,
self::TYPE_PTR,
self::TYPE_HINFO,
self::TYPE_MINFO,
self::TYPE_MX,
self::TYPE_TXT,
self::TYPE_RP,
self::TYPE_AFSDB,
self::TYPE_X25,
self::TYPE_ISDN,
self::TYPE_RT,
self::TYPE_NSAP,
self::TYPE_NSAP_PTR,
self::TYPE_SIG,
self::TYPE_KEY,
self::TYPE_PX,
self::TYPE_GPOS,
self::TYPE_AAAA,
self::TYPE_LOC,
self::TYPE_NXT,
self::TYPE_EID,
self::TYPE_NIMLOC,
self::TYPE_SRV,
self::TYPE_ATMA,
self::TYPE_NAPTR,
self::TYPE_KX,
self::TYPE_CERT,
self::TYPE_A6,
self::TYPE_DNAME,
self::TYPE_SINK,
self::TYPE_OPT,
self::TYPE_APL,
self::TYPE_DS,
self::TYPE_SSHFP,
self::TYPE_IPSECKEY,
self::TYPE_RRSIG,
self::TYPE_NSEC,
self::TYPE_DNSKEY,
self::TYPE_DHCID,
self::TYPE_NSEC3,
self::TYPE_NSEC3_PARAM,
self::TYPE_TLSA,
self::TYPE_SMIMEA,
self::TYPE_HIP,
self::TYPE_NINFO,
self::TYPE_RKEY,
self::TYPE_TALINK,
self::TYPE_CDS,
self::TYPE_CDNSKEY,
self::TYPE_OPENPGPKEY,
self::TYPE_CSYNC,
self::TYPE_ZONEMD,
self::TYPE_SVCB,
self::TYPE_HTTPS,
self::TYPE_SPF,
self::TYPE_UINFO,
self::TYPE_UID,
self::TYPE_GID,
self::TYPE_UNSPEC,
self::TYPE_NID,
self::TYPE_L32,
self::TYPE_L64,
self::TYPE_LP,
self::TYPE_EUI48,
self::TYPE_EUI64,
self::TYPE_TKEY,
self::TYPE_TSIG,
self::TYPE_IXFR,
self::TYPE_AXFR,
self::TYPE_MAILB,
self::TYPE_MAILA,
self::TYPE_ANY,
self::TYPE_URI,
self::TYPE_CAA,
self::TYPE_AVC,
self::TYPE_DOA,
self::TYPE_AMTRELAY,
self::TYPE_TA,
self::TYPE_DLV,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
$this->setIfExists('well_known_value', $data ?? [], null);
$this->setIfExists('well_known_url', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['type'] === null) {
$invalidProperties[] = "'type' can't be null";
}
$allowedValues = $this->getTypeAllowableValues();
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'type', must be one of '%s'",
$this->container['type'],
implode("', '", $allowedValues)
);
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
if ($this->container['well_known_value'] === null) {
$invalidProperties[] = "'well_known_value' can't be null";
}
if ($this->container['well_known_url'] === null) {
$invalidProperties[] = "'well_known_url' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets type
*
* @return string
*/
public function getType()
{
return $this->container['type'];
}
/**
* Sets type
*
* @param string $type Domain Name Server Record Types
*
* @return self
*/
public function setType($type)
{
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
$type,
implode("', '", $allowedValues)
)
);
}
if (is_null($type)) {
throw new \InvalidArgumentException('non-nullable type cannot be null');
}
$this->container['type'] = $type;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value value
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Gets well_known_value
*
* @return string
*/
public function getWellKnownValue()
{
return $this->container['well_known_value'];
}
/**
* Sets well_known_value
*
* @param string $well_known_value well_known_value
*
* @return self
*/
public function setWellKnownValue($well_known_value)
{
if (is_null($well_known_value)) {
throw new \InvalidArgumentException('non-nullable well_known_value cannot be null');
}
$this->container['well_known_value'] = $well_known_value;
return $this;
}
/**
* Gets well_known_url
*
* @return string
*/
public function getWellKnownUrl()
{
return $this->container['well_known_url'];
}
/**
* Sets well_known_url
*
* @param string $well_known_url well_known_url
*
* @return self
*/
public function setWellKnownUrl($well_known_url)
{
if (is_null($well_known_url)) {
throw new \InvalidArgumentException('non-nullable well_known_url cannot be null');
}
$this->container['well_known_url'] = $well_known_url;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateMtaStsRecordOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateMtaStsRecordOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateMtaStsRecordOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateMtaStsRecordOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'host' => 'string',
'version' => 'string',
'mode' => 'string',
'ttl' => 'int',
'max_age_seconds' => 'int',
'mx_records' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'host' => null,
'version' => null,
'mode' => null,
'ttl' => 'int32',
'max_age_seconds' => 'int32',
'mx_records' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'host' => false,
'version' => false,
'mode' => false,
'ttl' => false,
'max_age_seconds' => false,
'mx_records' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'host' => 'host',
'version' => 'version',
'mode' => 'mode',
'ttl' => 'ttl',
'max_age_seconds' => 'maxAgeSeconds',
'mx_records' => 'mxRecords'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'host' => 'setHost',
'version' => 'setVersion',
'mode' => 'setMode',
'ttl' => 'setTtl',
'max_age_seconds' => 'setMaxAgeSeconds',
'mx_records' => 'setMxRecords'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'host' => 'getHost',
'version' => 'getVersion',
'mode' => 'getMode',
'ttl' => 'getTtl',
'max_age_seconds' => 'getMaxAgeSeconds',
'mx_records' => 'getMxRecords'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const VERSION_STSV1 = 'STSv1';
public const MODE_TESTING = 'TESTING';
public const MODE_ENFORCE = 'ENFORCE';
public const MODE_NONE = 'NONE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getVersionAllowableValues()
{
return [
self::VERSION_STSV1,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getModeAllowableValues()
{
return [
self::MODE_TESTING,
self::MODE_ENFORCE,
self::MODE_NONE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('host', $data ?? [], null);
$this->setIfExists('version', $data ?? [], null);
$this->setIfExists('mode', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
$this->setIfExists('max_age_seconds', $data ?? [], null);
$this->setIfExists('mx_records', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['host'] === null) {
$invalidProperties[] = "'host' can't be null";
}
if ($this->container['version'] === null) {
$invalidProperties[] = "'version' can't be null";
}
$allowedValues = $this->getVersionAllowableValues();
if (!is_null($this->container['version']) && !in_array($this->container['version'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'version', must be one of '%s'",
$this->container['version'],
implode("', '", $allowedValues)
);
}
if ($this->container['mode'] === null) {
$invalidProperties[] = "'mode' can't be null";
}
$allowedValues = $this->getModeAllowableValues();
if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'mode', must be one of '%s'",
$this->container['mode'],
implode("', '", $allowedValues)
);
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
if ($this->container['max_age_seconds'] === null) {
$invalidProperties[] = "'max_age_seconds' can't be null";
}
if ($this->container['mx_records'] === null) {
$invalidProperties[] = "'mx_records' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets host
*
* @return string
*/
public function getHost()
{
return $this->container['host'];
}
/**
* Sets host
*
* @param string $host host
*
* @return self
*/
public function setHost($host)
{
if (is_null($host)) {
throw new \InvalidArgumentException('non-nullable host cannot be null');
}
$this->container['host'] = $host;
return $this;
}
/**
* Gets version
*
* @return string
*/
public function getVersion()
{
return $this->container['version'];
}
/**
* Sets version
*
* @param string $version version
*
* @return self
*/
public function setVersion($version)
{
$allowedValues = $this->getVersionAllowableValues();
if (!in_array($version, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'version', must be one of '%s'",
$version,
implode("', '", $allowedValues)
)
);
}
if (is_null($version)) {
throw new \InvalidArgumentException('non-nullable version cannot be null');
}
$this->container['version'] = $version;
return $this;
}
/**
* Gets mode
*
* @return string
*/
public function getMode()
{
return $this->container['mode'];
}
/**
* Sets mode
*
* @param string $mode mode
*
* @return self
*/
public function setMode($mode)
{
$allowedValues = $this->getModeAllowableValues();
if (!in_array($mode, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'mode', must be one of '%s'",
$mode,
implode("', '", $allowedValues)
)
);
}
if (is_null($mode)) {
throw new \InvalidArgumentException('non-nullable mode cannot be null');
}
$this->container['mode'] = $mode;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Gets max_age_seconds
*
* @return int
*/
public function getMaxAgeSeconds()
{
return $this->container['max_age_seconds'];
}
/**
* Sets max_age_seconds
*
* @param int $max_age_seconds max_age_seconds
*
* @return self
*/
public function setMaxAgeSeconds($max_age_seconds)
{
if (is_null($max_age_seconds)) {
throw new \InvalidArgumentException('non-nullable max_age_seconds cannot be null');
}
$this->container['max_age_seconds'] = $max_age_seconds;
return $this;
}
/**
* Gets mx_records
*
* @return string[]
*/
public function getMxRecords()
{
return $this->container['mx_records'];
}
/**
* Sets mx_records
*
* @param string[] $mx_records mx_records
*
* @return self
*/
public function setMxRecords($mx_records)
{
if (is_null($mx_records)) {
throw new \InvalidArgumentException('non-nullable mx_records cannot be null');
}
$this->container['mx_records'] = $mx_records;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateDmarcRecordResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateDmarcRecordResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateDmarcRecordResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateDmarcRecordResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'type' => 'string',
'ttl' => 'int',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'type' => null,
'ttl' => 'int32',
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'type' => false,
'ttl' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'type' => 'type',
'ttl' => 'ttl',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'type' => 'setType',
'ttl' => 'setTtl',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'type' => 'getType',
'ttl' => 'getTtl',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const TYPE_A = 'A';
public const TYPE_NS = 'NS';
public const TYPE_MD = 'MD';
public const TYPE_MF = 'MF';
public const TYPE_CNAME = 'CNAME';
public const TYPE_SOA = 'SOA';
public const TYPE_MB = 'MB';
public const TYPE_MG = 'MG';
public const TYPE_MR = 'MR';
public const TYPE_NULL = 'NULL';
public const TYPE_WKS = 'WKS';
public const TYPE_PTR = 'PTR';
public const TYPE_HINFO = 'HINFO';
public const TYPE_MINFO = 'MINFO';
public const TYPE_MX = 'MX';
public const TYPE_TXT = 'TXT';
public const TYPE_RP = 'RP';
public const TYPE_AFSDB = 'AFSDB';
public const TYPE_X25 = 'X25';
public const TYPE_ISDN = 'ISDN';
public const TYPE_RT = 'RT';
public const TYPE_NSAP = 'NSAP';
public const TYPE_NSAP_PTR = 'NSAP_PTR';
public const TYPE_SIG = 'SIG';
public const TYPE_KEY = 'KEY';
public const TYPE_PX = 'PX';
public const TYPE_GPOS = 'GPOS';
public const TYPE_AAAA = 'AAAA';
public const TYPE_LOC = 'LOC';
public const TYPE_NXT = 'NXT';
public const TYPE_EID = 'EID';
public const TYPE_NIMLOC = 'NIMLOC';
public const TYPE_SRV = 'SRV';
public const TYPE_ATMA = 'ATMA';
public const TYPE_NAPTR = 'NAPTR';
public const TYPE_KX = 'KX';
public const TYPE_CERT = 'CERT';
public const TYPE_A6 = 'A6';
public const TYPE_DNAME = 'DNAME';
public const TYPE_SINK = 'SINK';
public const TYPE_OPT = 'OPT';
public const TYPE_APL = 'APL';
public const TYPE_DS = 'DS';
public const TYPE_SSHFP = 'SSHFP';
public const TYPE_IPSECKEY = 'IPSECKEY';
public const TYPE_RRSIG = 'RRSIG';
public const TYPE_NSEC = 'NSEC';
public const TYPE_DNSKEY = 'DNSKEY';
public const TYPE_DHCID = 'DHCID';
public const TYPE_NSEC3 = 'NSEC3';
public const TYPE_NSEC3_PARAM = 'NSEC3PARAM';
public const TYPE_TLSA = 'TLSA';
public const TYPE_SMIMEA = 'SMIMEA';
public const TYPE_HIP = 'HIP';
public const TYPE_NINFO = 'NINFO';
public const TYPE_RKEY = 'RKEY';
public const TYPE_TALINK = 'TALINK';
public const TYPE_CDS = 'CDS';
public const TYPE_CDNSKEY = 'CDNSKEY';
public const TYPE_OPENPGPKEY = 'OPENPGPKEY';
public const TYPE_CSYNC = 'CSYNC';
public const TYPE_ZONEMD = 'ZONEMD';
public const TYPE_SVCB = 'SVCB';
public const TYPE_HTTPS = 'HTTPS';
public const TYPE_SPF = 'SPF';
public const TYPE_UINFO = 'UINFO';
public const TYPE_UID = 'UID';
public const TYPE_GID = 'GID';
public const TYPE_UNSPEC = 'UNSPEC';
public const TYPE_NID = 'NID';
public const TYPE_L32 = 'L32';
public const TYPE_L64 = 'L64';
public const TYPE_LP = 'LP';
public const TYPE_EUI48 = 'EUI48';
public const TYPE_EUI64 = 'EUI64';
public const TYPE_TKEY = 'TKEY';
public const TYPE_TSIG = 'TSIG';
public const TYPE_IXFR = 'IXFR';
public const TYPE_AXFR = 'AXFR';
public const TYPE_MAILB = 'MAILB';
public const TYPE_MAILA = 'MAILA';
public const TYPE_ANY = 'ANY';
public const TYPE_URI = 'URI';
public const TYPE_CAA = 'CAA';
public const TYPE_AVC = 'AVC';
public const TYPE_DOA = 'DOA';
public const TYPE_AMTRELAY = 'AMTRELAY';
public const TYPE_TA = 'TA';
public const TYPE_DLV = 'DLV';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getTypeAllowableValues()
{
return [
self::TYPE_A,
self::TYPE_NS,
self::TYPE_MD,
self::TYPE_MF,
self::TYPE_CNAME,
self::TYPE_SOA,
self::TYPE_MB,
self::TYPE_MG,
self::TYPE_MR,
self::TYPE_NULL,
self::TYPE_WKS,
self::TYPE_PTR,
self::TYPE_HINFO,
self::TYPE_MINFO,
self::TYPE_MX,
self::TYPE_TXT,
self::TYPE_RP,
self::TYPE_AFSDB,
self::TYPE_X25,
self::TYPE_ISDN,
self::TYPE_RT,
self::TYPE_NSAP,
self::TYPE_NSAP_PTR,
self::TYPE_SIG,
self::TYPE_KEY,
self::TYPE_PX,
self::TYPE_GPOS,
self::TYPE_AAAA,
self::TYPE_LOC,
self::TYPE_NXT,
self::TYPE_EID,
self::TYPE_NIMLOC,
self::TYPE_SRV,
self::TYPE_ATMA,
self::TYPE_NAPTR,
self::TYPE_KX,
self::TYPE_CERT,
self::TYPE_A6,
self::TYPE_DNAME,
self::TYPE_SINK,
self::TYPE_OPT,
self::TYPE_APL,
self::TYPE_DS,
self::TYPE_SSHFP,
self::TYPE_IPSECKEY,
self::TYPE_RRSIG,
self::TYPE_NSEC,
self::TYPE_DNSKEY,
self::TYPE_DHCID,
self::TYPE_NSEC3,
self::TYPE_NSEC3_PARAM,
self::TYPE_TLSA,
self::TYPE_SMIMEA,
self::TYPE_HIP,
self::TYPE_NINFO,
self::TYPE_RKEY,
self::TYPE_TALINK,
self::TYPE_CDS,
self::TYPE_CDNSKEY,
self::TYPE_OPENPGPKEY,
self::TYPE_CSYNC,
self::TYPE_ZONEMD,
self::TYPE_SVCB,
self::TYPE_HTTPS,
self::TYPE_SPF,
self::TYPE_UINFO,
self::TYPE_UID,
self::TYPE_GID,
self::TYPE_UNSPEC,
self::TYPE_NID,
self::TYPE_L32,
self::TYPE_L64,
self::TYPE_LP,
self::TYPE_EUI48,
self::TYPE_EUI64,
self::TYPE_TKEY,
self::TYPE_TSIG,
self::TYPE_IXFR,
self::TYPE_AXFR,
self::TYPE_MAILB,
self::TYPE_MAILA,
self::TYPE_ANY,
self::TYPE_URI,
self::TYPE_CAA,
self::TYPE_AVC,
self::TYPE_DOA,
self::TYPE_AMTRELAY,
self::TYPE_TA,
self::TYPE_DLV,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['type'] === null) {
$invalidProperties[] = "'type' can't be null";
}
$allowedValues = $this->getTypeAllowableValues();
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'type', must be one of '%s'",
$this->container['type'],
implode("', '", $allowedValues)
);
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets type
*
* @return string
*/
public function getType()
{
return $this->container['type'];
}
/**
* Sets type
*
* @param string $type Domain Name Server Record Types
*
* @return self
*/
public function setType($type)
{
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
$type,
implode("', '", $allowedValues)
)
);
}
if (is_null($type)) {
throw new \InvalidArgumentException('non-nullable type cannot be null');
}
$this->container['type'] = $type;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value value
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateDmarcRecordOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateDmarcRecordOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateDmarcRecordOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateDmarcRecordOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'domain' => 'string',
'version' => 'string',
'policy' => 'string',
'subdomain_policy' => 'string',
'report_email_address' => 'string[]',
'forensic_email_address' => 'string[]',
'percentage' => 'int',
'report_format' => 'string',
'seconds_between_reports' => 'int',
'adkim' => 'string',
'aspf' => 'string',
'fo' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'domain' => null,
'version' => null,
'policy' => null,
'subdomain_policy' => null,
'report_email_address' => null,
'forensic_email_address' => null,
'percentage' => 'int32',
'report_format' => null,
'seconds_between_reports' => 'int32',
'adkim' => null,
'aspf' => null,
'fo' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'domain' => false,
'version' => false,
'policy' => false,
'subdomain_policy' => false,
'report_email_address' => false,
'forensic_email_address' => false,
'percentage' => false,
'report_format' => false,
'seconds_between_reports' => false,
'adkim' => false,
'aspf' => false,
'fo' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'domain' => 'domain',
'version' => 'version',
'policy' => 'policy',
'subdomain_policy' => 'subdomainPolicy',
'report_email_address' => 'reportEmailAddress',
'forensic_email_address' => 'forensicEmailAddress',
'percentage' => 'percentage',
'report_format' => 'reportFormat',
'seconds_between_reports' => 'secondsBetweenReports',
'adkim' => 'adkim',
'aspf' => 'aspf',
'fo' => 'fo'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'domain' => 'setDomain',
'version' => 'setVersion',
'policy' => 'setPolicy',
'subdomain_policy' => 'setSubdomainPolicy',
'report_email_address' => 'setReportEmailAddress',
'forensic_email_address' => 'setForensicEmailAddress',
'percentage' => 'setPercentage',
'report_format' => 'setReportFormat',
'seconds_between_reports' => 'setSecondsBetweenReports',
'adkim' => 'setAdkim',
'aspf' => 'setAspf',
'fo' => 'setFo'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'domain' => 'getDomain',
'version' => 'getVersion',
'policy' => 'getPolicy',
'subdomain_policy' => 'getSubdomainPolicy',
'report_email_address' => 'getReportEmailAddress',
'forensic_email_address' => 'getForensicEmailAddress',
'percentage' => 'getPercentage',
'report_format' => 'getReportFormat',
'seconds_between_reports' => 'getSecondsBetweenReports',
'adkim' => 'getAdkim',
'aspf' => 'getAspf',
'fo' => 'getFo'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const VERSION_DMARC1 = 'DMARC1';
public const POLICY_NONE = 'NONE';
public const POLICY_QUARANTINE = 'QUARANTINE';
public const POLICY_REJECT = 'REJECT';
public const SUBDOMAIN_POLICY_NONE = 'NONE';
public const SUBDOMAIN_POLICY_QUARANTINE = 'QUARANTINE';
public const SUBDOMAIN_POLICY_REJECT = 'REJECT';
public const REPORT_FORMAT_AFRF = 'AFRF';
public const ADKIM_STRICT = 'STRICT';
public const ADKIM_RELAXED = 'RELAXED';
public const ASPF_STRICT = 'STRICT';
public const ASPF_RELAXED = 'RELAXED';
public const FO__0 = 'FO_0';
public const FO__1 = 'FO_1';
public const FO_D = 'FO_D';
public const FO_S = 'FO_S';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getVersionAllowableValues()
{
return [
self::VERSION_DMARC1,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getPolicyAllowableValues()
{
return [
self::POLICY_NONE,
self::POLICY_QUARANTINE,
self::POLICY_REJECT,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSubdomainPolicyAllowableValues()
{
return [
self::SUBDOMAIN_POLICY_NONE,
self::SUBDOMAIN_POLICY_QUARANTINE,
self::SUBDOMAIN_POLICY_REJECT,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getReportFormatAllowableValues()
{
return [
self::REPORT_FORMAT_AFRF,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getAdkimAllowableValues()
{
return [
self::ADKIM_STRICT,
self::ADKIM_RELAXED,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getAspfAllowableValues()
{
return [
self::ASPF_STRICT,
self::ASPF_RELAXED,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFoAllowableValues()
{
return [
self::FO__0,
self::FO__1,
self::FO_D,
self::FO_S,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('domain', $data ?? [], null);
$this->setIfExists('version', $data ?? [], null);
$this->setIfExists('policy', $data ?? [], null);
$this->setIfExists('subdomain_policy', $data ?? [], null);
$this->setIfExists('report_email_address', $data ?? [], null);
$this->setIfExists('forensic_email_address', $data ?? [], null);
$this->setIfExists('percentage', $data ?? [], null);
$this->setIfExists('report_format', $data ?? [], null);
$this->setIfExists('seconds_between_reports', $data ?? [], null);
$this->setIfExists('adkim', $data ?? [], null);
$this->setIfExists('aspf', $data ?? [], null);
$this->setIfExists('fo', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['domain'] === null) {
$invalidProperties[] = "'domain' can't be null";
}
if ($this->container['version'] === null) {
$invalidProperties[] = "'version' can't be null";
}
$allowedValues = $this->getVersionAllowableValues();
if (!is_null($this->container['version']) && !in_array($this->container['version'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'version', must be one of '%s'",
$this->container['version'],
implode("', '", $allowedValues)
);
}
if ($this->container['policy'] === null) {
$invalidProperties[] = "'policy' can't be null";
}
$allowedValues = $this->getPolicyAllowableValues();
if (!is_null($this->container['policy']) && !in_array($this->container['policy'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'policy', must be one of '%s'",
$this->container['policy'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getSubdomainPolicyAllowableValues();
if (!is_null($this->container['subdomain_policy']) && !in_array($this->container['subdomain_policy'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'subdomain_policy', must be one of '%s'",
$this->container['subdomain_policy'],
implode("', '", $allowedValues)
);
}
if (!is_null($this->container['percentage']) && ($this->container['percentage'] > 100)) {
$invalidProperties[] = "invalid value for 'percentage', must be smaller than or equal to 100.";
}
if (!is_null($this->container['percentage']) && ($this->container['percentage'] < 1)) {
$invalidProperties[] = "invalid value for 'percentage', must be bigger than or equal to 1.";
}
$allowedValues = $this->getReportFormatAllowableValues();
if (!is_null($this->container['report_format']) && !in_array($this->container['report_format'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'report_format', must be one of '%s'",
$this->container['report_format'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getAdkimAllowableValues();
if (!is_null($this->container['adkim']) && !in_array($this->container['adkim'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'adkim', must be one of '%s'",
$this->container['adkim'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getAspfAllowableValues();
if (!is_null($this->container['aspf']) && !in_array($this->container['aspf'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'aspf', must be one of '%s'",
$this->container['aspf'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getFoAllowableValues();
if (!is_null($this->container['fo']) && !in_array($this->container['fo'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'fo', must be one of '%s'",
$this->container['fo'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets domain
*
* @return string
*/
public function getDomain()
{
return $this->container['domain'];
}
/**
* Sets domain
*
* @param string $domain domain
*
* @return self
*/
public function setDomain($domain)
{
if (is_null($domain)) {
throw new \InvalidArgumentException('non-nullable domain cannot be null');
}
$this->container['domain'] = $domain;
return $this;
}
/**
* Gets version
*
* @return string
*/
public function getVersion()
{
return $this->container['version'];
}
/**
* Sets version
*
* @param string $version version
*
* @return self
*/
public function setVersion($version)
{
$allowedValues = $this->getVersionAllowableValues();
if (!in_array($version, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'version', must be one of '%s'",
$version,
implode("', '", $allowedValues)
)
);
}
if (is_null($version)) {
throw new \InvalidArgumentException('non-nullable version cannot be null');
}
$this->container['version'] = $version;
return $this;
}
/**
* Gets policy
*
* @return string
*/
public function getPolicy()
{
return $this->container['policy'];
}
/**
* Sets policy
*
* @param string $policy policy
*
* @return self
*/
public function setPolicy($policy)
{
$allowedValues = $this->getPolicyAllowableValues();
if (!in_array($policy, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'policy', must be one of '%s'",
$policy,
implode("', '", $allowedValues)
)
);
}
if (is_null($policy)) {
throw new \InvalidArgumentException('non-nullable policy cannot be null');
}
$this->container['policy'] = $policy;
return $this;
}
/**
* Gets subdomain_policy
*
* @return string|null
*/
public function getSubdomainPolicy()
{
return $this->container['subdomain_policy'];
}
/**
* Sets subdomain_policy
*
* @param string|null $subdomain_policy subdomain_policy
*
* @return self
*/
public function setSubdomainPolicy($subdomain_policy)
{
$allowedValues = $this->getSubdomainPolicyAllowableValues();
if (!is_null($subdomain_policy) && !in_array($subdomain_policy, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'subdomain_policy', must be one of '%s'",
$subdomain_policy,
implode("', '", $allowedValues)
)
);
}
if (is_null($subdomain_policy)) {
throw new \InvalidArgumentException('non-nullable subdomain_policy cannot be null');
}
$this->container['subdomain_policy'] = $subdomain_policy;
return $this;
}
/**
* Gets report_email_address
*
* @return string[]|null
*/
public function getReportEmailAddress()
{
return $this->container['report_email_address'];
}
/**
* Sets report_email_address
*
* @param string[]|null $report_email_address report_email_address
*
* @return self
*/
public function setReportEmailAddress($report_email_address)
{
if (is_null($report_email_address)) {
throw new \InvalidArgumentException('non-nullable report_email_address cannot be null');
}
$this->container['report_email_address'] = $report_email_address;
return $this;
}
/**
* Gets forensic_email_address
*
* @return string[]|null
*/
public function getForensicEmailAddress()
{
return $this->container['forensic_email_address'];
}
/**
* Sets forensic_email_address
*
* @param string[]|null $forensic_email_address forensic_email_address
*
* @return self
*/
public function setForensicEmailAddress($forensic_email_address)
{
if (is_null($forensic_email_address)) {
throw new \InvalidArgumentException('non-nullable forensic_email_address cannot be null');
}
$this->container['forensic_email_address'] = $forensic_email_address;
return $this;
}
/**
* Gets percentage
*
* @return int|null
*/
public function getPercentage()
{
return $this->container['percentage'];
}
/**
* Sets percentage
*
* @param int|null $percentage percentage
*
* @return self
*/
public function setPercentage($percentage)
{
if (!is_null($percentage) && ($percentage > 100)) {
throw new \InvalidArgumentException('invalid value for $percentage when calling GenerateDmarcRecordOptions., must be smaller than or equal to 100.');
}
if (!is_null($percentage) && ($percentage < 1)) {
throw new \InvalidArgumentException('invalid value for $percentage when calling GenerateDmarcRecordOptions., must be bigger than or equal to 1.');
}
if (is_null($percentage)) {
throw new \InvalidArgumentException('non-nullable percentage cannot be null');
}
$this->container['percentage'] = $percentage;
return $this;
}
/**
* Gets report_format
*
* @return string|null
*/
public function getReportFormat()
{
return $this->container['report_format'];
}
/**
* Sets report_format
*
* @param string|null $report_format report_format
*
* @return self
*/
public function setReportFormat($report_format)
{
$allowedValues = $this->getReportFormatAllowableValues();
if (!is_null($report_format) && !in_array($report_format, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'report_format', must be one of '%s'",
$report_format,
implode("', '", $allowedValues)
)
);
}
if (is_null($report_format)) {
throw new \InvalidArgumentException('non-nullable report_format cannot be null');
}
$this->container['report_format'] = $report_format;
return $this;
}
/**
* Gets seconds_between_reports
*
* @return int|null
*/
public function getSecondsBetweenReports()
{
return $this->container['seconds_between_reports'];
}
/**
* Sets seconds_between_reports
*
* @param int|null $seconds_between_reports seconds_between_reports
*
* @return self
*/
public function setSecondsBetweenReports($seconds_between_reports)
{
if (is_null($seconds_between_reports)) {
throw new \InvalidArgumentException('non-nullable seconds_between_reports cannot be null');
}
$this->container['seconds_between_reports'] = $seconds_between_reports;
return $this;
}
/**
* Gets adkim
*
* @return string|null
*/
public function getAdkim()
{
return $this->container['adkim'];
}
/**
* Sets adkim
*
* @param string|null $adkim adkim
*
* @return self
*/
public function setAdkim($adkim)
{
$allowedValues = $this->getAdkimAllowableValues();
if (!is_null($adkim) && !in_array($adkim, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'adkim', must be one of '%s'",
$adkim,
implode("', '", $allowedValues)
)
);
}
if (is_null($adkim)) {
throw new \InvalidArgumentException('non-nullable adkim cannot be null');
}
$this->container['adkim'] = $adkim;
return $this;
}
/**
* Gets aspf
*
* @return string|null
*/
public function getAspf()
{
return $this->container['aspf'];
}
/**
* Sets aspf
*
* @param string|null $aspf aspf
*
* @return self
*/
public function setAspf($aspf)
{
$allowedValues = $this->getAspfAllowableValues();
if (!is_null($aspf) && !in_array($aspf, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'aspf', must be one of '%s'",
$aspf,
implode("', '", $allowedValues)
)
);
}
if (is_null($aspf)) {
throw new \InvalidArgumentException('non-nullable aspf cannot be null');
}
$this->container['aspf'] = $aspf;
return $this;
}
/**
* Gets fo
*
* @return string|null
*/
public function getFo()
{
return $this->container['fo'];
}
/**
* Sets fo
*
* @param string|null $fo fo
*
* @return self
*/
public function setFo($fo)
{
$allowedValues = $this->getFoAllowableValues();
if (!is_null($fo) && !in_array($fo, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'fo', must be one of '%s'",
$fo,
implode("', '", $allowedValues)
)
);
}
if (is_null($fo)) {
throw new \InvalidArgumentException('non-nullable fo cannot be null');
}
$this->container['fo'] = $fo;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateBimiRecordResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateBimiRecordResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateBimiRecordResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateBimiRecordResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'type' => 'string',
'ttl' => 'int',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'type' => null,
'ttl' => 'int32',
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'type' => false,
'ttl' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'type' => 'type',
'ttl' => 'ttl',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'type' => 'setType',
'ttl' => 'setTtl',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'type' => 'getType',
'ttl' => 'getTtl',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const TYPE_A = 'A';
public const TYPE_NS = 'NS';
public const TYPE_MD = 'MD';
public const TYPE_MF = 'MF';
public const TYPE_CNAME = 'CNAME';
public const TYPE_SOA = 'SOA';
public const TYPE_MB = 'MB';
public const TYPE_MG = 'MG';
public const TYPE_MR = 'MR';
public const TYPE_NULL = 'NULL';
public const TYPE_WKS = 'WKS';
public const TYPE_PTR = 'PTR';
public const TYPE_HINFO = 'HINFO';
public const TYPE_MINFO = 'MINFO';
public const TYPE_MX = 'MX';
public const TYPE_TXT = 'TXT';
public const TYPE_RP = 'RP';
public const TYPE_AFSDB = 'AFSDB';
public const TYPE_X25 = 'X25';
public const TYPE_ISDN = 'ISDN';
public const TYPE_RT = 'RT';
public const TYPE_NSAP = 'NSAP';
public const TYPE_NSAP_PTR = 'NSAP_PTR';
public const TYPE_SIG = 'SIG';
public const TYPE_KEY = 'KEY';
public const TYPE_PX = 'PX';
public const TYPE_GPOS = 'GPOS';
public const TYPE_AAAA = 'AAAA';
public const TYPE_LOC = 'LOC';
public const TYPE_NXT = 'NXT';
public const TYPE_EID = 'EID';
public const TYPE_NIMLOC = 'NIMLOC';
public const TYPE_SRV = 'SRV';
public const TYPE_ATMA = 'ATMA';
public const TYPE_NAPTR = 'NAPTR';
public const TYPE_KX = 'KX';
public const TYPE_CERT = 'CERT';
public const TYPE_A6 = 'A6';
public const TYPE_DNAME = 'DNAME';
public const TYPE_SINK = 'SINK';
public const TYPE_OPT = 'OPT';
public const TYPE_APL = 'APL';
public const TYPE_DS = 'DS';
public const TYPE_SSHFP = 'SSHFP';
public const TYPE_IPSECKEY = 'IPSECKEY';
public const TYPE_RRSIG = 'RRSIG';
public const TYPE_NSEC = 'NSEC';
public const TYPE_DNSKEY = 'DNSKEY';
public const TYPE_DHCID = 'DHCID';
public const TYPE_NSEC3 = 'NSEC3';
public const TYPE_NSEC3_PARAM = 'NSEC3PARAM';
public const TYPE_TLSA = 'TLSA';
public const TYPE_SMIMEA = 'SMIMEA';
public const TYPE_HIP = 'HIP';
public const TYPE_NINFO = 'NINFO';
public const TYPE_RKEY = 'RKEY';
public const TYPE_TALINK = 'TALINK';
public const TYPE_CDS = 'CDS';
public const TYPE_CDNSKEY = 'CDNSKEY';
public const TYPE_OPENPGPKEY = 'OPENPGPKEY';
public const TYPE_CSYNC = 'CSYNC';
public const TYPE_ZONEMD = 'ZONEMD';
public const TYPE_SVCB = 'SVCB';
public const TYPE_HTTPS = 'HTTPS';
public const TYPE_SPF = 'SPF';
public const TYPE_UINFO = 'UINFO';
public const TYPE_UID = 'UID';
public const TYPE_GID = 'GID';
public const TYPE_UNSPEC = 'UNSPEC';
public const TYPE_NID = 'NID';
public const TYPE_L32 = 'L32';
public const TYPE_L64 = 'L64';
public const TYPE_LP = 'LP';
public const TYPE_EUI48 = 'EUI48';
public const TYPE_EUI64 = 'EUI64';
public const TYPE_TKEY = 'TKEY';
public const TYPE_TSIG = 'TSIG';
public const TYPE_IXFR = 'IXFR';
public const TYPE_AXFR = 'AXFR';
public const TYPE_MAILB = 'MAILB';
public const TYPE_MAILA = 'MAILA';
public const TYPE_ANY = 'ANY';
public const TYPE_URI = 'URI';
public const TYPE_CAA = 'CAA';
public const TYPE_AVC = 'AVC';
public const TYPE_DOA = 'DOA';
public const TYPE_AMTRELAY = 'AMTRELAY';
public const TYPE_TA = 'TA';
public const TYPE_DLV = 'DLV';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getTypeAllowableValues()
{
return [
self::TYPE_A,
self::TYPE_NS,
self::TYPE_MD,
self::TYPE_MF,
self::TYPE_CNAME,
self::TYPE_SOA,
self::TYPE_MB,
self::TYPE_MG,
self::TYPE_MR,
self::TYPE_NULL,
self::TYPE_WKS,
self::TYPE_PTR,
self::TYPE_HINFO,
self::TYPE_MINFO,
self::TYPE_MX,
self::TYPE_TXT,
self::TYPE_RP,
self::TYPE_AFSDB,
self::TYPE_X25,
self::TYPE_ISDN,
self::TYPE_RT,
self::TYPE_NSAP,
self::TYPE_NSAP_PTR,
self::TYPE_SIG,
self::TYPE_KEY,
self::TYPE_PX,
self::TYPE_GPOS,
self::TYPE_AAAA,
self::TYPE_LOC,
self::TYPE_NXT,
self::TYPE_EID,
self::TYPE_NIMLOC,
self::TYPE_SRV,
self::TYPE_ATMA,
self::TYPE_NAPTR,
self::TYPE_KX,
self::TYPE_CERT,
self::TYPE_A6,
self::TYPE_DNAME,
self::TYPE_SINK,
self::TYPE_OPT,
self::TYPE_APL,
self::TYPE_DS,
self::TYPE_SSHFP,
self::TYPE_IPSECKEY,
self::TYPE_RRSIG,
self::TYPE_NSEC,
self::TYPE_DNSKEY,
self::TYPE_DHCID,
self::TYPE_NSEC3,
self::TYPE_NSEC3_PARAM,
self::TYPE_TLSA,
self::TYPE_SMIMEA,
self::TYPE_HIP,
self::TYPE_NINFO,
self::TYPE_RKEY,
self::TYPE_TALINK,
self::TYPE_CDS,
self::TYPE_CDNSKEY,
self::TYPE_OPENPGPKEY,
self::TYPE_CSYNC,
self::TYPE_ZONEMD,
self::TYPE_SVCB,
self::TYPE_HTTPS,
self::TYPE_SPF,
self::TYPE_UINFO,
self::TYPE_UID,
self::TYPE_GID,
self::TYPE_UNSPEC,
self::TYPE_NID,
self::TYPE_L32,
self::TYPE_L64,
self::TYPE_LP,
self::TYPE_EUI48,
self::TYPE_EUI64,
self::TYPE_TKEY,
self::TYPE_TSIG,
self::TYPE_IXFR,
self::TYPE_AXFR,
self::TYPE_MAILB,
self::TYPE_MAILA,
self::TYPE_ANY,
self::TYPE_URI,
self::TYPE_CAA,
self::TYPE_AVC,
self::TYPE_DOA,
self::TYPE_AMTRELAY,
self::TYPE_TA,
self::TYPE_DLV,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['type'] === null) {
$invalidProperties[] = "'type' can't be null";
}
$allowedValues = $this->getTypeAllowableValues();
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'type', must be one of '%s'",
$this->container['type'],
implode("', '", $allowedValues)
);
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets type
*
* @return string
*/
public function getType()
{
return $this->container['type'];
}
/**
* Sets type
*
* @param string $type Domain Name Server Record Types
*
* @return self
*/
public function setType($type)
{
$allowedValues = $this->getTypeAllowableValues();
if (!in_array($type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'type', must be one of '%s'",
$type,
implode("', '", $allowedValues)
)
);
}
if (is_null($type)) {
throw new \InvalidArgumentException('non-nullable type cannot be null');
}
$this->container['type'] = $type;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value value
*
* @return self
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* GenerateBimiRecordOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* GenerateBimiRecordOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class GenerateBimiRecordOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'GenerateBimiRecordOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'domain' => 'string',
'version' => 'string',
'logo_url' => 'string',
'vmc_url' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'domain' => null,
'version' => null,
'logo_url' => null,
'vmc_url' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'domain' => false,
'version' => false,
'logo_url' => false,
'vmc_url' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'domain' => 'domain',
'version' => 'version',
'logo_url' => 'logoUrl',
'vmc_url' => 'vmcUrl'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'domain' => 'setDomain',
'version' => 'setVersion',
'logo_url' => 'setLogoUrl',
'vmc_url' => 'setVmcUrl'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'domain' => 'getDomain',
'version' => 'getVersion',
'logo_url' => 'getLogoUrl',
'vmc_url' => 'getVmcUrl'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const VERSION_BIMI1 = 'BIMI1';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getVersionAllowableValues()
{
return [
self::VERSION_BIMI1,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('domain', $data ?? [], null);
$this->setIfExists('version', $data ?? [], null);
$this->setIfExists('logo_url', $data ?? [], null);
$this->setIfExists('vmc_url', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['domain'] === null) {
$invalidProperties[] = "'domain' can't be null";
}
if ($this->container['version'] === null) {
$invalidProperties[] = "'version' can't be null";
}
$allowedValues = $this->getVersionAllowableValues();
if (!is_null($this->container['version']) && !in_array($this->container['version'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'version', must be one of '%s'",
$this->container['version'],
implode("', '", $allowedValues)
);
}
if ($this->container['logo_url'] === null) {
$invalidProperties[] = "'logo_url' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets domain
*
* @return string
*/
public function getDomain()
{
return $this->container['domain'];
}
/**
* Sets domain
*
* @param string $domain domain
*
* @return self
*/
public function setDomain($domain)
{
if (is_null($domain)) {
throw new \InvalidArgumentException('non-nullable domain cannot be null');
}
$this->container['domain'] = $domain;
return $this;
}
/**
* Gets version
*
* @return string
*/
public function getVersion()
{
return $this->container['version'];
}
/**
* Sets version
*
* @param string $version version
*
* @return self
*/
public function setVersion($version)
{
$allowedValues = $this->getVersionAllowableValues();
if (!in_array($version, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'version', must be one of '%s'",
$version,
implode("', '", $allowedValues)
)
);
}
if (is_null($version)) {
throw new \InvalidArgumentException('non-nullable version cannot be null');
}
$this->container['version'] = $version;
return $this;
}
/**
* Gets logo_url
*
* @return string
*/
public function getLogoUrl()
{
return $this->container['logo_url'];
}
/**
* Sets logo_url
*
* @param string $logo_url logo_url
*
* @return self
*/
public function setLogoUrl($logo_url)
{
if (is_null($logo_url)) {
throw new \InvalidArgumentException('non-nullable logo_url cannot be null');
}
$this->container['logo_url'] = $logo_url;
return $this;
}
/**
* Gets vmc_url
*
* @return string|null
*/
public function getVmcUrl()
{
return $this->container['vmc_url'];
}
/**
* Sets vmc_url
*
* @param string|null $vmc_url vmc_url
*
* @return self
*/
public function setVmcUrl($vmc_url)
{
if (is_null($vmc_url)) {
throw new \InvalidArgumentException('non-nullable vmc_url cannot be null');
}
$this->container['vmc_url'] = $vmc_url;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ForwardEmailOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ForwardEmailOptions Class Doc Comment
*
* @category Class
* @description Options for forwarding an email
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ForwardEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ForwardEmailOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'to' => 'string[]',
'subject' => 'string',
'cc' => 'string[]',
'bcc' => 'string[]',
'from' => 'string',
'use_inbox_name' => 'bool',
'filter_bounced_recipients' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'to' => null,
'subject' => null,
'cc' => null,
'bcc' => null,
'from' => null,
'use_inbox_name' => null,
'filter_bounced_recipients' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'to' => false,
'subject' => true,
'cc' => true,
'bcc' => true,
'from' => true,
'use_inbox_name' => true,
'filter_bounced_recipients' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'to' => 'to',
'subject' => 'subject',
'cc' => 'cc',
'bcc' => 'bcc',
'from' => 'from',
'use_inbox_name' => 'useInboxName',
'filter_bounced_recipients' => 'filterBouncedRecipients'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'to' => 'setTo',
'subject' => 'setSubject',
'cc' => 'setCc',
'bcc' => 'setBcc',
'from' => 'setFrom',
'use_inbox_name' => 'setUseInboxName',
'filter_bounced_recipients' => 'setFilterBouncedRecipients'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'to' => 'getTo',
'subject' => 'getSubject',
'cc' => 'getCc',
'bcc' => 'getBcc',
'from' => 'getFrom',
'use_inbox_name' => 'getUseInboxName',
'filter_bounced_recipients' => 'getFilterBouncedRecipients'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('use_inbox_name', $data ?? [], null);
$this->setIfExists('filter_bounced_recipients', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to To recipients for forwarded email
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject Subject for forwarded email
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets cc
*
* @return string[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[]|null $cc Optional cc recipients
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
array_push($this->openAPINullablesSetToNull, 'cc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('cc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets bcc
*
* @return string[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[]|null $bcc Optional bcc recipients
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
array_push($this->openAPINullablesSetToNull, 'bcc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bcc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from Optional from override
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets use_inbox_name
*
* @return bool|null
*/
public function getUseInboxName()
{
return $this->container['use_inbox_name'];
}
/**
* Sets use_inbox_name
*
* @param bool|null $use_inbox_name Optionally use inbox name as display name for sender email address
*
* @return self
*/
public function setUseInboxName($use_inbox_name)
{
if (is_null($use_inbox_name)) {
array_push($this->openAPINullablesSetToNull, 'use_inbox_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_inbox_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_inbox_name'] = $use_inbox_name;
return $this;
}
/**
* Gets filter_bounced_recipients
*
* @return bool|null
*/
public function getFilterBouncedRecipients()
{
return $this->container['filter_bounced_recipients'];
}
/**
* Sets filter_bounced_recipients
*
* @param bool|null $filter_bounced_recipients Filter recipients to remove any bounced recipients from to, bcc, and cc before sending
*
* @return self
*/
public function setFilterBouncedRecipients($filter_bounced_recipients)
{
if (is_null($filter_bounced_recipients)) {
array_push($this->openAPINullablesSetToNull, 'filter_bounced_recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('filter_bounced_recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['filter_bounced_recipients'] = $filter_bounced_recipients;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* FlushExpiredInboxesResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* FlushExpiredInboxesResult Class Doc Comment
*
* @category Class
* @description Result from calling expire on any inboxes that have applicable expiration dates given current time.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class FlushExpiredInboxesResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'FlushExpiredInboxesResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_ids' => 'string[]',
'expire_before' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_ids' => 'uuid',
'expire_before' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_ids' => false,
'expire_before' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_ids' => 'inboxIds',
'expire_before' => 'expireBefore'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_ids' => 'setInboxIds',
'expire_before' => 'setExpireBefore'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_ids' => 'getInboxIds',
'expire_before' => 'getExpireBefore'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_ids', $data ?? [], null);
$this->setIfExists('expire_before', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_ids'] === null) {
$invalidProperties[] = "'inbox_ids' can't be null";
}
if ($this->container['expire_before'] === null) {
$invalidProperties[] = "'expire_before' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_ids
*
* @return string[]
*/
public function getInboxIds()
{
return $this->container['inbox_ids'];
}
/**
* Sets inbox_ids
*
* @param string[] $inbox_ids Inbox IDs affected by expiration
*
* @return self
*/
public function setInboxIds($inbox_ids)
{
if (is_null($inbox_ids)) {
throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null');
}
$this->container['inbox_ids'] = $inbox_ids;
return $this;
}
/**
* Gets expire_before
*
* @return \DateTime
*/
public function getExpireBefore()
{
return $this->container['expire_before'];
}
/**
* Sets expire_before
*
* @param \DateTime $expire_before DateTime to filter inboxes so that those expiring before this time are expired
*
* @return self
*/
public function setExpireBefore($expire_before)
{
if (is_null($expire_before)) {
throw new \InvalidArgumentException('non-nullable expire_before cannot be null');
}
$this->container['expire_before'] = $expire_before;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* FilterBouncedRecipientsResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* FilterBouncedRecipientsResult Class Doc Comment
*
* @category Class
* @description Remaining recipients that were filtered to remove bounced recipients
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class FilterBouncedRecipientsResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'FilterBouncedRecipientsResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'filtered_recipients' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'filtered_recipients' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'filtered_recipients' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'filtered_recipients' => 'filteredRecipients'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'filtered_recipients' => 'setFilteredRecipients'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'filtered_recipients' => 'getFilteredRecipients'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('filtered_recipients', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['filtered_recipients'] === null) {
$invalidProperties[] = "'filtered_recipients' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets filtered_recipients
*
* @return string[]
*/
public function getFilteredRecipients()
{
return $this->container['filtered_recipients'];
}
/**
* Sets filtered_recipients
*
* @param string[] $filtered_recipients filtered_recipients
*
* @return self
*/
public function setFilteredRecipients($filtered_recipients)
{
if (is_null($filtered_recipients)) {
throw new \InvalidArgumentException('non-nullable filtered_recipients cannot be null');
}
$this->container['filtered_recipients'] = $filtered_recipients;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* FilterBouncedRecipientsOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* FilterBouncedRecipientsOptions Class Doc Comment
*
* @category Class
* @description Options for filtering bounced email recipients
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class FilterBouncedRecipientsOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'FilterBouncedRecipientsOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_recipients' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_recipients' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_recipients' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_recipients' => 'emailRecipients'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_recipients' => 'setEmailRecipients'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_recipients' => 'getEmailRecipients'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_recipients', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_recipients'] === null) {
$invalidProperties[] = "'email_recipients' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_recipients
*
* @return string[]
*/
public function getEmailRecipients()
{
return $this->container['email_recipients'];
}
/**
* Sets email_recipients
*
* @param string[] $email_recipients email_recipients
*
* @return self
*/
public function setEmailRecipients($email_recipients)
{
if (is_null($email_recipients)) {
throw new \InvalidArgumentException('non-nullable email_recipients cannot be null');
}
$this->container['email_recipients'] = $email_recipients;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* FakeEmailResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* FakeEmailResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class FakeEmailResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'FakeEmailResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email' => '\MailSlurp\Models\FakeEmailDto'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email' => 'email'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email' => 'setEmail'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email' => 'getEmail'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email
*
* @return \MailSlurp\Models\FakeEmailDto|null
*/
public function getEmail()
{
return $this->container['email'];
}
/**
* Sets email
*
* @param \MailSlurp\Models\FakeEmailDto|null $email email
*
* @return self
*/
public function setEmail($email)
{
if (is_null($email)) {
throw new \InvalidArgumentException('non-nullable email cannot be null');
}
$this->container['email'] = $email;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* FakeEmailPreview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* FakeEmailPreview Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class FakeEmailPreview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'FakeEmailPreview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'email_address' => 'string',
'sender' => '\MailSlurp\Models\Sender',
'recipients' => '\MailSlurp\Models\EmailRecipients',
'subject' => 'string',
'preview' => 'string',
'created_at' => '\DateTime',
'seen' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'email_address' => null,
'sender' => null,
'recipients' => null,
'subject' => null,
'preview' => null,
'created_at' => 'date-time',
'seen' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'email_address' => false,
'sender' => true,
'recipients' => true,
'subject' => false,
'preview' => false,
'created_at' => false,
'seen' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'email_address' => 'emailAddress',
'sender' => 'sender',
'recipients' => 'recipients',
'subject' => 'subject',
'preview' => 'preview',
'created_at' => 'createdAt',
'seen' => 'seen'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'email_address' => 'setEmailAddress',
'sender' => 'setSender',
'recipients' => 'setRecipients',
'subject' => 'setSubject',
'preview' => 'setPreview',
'created_at' => 'setCreatedAt',
'seen' => 'setSeen'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'email_address' => 'getEmailAddress',
'sender' => 'getSender',
'recipients' => 'getRecipients',
'subject' => 'getSubject',
'preview' => 'getPreview',
'created_at' => 'getCreatedAt',
'seen' => 'getSeen'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('sender', $data ?? [], null);
$this->setIfExists('recipients', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('preview', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('seen', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['seen'] === null) {
$invalidProperties[] = "'seen' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets sender
*
* @return \MailSlurp\Models\Sender|null
*/
public function getSender()
{
return $this->container['sender'];
}
/**
* Sets sender
*
* @param \MailSlurp\Models\Sender|null $sender sender
*
* @return self
*/
public function setSender($sender)
{
if (is_null($sender)) {
array_push($this->openAPINullablesSetToNull, 'sender');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sender', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sender'] = $sender;
return $this;
}
/**
* Gets recipients
*
* @return \MailSlurp\Models\EmailRecipients|null
*/
public function getRecipients()
{
return $this->container['recipients'];
}
/**
* Sets recipients
*
* @param \MailSlurp\Models\EmailRecipients|null $recipients recipients
*
* @return self
*/
public function setRecipients($recipients)
{
if (is_null($recipients)) {
array_push($this->openAPINullablesSetToNull, 'recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['recipients'] = $recipients;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets preview
*
* @return string|null
*/
public function getPreview()
{
return $this->container['preview'];
}
/**
* Sets preview
*
* @param string|null $preview preview
*
* @return self
*/
public function setPreview($preview)
{
if (is_null($preview)) {
throw new \InvalidArgumentException('non-nullable preview cannot be null');
}
$this->container['preview'] = $preview;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets seen
*
* @return bool
*/
public function getSeen()
{
return $this->container['seen'];
}
/**
* Sets seen
*
* @param bool $seen seen
*
* @return self
*/
public function setSeen($seen)
{
if (is_null($seen)) {
throw new \InvalidArgumentException('non-nullable seen cannot be null');
}
$this->container['seen'] = $seen;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* FakeEmailDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* FakeEmailDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class FakeEmailDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'FakeEmailDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'email_address' => 'string',
'sender' => '\MailSlurp\Models\Sender',
'recipients' => '\MailSlurp\Models\EmailRecipients',
'subject' => 'string',
'preview' => 'string',
'body' => 'string',
'seen' => 'bool',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'email_address' => null,
'sender' => null,
'recipients' => null,
'subject' => null,
'preview' => null,
'body' => null,
'seen' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'email_address' => false,
'sender' => true,
'recipients' => true,
'subject' => false,
'preview' => false,
'body' => false,
'seen' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'email_address' => 'emailAddress',
'sender' => 'sender',
'recipients' => 'recipients',
'subject' => 'subject',
'preview' => 'preview',
'body' => 'body',
'seen' => 'seen',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'email_address' => 'setEmailAddress',
'sender' => 'setSender',
'recipients' => 'setRecipients',
'subject' => 'setSubject',
'preview' => 'setPreview',
'body' => 'setBody',
'seen' => 'setSeen',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'email_address' => 'getEmailAddress',
'sender' => 'getSender',
'recipients' => 'getRecipients',
'subject' => 'getSubject',
'preview' => 'getPreview',
'body' => 'getBody',
'seen' => 'getSeen',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('sender', $data ?? [], null);
$this->setIfExists('recipients', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('preview', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('seen', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
if ($this->container['seen'] === null) {
$invalidProperties[] = "'seen' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets sender
*
* @return \MailSlurp\Models\Sender|null
*/
public function getSender()
{
return $this->container['sender'];
}
/**
* Sets sender
*
* @param \MailSlurp\Models\Sender|null $sender sender
*
* @return self
*/
public function setSender($sender)
{
if (is_null($sender)) {
array_push($this->openAPINullablesSetToNull, 'sender');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sender', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sender'] = $sender;
return $this;
}
/**
* Gets recipients
*
* @return \MailSlurp\Models\EmailRecipients|null
*/
public function getRecipients()
{
return $this->container['recipients'];
}
/**
* Sets recipients
*
* @param \MailSlurp\Models\EmailRecipients|null $recipients recipients
*
* @return self
*/
public function setRecipients($recipients)
{
if (is_null($recipients)) {
array_push($this->openAPINullablesSetToNull, 'recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['recipients'] = $recipients;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets preview
*
* @return string|null
*/
public function getPreview()
{
return $this->container['preview'];
}
/**
* Sets preview
*
* @param string|null $preview preview
*
* @return self
*/
public function setPreview($preview)
{
if (is_null($preview)) {
throw new \InvalidArgumentException('non-nullable preview cannot be null');
}
$this->container['preview'] = $preview;
return $this;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets seen
*
* @return bool
*/
public function getSeen()
{
return $this->container['seen'];
}
/**
* Sets seen
*
* @param bool $seen seen
*
* @return self
*/
public function setSeen($seen)
{
if (is_null($seen)) {
throw new \InvalidArgumentException('non-nullable seen cannot be null');
}
$this->container['seen'] = $seen;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ExportOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ExportOptions Class Doc Comment
*
* @category Class
* @description Options for exporting user data
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ExportOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ExportOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'output_format' => 'string',
'exclude_previously_exported' => 'bool',
'created_earliest_time' => '\DateTime',
'created_oldest_time' => '\DateTime',
'filter' => 'string',
'list_separator_token' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'output_format' => null,
'exclude_previously_exported' => null,
'created_earliest_time' => 'date-time',
'created_oldest_time' => 'date-time',
'filter' => null,
'list_separator_token' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'output_format' => false,
'exclude_previously_exported' => true,
'created_earliest_time' => true,
'created_oldest_time' => true,
'filter' => true,
'list_separator_token' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'output_format' => 'outputFormat',
'exclude_previously_exported' => 'excludePreviouslyExported',
'created_earliest_time' => 'createdEarliestTime',
'created_oldest_time' => 'createdOldestTime',
'filter' => 'filter',
'list_separator_token' => 'listSeparatorToken'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'output_format' => 'setOutputFormat',
'exclude_previously_exported' => 'setExcludePreviouslyExported',
'created_earliest_time' => 'setCreatedEarliestTime',
'created_oldest_time' => 'setCreatedOldestTime',
'filter' => 'setFilter',
'list_separator_token' => 'setListSeparatorToken'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'output_format' => 'getOutputFormat',
'exclude_previously_exported' => 'getExcludePreviouslyExported',
'created_earliest_time' => 'getCreatedEarliestTime',
'created_oldest_time' => 'getCreatedOldestTime',
'filter' => 'getFilter',
'list_separator_token' => 'getListSeparatorToken'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const OUTPUT_FORMAT__DEFAULT = 'CSV_DEFAULT';
public const OUTPUT_FORMAT_EXCEL = 'CSV_EXCEL';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getOutputFormatAllowableValues()
{
return [
self::OUTPUT_FORMAT__DEFAULT,
self::OUTPUT_FORMAT_EXCEL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('output_format', $data ?? [], null);
$this->setIfExists('exclude_previously_exported', $data ?? [], null);
$this->setIfExists('created_earliest_time', $data ?? [], null);
$this->setIfExists('created_oldest_time', $data ?? [], null);
$this->setIfExists('filter', $data ?? [], null);
$this->setIfExists('list_separator_token', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['output_format'] === null) {
$invalidProperties[] = "'output_format' can't be null";
}
$allowedValues = $this->getOutputFormatAllowableValues();
if (!is_null($this->container['output_format']) && !in_array($this->container['output_format'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'output_format', must be one of '%s'",
$this->container['output_format'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets output_format
*
* @return string
*/
public function getOutputFormat()
{
return $this->container['output_format'];
}
/**
* Sets output_format
*
* @param string $output_format output_format
*
* @return self
*/
public function setOutputFormat($output_format)
{
$allowedValues = $this->getOutputFormatAllowableValues();
if (!in_array($output_format, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'output_format', must be one of '%s'",
$output_format,
implode("', '", $allowedValues)
)
);
}
if (is_null($output_format)) {
throw new \InvalidArgumentException('non-nullable output_format cannot be null');
}
$this->container['output_format'] = $output_format;
return $this;
}
/**
* Gets exclude_previously_exported
*
* @return bool|null
*/
public function getExcludePreviouslyExported()
{
return $this->container['exclude_previously_exported'];
}
/**
* Sets exclude_previously_exported
*
* @param bool|null $exclude_previously_exported exclude_previously_exported
*
* @return self
*/
public function setExcludePreviouslyExported($exclude_previously_exported)
{
if (is_null($exclude_previously_exported)) {
array_push($this->openAPINullablesSetToNull, 'exclude_previously_exported');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('exclude_previously_exported', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['exclude_previously_exported'] = $exclude_previously_exported;
return $this;
}
/**
* Gets created_earliest_time
*
* @return \DateTime|null
*/
public function getCreatedEarliestTime()
{
return $this->container['created_earliest_time'];
}
/**
* Sets created_earliest_time
*
* @param \DateTime|null $created_earliest_time created_earliest_time
*
* @return self
*/
public function setCreatedEarliestTime($created_earliest_time)
{
if (is_null($created_earliest_time)) {
array_push($this->openAPINullablesSetToNull, 'created_earliest_time');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('created_earliest_time', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['created_earliest_time'] = $created_earliest_time;
return $this;
}
/**
* Gets created_oldest_time
*
* @return \DateTime|null
*/
public function getCreatedOldestTime()
{
return $this->container['created_oldest_time'];
}
/**
* Sets created_oldest_time
*
* @param \DateTime|null $created_oldest_time created_oldest_time
*
* @return self
*/
public function setCreatedOldestTime($created_oldest_time)
{
if (is_null($created_oldest_time)) {
array_push($this->openAPINullablesSetToNull, 'created_oldest_time');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('created_oldest_time', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['created_oldest_time'] = $created_oldest_time;
return $this;
}
/**
* Gets filter
*
* @return string|null
*/
public function getFilter()
{
return $this->container['filter'];
}
/**
* Sets filter
*
* @param string|null $filter filter
*
* @return self
*/
public function setFilter($filter)
{
if (is_null($filter)) {
array_push($this->openAPINullablesSetToNull, 'filter');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('filter', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['filter'] = $filter;
return $this;
}
/**
* Gets list_separator_token
*
* @return string|null
*/
public function getListSeparatorToken()
{
return $this->container['list_separator_token'];
}
/**
* Sets list_separator_token
*
* @param string|null $list_separator_token list_separator_token
*
* @return self
*/
public function setListSeparatorToken($list_separator_token)
{
if (is_null($list_separator_token)) {
array_push($this->openAPINullablesSetToNull, 'list_separator_token');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('list_separator_token', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['list_separator_token'] = $list_separator_token;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ExportLink
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ExportLink Class Doc Comment
*
* @category Class
* @description Export download link
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ExportLink implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ExportLink';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'download_link' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'download_link' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'download_link' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'download_link' => 'downloadLink'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'download_link' => 'setDownloadLink'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'download_link' => 'getDownloadLink'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('download_link', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['download_link'] === null) {
$invalidProperties[] = "'download_link' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets download_link
*
* @return string
*/
public function getDownloadLink()
{
return $this->container['download_link'];
}
/**
* Sets download_link
*
* @param string $download_link download_link
*
* @return self
*/
public function setDownloadLink($download_link)
{
if (is_null($download_link)) {
throw new \InvalidArgumentException('non-nullable download_link cannot be null');
}
$this->container['download_link'] = $download_link;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ExpiredInboxRecordProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ExpiredInboxRecordProjection Class Doc Comment
*
* @category Class
* @description Record of inbox expiration
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ExpiredInboxRecordProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ExpiredInboxRecordProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'email_address' => 'string',
'user_id' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'email_address' => null,
'user_id' => 'uuid',
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'email_address' => false,
'user_id' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'email_address' => 'emailAddress',
'user_id' => 'userId',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'email_address' => 'setEmailAddress',
'user_id' => 'setUserId',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'email_address' => 'getEmailAddress',
'user_id' => 'getUserId',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ExpiredInboxDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ExpiredInboxDto Class Doc Comment
*
* @category Class
* @description Expired inbox
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ExpiredInboxDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ExpiredInboxDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'inbox_id' => 'string',
'email_address' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'inbox_id' => 'uuid',
'email_address' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'inbox_id' => false,
'email_address' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'inbox_id' => 'inboxId',
'email_address' => 'emailAddress'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'inbox_id' => 'setInboxId',
'email_address' => 'setEmailAddress'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'inbox_id' => 'getInboxId',
'email_address' => 'getEmailAddress'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ExpirationDefaults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ExpirationDefaults Class Doc Comment
*
* @category Class
* @description Expiration defaults for your account
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ExpirationDefaults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ExpirationDefaults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'default_expiration_millis' => 'int',
'max_expiration_millis' => 'int',
'default_expires_at' => '\DateTime',
'can_permanent_inbox' => 'bool',
'next_inbox_allows_permanent' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'default_expiration_millis' => 'int64',
'max_expiration_millis' => 'int64',
'default_expires_at' => 'date-time',
'can_permanent_inbox' => null,
'next_inbox_allows_permanent' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'default_expiration_millis' => true,
'max_expiration_millis' => true,
'default_expires_at' => true,
'can_permanent_inbox' => false,
'next_inbox_allows_permanent' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'default_expiration_millis' => 'defaultExpirationMillis',
'max_expiration_millis' => 'maxExpirationMillis',
'default_expires_at' => 'defaultExpiresAt',
'can_permanent_inbox' => 'canPermanentInbox',
'next_inbox_allows_permanent' => 'nextInboxAllowsPermanent'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'default_expiration_millis' => 'setDefaultExpirationMillis',
'max_expiration_millis' => 'setMaxExpirationMillis',
'default_expires_at' => 'setDefaultExpiresAt',
'can_permanent_inbox' => 'setCanPermanentInbox',
'next_inbox_allows_permanent' => 'setNextInboxAllowsPermanent'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'default_expiration_millis' => 'getDefaultExpirationMillis',
'max_expiration_millis' => 'getMaxExpirationMillis',
'default_expires_at' => 'getDefaultExpiresAt',
'can_permanent_inbox' => 'getCanPermanentInbox',
'next_inbox_allows_permanent' => 'getNextInboxAllowsPermanent'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('default_expiration_millis', $data ?? [], null);
$this->setIfExists('max_expiration_millis', $data ?? [], null);
$this->setIfExists('default_expires_at', $data ?? [], null);
$this->setIfExists('can_permanent_inbox', $data ?? [], null);
$this->setIfExists('next_inbox_allows_permanent', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['can_permanent_inbox'] === null) {
$invalidProperties[] = "'can_permanent_inbox' can't be null";
}
if ($this->container['next_inbox_allows_permanent'] === null) {
$invalidProperties[] = "'next_inbox_allows_permanent' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets default_expiration_millis
*
* @return int|null
*/
public function getDefaultExpirationMillis()
{
return $this->container['default_expiration_millis'];
}
/**
* Sets default_expiration_millis
*
* @param int|null $default_expiration_millis default_expiration_millis
*
* @return self
*/
public function setDefaultExpirationMillis($default_expiration_millis)
{
if (is_null($default_expiration_millis)) {
array_push($this->openAPINullablesSetToNull, 'default_expiration_millis');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('default_expiration_millis', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['default_expiration_millis'] = $default_expiration_millis;
return $this;
}
/**
* Gets max_expiration_millis
*
* @return int|null
*/
public function getMaxExpirationMillis()
{
return $this->container['max_expiration_millis'];
}
/**
* Sets max_expiration_millis
*
* @param int|null $max_expiration_millis max_expiration_millis
*
* @return self
*/
public function setMaxExpirationMillis($max_expiration_millis)
{
if (is_null($max_expiration_millis)) {
array_push($this->openAPINullablesSetToNull, 'max_expiration_millis');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('max_expiration_millis', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['max_expiration_millis'] = $max_expiration_millis;
return $this;
}
/**
* Gets default_expires_at
*
* @return \DateTime|null
*/
public function getDefaultExpiresAt()
{
return $this->container['default_expires_at'];
}
/**
* Sets default_expires_at
*
* @param \DateTime|null $default_expires_at default_expires_at
*
* @return self
*/
public function setDefaultExpiresAt($default_expires_at)
{
if (is_null($default_expires_at)) {
array_push($this->openAPINullablesSetToNull, 'default_expires_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('default_expires_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['default_expires_at'] = $default_expires_at;
return $this;
}
/**
* Gets can_permanent_inbox
*
* @return bool
*/
public function getCanPermanentInbox()
{
return $this->container['can_permanent_inbox'];
}
/**
* Sets can_permanent_inbox
*
* @param bool $can_permanent_inbox can_permanent_inbox
*
* @return self
*/
public function setCanPermanentInbox($can_permanent_inbox)
{
if (is_null($can_permanent_inbox)) {
throw new \InvalidArgumentException('non-nullable can_permanent_inbox cannot be null');
}
$this->container['can_permanent_inbox'] = $can_permanent_inbox;
return $this;
}
/**
* Gets next_inbox_allows_permanent
*
* @return bool
*/
public function getNextInboxAllowsPermanent()
{
return $this->container['next_inbox_allows_permanent'];
}
/**
* Sets next_inbox_allows_permanent
*
* @param bool $next_inbox_allows_permanent next_inbox_allows_permanent
*
* @return self
*/
public function setNextInboxAllowsPermanent($next_inbox_allows_permanent)
{
if (is_null($next_inbox_allows_permanent)) {
throw new \InvalidArgumentException('non-nullable next_inbox_allows_permanent cannot be null');
}
$this->container['next_inbox_allows_permanent'] = $next_inbox_allows_permanent;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmptyResponseDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmptyResponseDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmptyResponseDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmptyResponseDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmergencyAddressDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmergencyAddressDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmergencyAddressDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmergencyAddressDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'address1' => 'string',
'phone_country' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'address1' => null,
'phone_country' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'address1' => false,
'phone_country' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'address1' => 'address1',
'phone_country' => 'phoneCountry'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'address1' => 'setAddress1',
'phone_country' => 'setPhoneCountry'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'address1' => 'getAddress1',
'phone_country' => 'getPhoneCountry'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const PHONE_COUNTRY_US = 'US';
public const PHONE_COUNTRY_GB = 'GB';
public const PHONE_COUNTRY_AU = 'AU';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getPhoneCountryAllowableValues()
{
return [
self::PHONE_COUNTRY_US,
self::PHONE_COUNTRY_GB,
self::PHONE_COUNTRY_AU,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('address1', $data ?? [], null);
$this->setIfExists('phone_country', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['address1'] === null) {
$invalidProperties[] = "'address1' can't be null";
}
if ($this->container['phone_country'] === null) {
$invalidProperties[] = "'phone_country' can't be null";
}
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'phone_country', must be one of '%s'",
$this->container['phone_country'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets address1
*
* @return string
*/
public function getAddress1()
{
return $this->container['address1'];
}
/**
* Sets address1
*
* @param string $address1 address1
*
* @return self
*/
public function setAddress1($address1)
{
if (is_null($address1)) {
throw new \InvalidArgumentException('non-nullable address1 cannot be null');
}
$this->container['address1'] = $address1;
return $this;
}
/**
* Gets phone_country
*
* @return string
*/
public function getPhoneCountry()
{
return $this->container['phone_country'];
}
/**
* Sets phone_country
*
* @param string $phone_country phone_country
*
* @return self
*/
public function setPhoneCountry($phone_country)
{
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!in_array($phone_country, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'phone_country', must be one of '%s'",
$phone_country,
implode("', '", $allowedValues)
)
);
}
if (is_null($phone_country)) {
throw new \InvalidArgumentException('non-nullable phone_country cannot be null');
}
$this->container['phone_country'] = $phone_country;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmergencyAddress
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmergencyAddress Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmergencyAddress implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmergencyAddress';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'sid' => 'string',
'user_id' => 'string',
'display_name' => 'string',
'customer_name' => 'string',
'address1' => 'string',
'city' => 'string',
'region' => 'string',
'postal_code' => 'string',
'phone_country' => 'string',
'account_sid' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'sid' => null,
'user_id' => 'uuid',
'display_name' => null,
'customer_name' => null,
'address1' => null,
'city' => null,
'region' => null,
'postal_code' => null,
'phone_country' => null,
'account_sid' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'sid' => false,
'user_id' => false,
'display_name' => false,
'customer_name' => false,
'address1' => false,
'city' => false,
'region' => false,
'postal_code' => false,
'phone_country' => false,
'account_sid' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'sid' => 'sid',
'user_id' => 'userId',
'display_name' => 'displayName',
'customer_name' => 'customerName',
'address1' => 'address1',
'city' => 'city',
'region' => 'region',
'postal_code' => 'postalCode',
'phone_country' => 'phoneCountry',
'account_sid' => 'accountSid',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'sid' => 'setSid',
'user_id' => 'setUserId',
'display_name' => 'setDisplayName',
'customer_name' => 'setCustomerName',
'address1' => 'setAddress1',
'city' => 'setCity',
'region' => 'setRegion',
'postal_code' => 'setPostalCode',
'phone_country' => 'setPhoneCountry',
'account_sid' => 'setAccountSid',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'sid' => 'getSid',
'user_id' => 'getUserId',
'display_name' => 'getDisplayName',
'customer_name' => 'getCustomerName',
'address1' => 'getAddress1',
'city' => 'getCity',
'region' => 'getRegion',
'postal_code' => 'getPostalCode',
'phone_country' => 'getPhoneCountry',
'account_sid' => 'getAccountSid',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const PHONE_COUNTRY_US = 'US';
public const PHONE_COUNTRY_GB = 'GB';
public const PHONE_COUNTRY_AU = 'AU';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getPhoneCountryAllowableValues()
{
return [
self::PHONE_COUNTRY_US,
self::PHONE_COUNTRY_GB,
self::PHONE_COUNTRY_AU,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('sid', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('display_name', $data ?? [], null);
$this->setIfExists('customer_name', $data ?? [], null);
$this->setIfExists('address1', $data ?? [], null);
$this->setIfExists('city', $data ?? [], null);
$this->setIfExists('region', $data ?? [], null);
$this->setIfExists('postal_code', $data ?? [], null);
$this->setIfExists('phone_country', $data ?? [], null);
$this->setIfExists('account_sid', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['sid'] === null) {
$invalidProperties[] = "'sid' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['display_name'] === null) {
$invalidProperties[] = "'display_name' can't be null";
}
if ($this->container['customer_name'] === null) {
$invalidProperties[] = "'customer_name' can't be null";
}
if ($this->container['address1'] === null) {
$invalidProperties[] = "'address1' can't be null";
}
if ($this->container['city'] === null) {
$invalidProperties[] = "'city' can't be null";
}
if ($this->container['region'] === null) {
$invalidProperties[] = "'region' can't be null";
}
if ($this->container['postal_code'] === null) {
$invalidProperties[] = "'postal_code' can't be null";
}
if ($this->container['phone_country'] === null) {
$invalidProperties[] = "'phone_country' can't be null";
}
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!is_null($this->container['phone_country']) && !in_array($this->container['phone_country'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'phone_country', must be one of '%s'",
$this->container['phone_country'],
implode("', '", $allowedValues)
);
}
if ($this->container['account_sid'] === null) {
$invalidProperties[] = "'account_sid' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets sid
*
* @return string
*/
public function getSid()
{
return $this->container['sid'];
}
/**
* Sets sid
*
* @param string $sid sid
*
* @return self
*/
public function setSid($sid)
{
if (is_null($sid)) {
throw new \InvalidArgumentException('non-nullable sid cannot be null');
}
$this->container['sid'] = $sid;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets display_name
*
* @return string
*/
public function getDisplayName()
{
return $this->container['display_name'];
}
/**
* Sets display_name
*
* @param string $display_name display_name
*
* @return self
*/
public function setDisplayName($display_name)
{
if (is_null($display_name)) {
throw new \InvalidArgumentException('non-nullable display_name cannot be null');
}
$this->container['display_name'] = $display_name;
return $this;
}
/**
* Gets customer_name
*
* @return string
*/
public function getCustomerName()
{
return $this->container['customer_name'];
}
/**
* Sets customer_name
*
* @param string $customer_name customer_name
*
* @return self
*/
public function setCustomerName($customer_name)
{
if (is_null($customer_name)) {
throw new \InvalidArgumentException('non-nullable customer_name cannot be null');
}
$this->container['customer_name'] = $customer_name;
return $this;
}
/**
* Gets address1
*
* @return string
*/
public function getAddress1()
{
return $this->container['address1'];
}
/**
* Sets address1
*
* @param string $address1 address1
*
* @return self
*/
public function setAddress1($address1)
{
if (is_null($address1)) {
throw new \InvalidArgumentException('non-nullable address1 cannot be null');
}
$this->container['address1'] = $address1;
return $this;
}
/**
* Gets city
*
* @return string
*/
public function getCity()
{
return $this->container['city'];
}
/**
* Sets city
*
* @param string $city city
*
* @return self
*/
public function setCity($city)
{
if (is_null($city)) {
throw new \InvalidArgumentException('non-nullable city cannot be null');
}
$this->container['city'] = $city;
return $this;
}
/**
* Gets region
*
* @return string
*/
public function getRegion()
{
return $this->container['region'];
}
/**
* Sets region
*
* @param string $region region
*
* @return self
*/
public function setRegion($region)
{
if (is_null($region)) {
throw new \InvalidArgumentException('non-nullable region cannot be null');
}
$this->container['region'] = $region;
return $this;
}
/**
* Gets postal_code
*
* @return string
*/
public function getPostalCode()
{
return $this->container['postal_code'];
}
/**
* Sets postal_code
*
* @param string $postal_code postal_code
*
* @return self
*/
public function setPostalCode($postal_code)
{
if (is_null($postal_code)) {
throw new \InvalidArgumentException('non-nullable postal_code cannot be null');
}
$this->container['postal_code'] = $postal_code;
return $this;
}
/**
* Gets phone_country
*
* @return string
*/
public function getPhoneCountry()
{
return $this->container['phone_country'];
}
/**
* Sets phone_country
*
* @param string $phone_country phone_country
*
* @return self
*/
public function setPhoneCountry($phone_country)
{
$allowedValues = $this->getPhoneCountryAllowableValues();
if (!in_array($phone_country, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'phone_country', must be one of '%s'",
$phone_country,
implode("', '", $allowedValues)
)
);
}
if (is_null($phone_country)) {
throw new \InvalidArgumentException('non-nullable phone_country cannot be null');
}
$this->container['phone_country'] = $phone_country;
return $this;
}
/**
* Gets account_sid
*
* @return string
*/
public function getAccountSid()
{
return $this->container['account_sid'];
}
/**
* Sets account_sid
*
* @param string $account_sid account_sid
*
* @return self
*/
public function setAccountSid($account_sid)
{
if (is_null($account_sid)) {
throw new \InvalidArgumentException('non-nullable account_sid cannot be null');
}
$this->container['account_sid'] = $account_sid;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailVerificationResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailVerificationResult Class Doc Comment
*
* @category Class
* @description Email verification result. Valid means email address exists according to response from mail server running at the domain and port given.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailVerificationResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailVerificationResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'domain_name' => 'string',
'port' => 'int',
'email_address' => 'string',
'is_valid' => 'bool',
'error' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'domain_name' => null,
'port' => 'int32',
'email_address' => null,
'is_valid' => null,
'error' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'domain_name' => false,
'port' => false,
'email_address' => false,
'is_valid' => false,
'error' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'domain_name' => 'domainName',
'port' => 'port',
'email_address' => 'emailAddress',
'is_valid' => 'isValid',
'error' => 'error'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'domain_name' => 'setDomainName',
'port' => 'setPort',
'email_address' => 'setEmailAddress',
'is_valid' => 'setIsValid',
'error' => 'setError'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'domain_name' => 'getDomainName',
'port' => 'getPort',
'email_address' => 'getEmailAddress',
'is_valid' => 'getIsValid',
'error' => 'getError'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('domain_name', $data ?? [], null);
$this->setIfExists('port', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('is_valid', $data ?? [], null);
$this->setIfExists('error', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['domain_name'] === null) {
$invalidProperties[] = "'domain_name' can't be null";
}
if ($this->container['port'] === null) {
$invalidProperties[] = "'port' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['is_valid'] === null) {
$invalidProperties[] = "'is_valid' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets domain_name
*
* @return string
*/
public function getDomainName()
{
return $this->container['domain_name'];
}
/**
* Sets domain_name
*
* @param string $domain_name domain_name
*
* @return self
*/
public function setDomainName($domain_name)
{
if (is_null($domain_name)) {
throw new \InvalidArgumentException('non-nullable domain_name cannot be null');
}
$this->container['domain_name'] = $domain_name;
return $this;
}
/**
* Gets port
*
* @return int
*/
public function getPort()
{
return $this->container['port'];
}
/**
* Sets port
*
* @param int $port port
*
* @return self
*/
public function setPort($port)
{
if (is_null($port)) {
throw new \InvalidArgumentException('non-nullable port cannot be null');
}
$this->container['port'] = $port;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets is_valid
*
* @return bool
*/
public function getIsValid()
{
return $this->container['is_valid'];
}
/**
* Sets is_valid
*
* @param bool $is_valid is_valid
*
* @return self
*/
public function setIsValid($is_valid)
{
if (is_null($is_valid)) {
throw new \InvalidArgumentException('non-nullable is_valid cannot be null');
}
$this->container['is_valid'] = $is_valid;
return $this;
}
/**
* Gets error
*
* @return string|null
*/
public function getError()
{
return $this->container['error'];
}
/**
* Sets error
*
* @param string|null $error error
*
* @return self
*/
public function setError($error)
{
if (is_null($error)) {
array_push($this->openAPINullablesSetToNull, 'error');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('error', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['error'] = $error;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailValidationRequestDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailValidationRequestDto Class Doc Comment
*
* @category Class
* @description Email validation request
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailValidationRequestDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailValidationRequestDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'email_address' => 'string',
'is_valid' => 'bool',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'email_address' => null,
'is_valid' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'email_address' => false,
'is_valid' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'email_address' => 'emailAddress',
'is_valid' => 'isValid',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'email_address' => 'setEmailAddress',
'is_valid' => 'setIsValid',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'email_address' => 'getEmailAddress',
'is_valid' => 'getIsValid',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('is_valid', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['is_valid'] === null) {
$invalidProperties[] = "'is_valid' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets is_valid
*
* @return bool
*/
public function getIsValid()
{
return $this->container['is_valid'];
}
/**
* Sets is_valid
*
* @param bool $is_valid is_valid
*
* @return self
*/
public function setIsValid($is_valid)
{
if (is_null($is_valid)) {
throw new \InvalidArgumentException('non-nullable is_valid cannot be null');
}
$this->container['is_valid'] = $is_valid;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailTextLinesResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailTextLinesResult Class Doc Comment
*
* @category Class
* @description Parsed text of an email
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailTextLinesResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailTextLinesResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'lines' => 'string[]',
'body' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'lines' => null,
'body' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'lines' => false,
'body' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'lines' => 'lines',
'body' => 'body'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'lines' => 'setLines',
'body' => 'setBody'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'lines' => 'getLines',
'body' => 'getBody'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('lines', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['lines'] === null) {
$invalidProperties[] = "'lines' can't be null";
}
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets lines
*
* @return string[]
*/
public function getLines()
{
return $this->container['lines'];
}
/**
* Sets lines
*
* @param string[] $lines lines
*
* @return self
*/
public function setLines($lines)
{
if (is_null($lines)) {
throw new \InvalidArgumentException('non-nullable lines cannot be null');
}
$this->container['lines'] = $lines;
return $this;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailScreenshotResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailScreenshotResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailScreenshotResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailScreenshotResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'base64_encoded_image' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'base64_encoded_image' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'base64_encoded_image' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'base64_encoded_image' => 'base64EncodedImage'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'base64_encoded_image' => 'setBase64EncodedImage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'base64_encoded_image' => 'getBase64EncodedImage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('base64_encoded_image', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['base64_encoded_image'] === null) {
$invalidProperties[] = "'base64_encoded_image' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets base64_encoded_image
*
* @return string
*/
public function getBase64EncodedImage()
{
return $this->container['base64_encoded_image'];
}
/**
* Sets base64_encoded_image
*
* @param string $base64_encoded_image base64_encoded_image
*
* @return self
*/
public function setBase64EncodedImage($base64_encoded_image)
{
if (is_null($base64_encoded_image)) {
throw new \InvalidArgumentException('non-nullable base64_encoded_image cannot be null');
}
$this->container['base64_encoded_image'] = $base64_encoded_image;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailRecipients
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailRecipients Class Doc Comment
*
* @category Class
* @description The `To`,`CC`,`BCC` recipients stored in object form with email address and name accessible.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailRecipients implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailRecipients';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'to' => '\MailSlurp\Models\Recipient[]',
'cc' => '\MailSlurp\Models\Recipient[]',
'bcc' => '\MailSlurp\Models\Recipient[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'to' => null,
'cc' => null,
'bcc' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'to' => false,
'cc' => false,
'bcc' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'to' => 'to',
'cc' => 'cc',
'bcc' => 'bcc'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'to' => 'setTo',
'cc' => 'setCc',
'bcc' => 'setBcc'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'to' => 'getTo',
'cc' => 'getCc',
'bcc' => 'getBcc'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets to
*
* @return \MailSlurp\Models\Recipient[]|null
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param \MailSlurp\Models\Recipient[]|null $to to
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets cc
*
* @return \MailSlurp\Models\Recipient[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param \MailSlurp\Models\Recipient[]|null $cc cc
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
throw new \InvalidArgumentException('non-nullable cc cannot be null');
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets bcc
*
* @return \MailSlurp\Models\Recipient[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param \MailSlurp\Models\Recipient[]|null $bcc bcc
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
throw new \InvalidArgumentException('non-nullable bcc cannot be null');
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailProjection Class Doc Comment
*
* @category Class
* @description A compact representation of a full email. Used in list endpoints to keep response sizes low. Body and attachments are not included. To get all fields of the email use the `getEmail` method with the email projection's ID. See `EmailDto` for documentation on projection properties.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'attachments' => 'string[]',
'inbox_id' => 'string',
'to' => 'string[]',
'domain_id' => 'string',
'bcc' => 'string[]',
'cc' => 'string[]',
'read' => 'bool',
'body_excerpt' => 'string',
'team_access' => 'bool',
'body_md5_hash' => 'string',
'text_excerpt' => 'string',
'subject' => 'string',
'id' => 'string',
'from' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'attachments' => null,
'inbox_id' => 'uuid',
'to' => null,
'domain_id' => 'uuid',
'bcc' => null,
'cc' => null,
'read' => null,
'body_excerpt' => null,
'team_access' => null,
'body_md5_hash' => null,
'text_excerpt' => null,
'subject' => null,
'id' => 'uuid',
'from' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'attachments' => true,
'inbox_id' => false,
'to' => false,
'domain_id' => true,
'bcc' => true,
'cc' => true,
'read' => false,
'body_excerpt' => true,
'team_access' => false,
'body_md5_hash' => true,
'text_excerpt' => true,
'subject' => true,
'id' => false,
'from' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'attachments' => 'attachments',
'inbox_id' => 'inboxId',
'to' => 'to',
'domain_id' => 'domainId',
'bcc' => 'bcc',
'cc' => 'cc',
'read' => 'read',
'body_excerpt' => 'bodyExcerpt',
'team_access' => 'teamAccess',
'body_md5_hash' => 'bodyMD5Hash',
'text_excerpt' => 'textExcerpt',
'subject' => 'subject',
'id' => 'id',
'from' => 'from'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'attachments' => 'setAttachments',
'inbox_id' => 'setInboxId',
'to' => 'setTo',
'domain_id' => 'setDomainId',
'bcc' => 'setBcc',
'cc' => 'setCc',
'read' => 'setRead',
'body_excerpt' => 'setBodyExcerpt',
'team_access' => 'setTeamAccess',
'body_md5_hash' => 'setBodyMd5Hash',
'text_excerpt' => 'setTextExcerpt',
'subject' => 'setSubject',
'id' => 'setId',
'from' => 'setFrom'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'attachments' => 'getAttachments',
'inbox_id' => 'getInboxId',
'to' => 'getTo',
'domain_id' => 'getDomainId',
'bcc' => 'getBcc',
'cc' => 'getCc',
'read' => 'getRead',
'body_excerpt' => 'getBodyExcerpt',
'team_access' => 'getTeamAccess',
'body_md5_hash' => 'getBodyMd5Hash',
'text_excerpt' => 'getTextExcerpt',
'subject' => 'getSubject',
'id' => 'getId',
'from' => 'getFrom'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
$this->setIfExists('body_excerpt', $data ?? [], null);
$this->setIfExists('team_access', $data ?? [], null);
$this->setIfExists('body_md5_hash', $data ?? [], null);
$this->setIfExists('text_excerpt', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
if ($this->container['read'] === null) {
$invalidProperties[] = "'read' can't be null";
}
if ($this->container['team_access'] === null) {
$invalidProperties[] = "'team_access' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets attachments
*
* @return string[]|null
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[]|null $attachments attachments
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
array_push($this->openAPINullablesSetToNull, 'attachments');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachments', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to to
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id domain_id
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets bcc
*
* @return string[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[]|null $bcc bcc
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
array_push($this->openAPINullablesSetToNull, 'bcc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bcc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets cc
*
* @return string[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[]|null $cc cc
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
array_push($this->openAPINullablesSetToNull, 'cc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('cc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets read
*
* @return bool
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool $read read
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
throw new \InvalidArgumentException('non-nullable read cannot be null');
}
$this->container['read'] = $read;
return $this;
}
/**
* Gets body_excerpt
*
* @return string|null
*/
public function getBodyExcerpt()
{
return $this->container['body_excerpt'];
}
/**
* Sets body_excerpt
*
* @param string|null $body_excerpt body_excerpt
*
* @return self
*/
public function setBodyExcerpt($body_excerpt)
{
if (is_null($body_excerpt)) {
array_push($this->openAPINullablesSetToNull, 'body_excerpt');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_excerpt', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_excerpt'] = $body_excerpt;
return $this;
}
/**
* Gets team_access
*
* @return bool
*/
public function getTeamAccess()
{
return $this->container['team_access'];
}
/**
* Sets team_access
*
* @param bool $team_access team_access
*
* @return self
*/
public function setTeamAccess($team_access)
{
if (is_null($team_access)) {
throw new \InvalidArgumentException('non-nullable team_access cannot be null');
}
$this->container['team_access'] = $team_access;
return $this;
}
/**
* Gets body_md5_hash
*
* @return string|null
*/
public function getBodyMd5Hash()
{
return $this->container['body_md5_hash'];
}
/**
* Sets body_md5_hash
*
* @param string|null $body_md5_hash body_md5_hash
*
* @return self
*/
public function setBodyMd5Hash($body_md5_hash)
{
if (is_null($body_md5_hash)) {
array_push($this->openAPINullablesSetToNull, 'body_md5_hash');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_md5_hash', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_md5_hash'] = $body_md5_hash;
return $this;
}
/**
* Gets text_excerpt
*
* @return string|null
*/
public function getTextExcerpt()
{
return $this->container['text_excerpt'];
}
/**
* Sets text_excerpt
*
* @param string|null $text_excerpt text_excerpt
*
* @return self
*/
public function setTextExcerpt($text_excerpt)
{
if (is_null($text_excerpt)) {
array_push($this->openAPINullablesSetToNull, 'text_excerpt');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('text_excerpt', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['text_excerpt'] = $text_excerpt;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from from
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailPreviewUrls
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailPreviewUrls Class Doc Comment
*
* @category Class
* @description URLs for email body
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailPreviewUrls implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailPreviewUrls';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'raw_smtp_message_url' => 'string',
'plain_html_body_url' => 'string',
'origin' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'raw_smtp_message_url' => null,
'plain_html_body_url' => null,
'origin' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'raw_smtp_message_url' => false,
'plain_html_body_url' => false,
'origin' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'raw_smtp_message_url' => 'rawSmtpMessageUrl',
'plain_html_body_url' => 'plainHtmlBodyUrl',
'origin' => 'origin'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'raw_smtp_message_url' => 'setRawSmtpMessageUrl',
'plain_html_body_url' => 'setPlainHtmlBodyUrl',
'origin' => 'setOrigin'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'raw_smtp_message_url' => 'getRawSmtpMessageUrl',
'plain_html_body_url' => 'getPlainHtmlBodyUrl',
'origin' => 'getOrigin'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('raw_smtp_message_url', $data ?? [], null);
$this->setIfExists('plain_html_body_url', $data ?? [], null);
$this->setIfExists('origin', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['raw_smtp_message_url'] === null) {
$invalidProperties[] = "'raw_smtp_message_url' can't be null";
}
if ($this->container['plain_html_body_url'] === null) {
$invalidProperties[] = "'plain_html_body_url' can't be null";
}
if ($this->container['origin'] === null) {
$invalidProperties[] = "'origin' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets raw_smtp_message_url
*
* @return string
*/
public function getRawSmtpMessageUrl()
{
return $this->container['raw_smtp_message_url'];
}
/**
* Sets raw_smtp_message_url
*
* @param string $raw_smtp_message_url raw_smtp_message_url
*
* @return self
*/
public function setRawSmtpMessageUrl($raw_smtp_message_url)
{
if (is_null($raw_smtp_message_url)) {
throw new \InvalidArgumentException('non-nullable raw_smtp_message_url cannot be null');
}
$this->container['raw_smtp_message_url'] = $raw_smtp_message_url;
return $this;
}
/**
* Gets plain_html_body_url
*
* @return string
*/
public function getPlainHtmlBodyUrl()
{
return $this->container['plain_html_body_url'];
}
/**
* Sets plain_html_body_url
*
* @param string $plain_html_body_url plain_html_body_url
*
* @return self
*/
public function setPlainHtmlBodyUrl($plain_html_body_url)
{
if (is_null($plain_html_body_url)) {
throw new \InvalidArgumentException('non-nullable plain_html_body_url cannot be null');
}
$this->container['plain_html_body_url'] = $plain_html_body_url;
return $this;
}
/**
* Gets origin
*
* @return string
*/
public function getOrigin()
{
return $this->container['origin'];
}
/**
* Sets origin
*
* @param string $origin origin
*
* @return self
*/
public function setOrigin($origin)
{
if (is_null($origin)) {
throw new \InvalidArgumentException('non-nullable origin cannot be null');
}
$this->container['origin'] = $origin;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailPreview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailPreview Class Doc Comment
*
* @category Class
* @description Preview of an email message. For full message (including body and attachments) call the `getEmail` or other email endpoints with the provided email ID.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailPreview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailPreview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'domain_id' => 'string',
'subject' => 'string',
'to' => 'string[]',
'from' => 'string',
'bcc' => 'string[]',
'cc' => 'string[]',
'created_at' => '\DateTime',
'read' => 'bool',
'attachments' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'domain_id' => 'uuid',
'subject' => null,
'to' => null,
'from' => null,
'bcc' => null,
'cc' => null,
'created_at' => 'date-time',
'read' => null,
'attachments' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'domain_id' => true,
'subject' => true,
'to' => true,
'from' => true,
'bcc' => true,
'cc' => true,
'created_at' => false,
'read' => false,
'attachments' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'domain_id' => 'domainId',
'subject' => 'subject',
'to' => 'to',
'from' => 'from',
'bcc' => 'bcc',
'cc' => 'cc',
'created_at' => 'createdAt',
'read' => 'read',
'attachments' => 'attachments'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'domain_id' => 'setDomainId',
'subject' => 'setSubject',
'to' => 'setTo',
'from' => 'setFrom',
'bcc' => 'setBcc',
'cc' => 'setCc',
'created_at' => 'setCreatedAt',
'read' => 'setRead',
'attachments' => 'setAttachments'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'domain_id' => 'getDomainId',
'subject' => 'getSubject',
'to' => 'getTo',
'from' => 'getFrom',
'bcc' => 'getBcc',
'cc' => 'getCc',
'created_at' => 'getCreatedAt',
'read' => 'getRead',
'attachments' => 'getAttachments'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['read'] === null) {
$invalidProperties[] = "'read' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of the email entity
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id ID of the domain that received the email
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject The subject line of the email message as specified by SMTP subject header
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to List of `To` recipient email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
array_push($this->openAPINullablesSetToNull, 'to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from Who the email was sent from. An email address - see fromName for the sender name.
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets bcc
*
* @return string[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[]|null $bcc List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
array_push($this->openAPINullablesSetToNull, 'bcc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bcc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets cc
*
* @return string[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[]|null $cc List of `CC` recipients email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
array_push($this->openAPINullablesSetToNull, 'cc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('cc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at When was the email received by MailSlurp
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets read
*
* @return bool
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool $read Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks.
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
throw new \InvalidArgumentException('non-nullable read cannot be null');
}
$this->container['read'] = $read;
return $this;
}
/**
* Gets attachments
*
* @return string[]|null
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[]|null $attachments List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension.
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
array_push($this->openAPINullablesSetToNull, 'attachments');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachments', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailLinksResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailLinksResult Class Doc Comment
*
* @category Class
* @description Links found in HTML
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailLinksResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailLinksResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'links' => 'string[]',
'body' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'links' => null,
'body' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'links' => false,
'body' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'links' => 'links',
'body' => 'body'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'links' => 'setLinks',
'body' => 'setBody'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'links' => 'getLinks',
'body' => 'getBody'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('links', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['links'] === null) {
$invalidProperties[] = "'links' can't be null";
}
if ($this->container['body'] === null) {
$invalidProperties[] = "'body' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets links
*
* @return string[]
*/
public function getLinks()
{
return $this->container['links'];
}
/**
* Sets links
*
* @param string[] $links links
*
* @return self
*/
public function setLinks($links)
{
if (is_null($links)) {
throw new \InvalidArgumentException('non-nullable links cannot be null');
}
$this->container['links'] = $links;
return $this;
}
/**
* Gets body
*
* @return string
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailHtmlDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailHtmlDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailHtmlDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailHtmlDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'subject' => 'string',
'body' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'subject' => null,
'body' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'subject' => false,
'body' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'subject' => 'subject',
'body' => 'body'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'subject' => 'setSubject',
'body' => 'setBody'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'subject' => 'getSubject',
'body' => 'getBody'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets body
*
* @return string|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string|null $body body
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
throw new \InvalidArgumentException('non-nullable body cannot be null');
}
$this->container['body'] = $body;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureVersionStatistics
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureVersionStatistics Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureVersionStatistics implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureVersionStatistics';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'version' => 'string',
'support_flags' => '\MailSlurp\Models\EmailFeatureSupportFlags'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'version' => null,
'support_flags' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'version' => false,
'support_flags' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'version' => 'version',
'support_flags' => 'supportFlags'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'version' => 'setVersion',
'support_flags' => 'setSupportFlags'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'version' => 'getVersion',
'support_flags' => 'getSupportFlags'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('version', $data ?? [], null);
$this->setIfExists('support_flags', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['version'] === null) {
$invalidProperties[] = "'version' can't be null";
}
if ($this->container['support_flags'] === null) {
$invalidProperties[] = "'support_flags' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets version
*
* @return string
*/
public function getVersion()
{
return $this->container['version'];
}
/**
* Sets version
*
* @param string $version version
*
* @return self
*/
public function setVersion($version)
{
if (is_null($version)) {
throw new \InvalidArgumentException('non-nullable version cannot be null');
}
$this->container['version'] = $version;
return $this;
}
/**
* Gets support_flags
*
* @return \MailSlurp\Models\EmailFeatureSupportFlags
*/
public function getSupportFlags()
{
return $this->container['support_flags'];
}
/**
* Sets support_flags
*
* @param \MailSlurp\Models\EmailFeatureSupportFlags $support_flags support_flags
*
* @return self
*/
public function setSupportFlags($support_flags)
{
if (is_null($support_flags)) {
throw new \InvalidArgumentException('non-nullable support_flags cannot be null');
}
$this->container['support_flags'] = $support_flags;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureSupportStatusPercentage
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureSupportStatusPercentage Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureSupportStatusPercentage implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureSupportStatusPercentage';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'status' => 'string',
'percentage' => 'float'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'status' => null,
'percentage' => 'float'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'status' => false,
'percentage' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'status' => 'status',
'percentage' => 'percentage'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'status' => 'setStatus',
'percentage' => 'setPercentage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'status' => 'getStatus',
'percentage' => 'getPercentage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_SUPPORTED = 'SUPPORTED';
public const STATUS_PARTIAL = 'PARTIAL';
public const STATUS_NOT_SUPPORTED = 'NOT_SUPPORTED';
public const STATUS_UNKNOWN = 'UNKNOWN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_SUPPORTED,
self::STATUS_PARTIAL,
self::STATUS_NOT_SUPPORTED,
self::STATUS_UNKNOWN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('status', $data ?? [], null);
$this->setIfExists('percentage', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['status'] === null) {
$invalidProperties[] = "'status' can't be null";
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
if ($this->container['percentage'] === null) {
$invalidProperties[] = "'percentage' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets status
*
* @return string
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string $status status
*
* @return self
*/
public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets percentage
*
* @return float
*/
public function getPercentage()
{
return $this->container['percentage'];
}
/**
* Sets percentage
*
* @param float $percentage percentage
*
* @return self
*/
public function setPercentage($percentage)
{
if (is_null($percentage)) {
throw new \InvalidArgumentException('non-nullable percentage cannot be null');
}
$this->container['percentage'] = $percentage;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureSupportResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureSupportResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureSupportResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureSupportResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'names' => '\MailSlurp\Models\EmailFeatureNames',
'detected_features' => 'string[]',
'feature_overviews' => '\MailSlurp\Models\EmailFeatureOverview[]',
'feature_percentages' => '\MailSlurp\Models\EmailFeatureSupportStatusPercentage[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'names' => null,
'detected_features' => null,
'feature_overviews' => null,
'feature_percentages' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'names' => false,
'detected_features' => false,
'feature_overviews' => false,
'feature_percentages' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'names' => 'names',
'detected_features' => 'detectedFeatures',
'feature_overviews' => 'featureOverviews',
'feature_percentages' => 'featurePercentages'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'names' => 'setNames',
'detected_features' => 'setDetectedFeatures',
'feature_overviews' => 'setFeatureOverviews',
'feature_percentages' => 'setFeaturePercentages'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'names' => 'getNames',
'detected_features' => 'getDetectedFeatures',
'feature_overviews' => 'getFeatureOverviews',
'feature_percentages' => 'getFeaturePercentages'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const DETECTED_FEATURES_AMP = 'amp';
public const DETECTED_FEATURES_CSS_ACCENT_COLOR = 'css-accent-color';
public const DETECTED_FEATURES_CSS_ALIGN_ITEMS = 'css-align-items';
public const DETECTED_FEATURES_CSS_ANIMATION = 'css-animation';
public const DETECTED_FEATURES_CSS_ASPECT_RATIO = 'css-aspect-ratio';
public const DETECTED_FEATURES_CSS_AT_FONT_FACE = 'css-at-font-face';
public const DETECTED_FEATURES_CSS_AT_IMPORT = 'css-at-import';
public const DETECTED_FEATURES_CSS_AT_KEYFRAMES = 'css-at-keyframes';
public const DETECTED_FEATURES_CSS_AT_MEDIA = 'css-at-media';
public const DETECTED_FEATURES_CSS_AT_SUPPORTS = 'css-at-supports';
public const DETECTED_FEATURES_CSS_BACKGROUND_BLEND_MODE = 'css-background-blend-mode';
public const DETECTED_FEATURES_CSS_BACKGROUND_CLIP = 'css-background-clip';
public const DETECTED_FEATURES_CSS_BACKGROUND_COLOR = 'css-background-color';
public const DETECTED_FEATURES_CSS_BACKGROUND_IMAGE = 'css-background-image';
public const DETECTED_FEATURES_CSS_BACKGROUND_ORIGIN = 'css-background-origin';
public const DETECTED_FEATURES_CSS_BACKGROUND_POSITION = 'css-background-position';
public const DETECTED_FEATURES_CSS_BACKGROUND_REPEAT = 'css-background-repeat';
public const DETECTED_FEATURES_CSS_BACKGROUND_SIZE = 'css-background-size';
public const DETECTED_FEATURES_CSS_BACKGROUND = 'css-background';
public const DETECTED_FEATURES_CSS_BLOCK_INLINE_SIZE = 'css-block-inline-size';
public const DETECTED_FEATURES_CSS_BORDER_IMAGE = 'css-border-image';
public const DETECTED_FEATURES_CSS_BORDER_INLINE_BLOCK_INDIVIDUAL = 'css-border-inline-block-individual';
public const DETECTED_FEATURES_CSS_BORDER_INLINE_BLOCK_LONGHAND = 'css-border-inline-block-longhand';
public const DETECTED_FEATURES_CSS_BORDER_INLINE_BLOCK = 'css-border-inline-block';
public const DETECTED_FEATURES_CSS_BORDER_RADIUS_LOGICAL = 'css-border-radius-logical';
public const DETECTED_FEATURES_CSS_BORDER_RADIUS = 'css-border-radius';
public const DETECTED_FEATURES_CSS_BORDER = 'css-border';
public const DETECTED_FEATURES_CSS_BOX_SHADOW = 'css-box-shadow';
public const DETECTED_FEATURES_CSS_BOX_SIZING = 'css-box-sizing';
public const DETECTED_FEATURES_CSS_CAPTION_SIDE = 'css-caption-side';
public const DETECTED_FEATURES_CSS_CLIP_PATH = 'css-clip-path';
public const DETECTED_FEATURES_CSS_COLUMN_COUNT = 'css-column-count';
public const DETECTED_FEATURES_CSS_COLUMN_LAYOUT_PROPERTIES = 'css-column-layout-properties';
public const DETECTED_FEATURES_CSS_DIRECTION = 'css-direction';
public const DETECTED_FEATURES_CSS_DISPLAY_FLEX = 'css-display-flex';
public const DETECTED_FEATURES_CSS_DISPLAY_GRID = 'css-display-grid';
public const DETECTED_FEATURES_CSS_DISPLAY_NONE = 'css-display-none';
public const DETECTED_FEATURES_CSS_DISPLAY = 'css-display';
public const DETECTED_FEATURES_CSS_FILTER = 'css-filter';
public const DETECTED_FEATURES_CSS_FLEX_DIRECTION = 'css-flex-direction';
public const DETECTED_FEATURES_CSS_FLEX_WRAP = 'css-flex-wrap';
public const DETECTED_FEATURES_CSS_FLOAT = 'css-float';
public const DETECTED_FEATURES_CSS_FONT_KERNING = 'css-font-kerning';
public const DETECTED_FEATURES_CSS_FONT_WEIGHT = 'css-font-weight';
public const DETECTED_FEATURES_CSS_FONT = 'css-font';
public const DETECTED_FEATURES_CSS_GAP = 'css-gap';
public const DETECTED_FEATURES_CSS_GRID_TEMPLATE = 'css-grid-template';
public const DETECTED_FEATURES_CSS_HEIGHT = 'css-height';
public const DETECTED_FEATURES_CSS_HYPHENS = 'css-hyphens';
public const DETECTED_FEATURES_CSS_INLINE_SIZE = 'css-inline-size';
public const DETECTED_FEATURES_CSS_JUSTIFY_CONTENT = 'css-justify-content';
public const DETECTED_FEATURES_CSS_LEFT_RIGHT_TOP_BOTTOM = 'css-left-right-top-bottom';
public const DETECTED_FEATURES_CSS_LETTER_SPACING = 'css-letter-spacing';
public const DETECTED_FEATURES_CSS_LINE_HEIGHT = 'css-line-height';
public const DETECTED_FEATURES_CSS_LIST_STYLE_IMAGE = 'css-list-style-image';
public const DETECTED_FEATURES_CSS_LIST_STYLE_POSITION = 'css-list-style-position';
public const DETECTED_FEATURES_CSS_LIST_STYLE_TYPE = 'css-list-style-type';
public const DETECTED_FEATURES_CSS_LIST_STYLE = 'css-list-style';
public const DETECTED_FEATURES_CSS_MARGIN_BLOCK_START_END = 'css-margin-block-start-end';
public const DETECTED_FEATURES_CSS_MARGIN_INLINE_BLOCK = 'css-margin-inline-block';
public const DETECTED_FEATURES_CSS_MARGIN_INLINE_START_END = 'css-margin-inline-start-end';
public const DETECTED_FEATURES_CSS_MARGIN_INLINE = 'css-margin-inline';
public const DETECTED_FEATURES_CSS_MARGIN = 'css-margin';
public const DETECTED_FEATURES_CSS_MAX_BLOCK_SIZE = 'css-max-block-size';
public const DETECTED_FEATURES_CSS_MAX_HEIGHT = 'css-max-height';
public const DETECTED_FEATURES_CSS_MAX_WIDTH = 'css-max-width';
public const DETECTED_FEATURES_CSS_MIN_HEIGHT = 'css-min-height';
public const DETECTED_FEATURES_CSS_MIN_INLINE_SIZE = 'css-min-inline-size';
public const DETECTED_FEATURES_CSS_MIN_WIDTH = 'css-min-width';
public const DETECTED_FEATURES_CSS_MIX_BLEND_MODE = 'css-mix-blend-mode';
public const DETECTED_FEATURES_CSS_OBJECT_FIT = 'css-object-fit';
public const DETECTED_FEATURES_CSS_OBJECT_POSITION = 'css-object-position';
public const DETECTED_FEATURES_CSS_OPACITY = 'css-opacity';
public const DETECTED_FEATURES_CSS_OUTLINE_OFFSET = 'css-outline-offset';
public const DETECTED_FEATURES_CSS_OUTLINE = 'css-outline';
public const DETECTED_FEATURES_CSS_OVERFLOW_WRAP = 'css-overflow-wrap';
public const DETECTED_FEATURES_CSS_OVERFLOW = 'css-overflow';
public const DETECTED_FEATURES_CSS_PADDING_BLOCK_START_END = 'css-padding-block-start-end';
public const DETECTED_FEATURES_CSS_PADDING_INLINE_BLOCK = 'css-padding-inline-block';
public const DETECTED_FEATURES_CSS_PADDING_INLINE_START_END = 'css-padding-inline-start-end';
public const DETECTED_FEATURES_CSS_PADDING = 'css-padding';
public const DETECTED_FEATURES_CSS_POSITION = 'css-position';
public const DETECTED_FEATURES_CSS_TAB_SIZE = 'css-tab-size';
public const DETECTED_FEATURES_CSS_TABLE_LAYOUT = 'css-table-layout';
public const DETECTED_FEATURES_CSS_TEXT_ALIGN_LAST = 'css-text-align-last';
public const DETECTED_FEATURES_CSS_TEXT_ALIGN = 'css-text-align';
public const DETECTED_FEATURES_CSS_TEXT_DECORATION_COLOR = 'css-text-decoration-color';
public const DETECTED_FEATURES_CSS_TEXT_DECORATION_THICKNESS = 'css-text-decoration-thickness';
public const DETECTED_FEATURES_CSS_TEXT_DECORATION = 'css-text-decoration';
public const DETECTED_FEATURES_CSS_TEXT_EMPHASIS_POSITION = 'css-text-emphasis-position';
public const DETECTED_FEATURES_CSS_TEXT_EMPHASIS = 'css-text-emphasis';
public const DETECTED_FEATURES_CSS_TEXT_INDENT = 'css-text-indent';
public const DETECTED_FEATURES_CSS_TEXT_OVERFLOW = 'css-text-overflow';
public const DETECTED_FEATURES_CSS_TEXT_SHADOW = 'css-text-shadow';
public const DETECTED_FEATURES_CSS_TEXT_TRANSFORM = 'css-text-transform';
public const DETECTED_FEATURES_CSS_TEXT_UNDERLINE_OFFSET = 'css-text-underline-offset';
public const DETECTED_FEATURES_CSS_TRANSFORM = 'css-transform';
public const DETECTED_FEATURES_CSS_VERTICAL_ALIGN = 'css-vertical-align';
public const DETECTED_FEATURES_CSS_VISIBILITY = 'css-visibility';
public const DETECTED_FEATURES_CSS_WHITE_SPACE = 'css-white-space';
public const DETECTED_FEATURES_CSS_WIDTH = 'css-width';
public const DETECTED_FEATURES_CSS_WORD_BREAK = 'css-word-break';
public const DETECTED_FEATURES_CSS_WRITING_MODE = 'css-writing-mode';
public const DETECTED_FEATURES_CSS_Z_INDEX = 'css-z-index';
public const DETECTED_FEATURES_HTML_ABBR = 'html-abbr';
public const DETECTED_FEATURES_HTML_ADDRESS = 'html-address';
public const DETECTED_FEATURES_HTML_ALIGN = 'html-align';
public const DETECTED_FEATURES_HTML_ANCHOR_LINKS = 'html-anchor-links';
public const DETECTED_FEATURES_HTML_ARIA_DESCRIBEDBY = 'html-aria-describedby';
public const DETECTED_FEATURES_HTML_ARIA_HIDDEN = 'html-aria-hidden';
public const DETECTED_FEATURES_HTML_ARIA_LABEL = 'html-aria-label';
public const DETECTED_FEATURES_HTML_ARIA_LABELLEDBY = 'html-aria-labelledby';
public const DETECTED_FEATURES_HTML_ARIA_LIVE = 'html-aria-live';
public const DETECTED_FEATURES_HTML_AUDIO = 'html-audio';
public const DETECTED_FEATURES_HTML_BACKGROUND = 'html-background';
public const DETECTED_FEATURES_HTML_BASE = 'html-base';
public const DETECTED_FEATURES_HTML_BLOCKQUOTE = 'html-blockquote';
public const DETECTED_FEATURES_HTML_BODY = 'html-body';
public const DETECTED_FEATURES_HTML_BUTTON_RESET = 'html-button-reset';
public const DETECTED_FEATURES_HTML_BUTTON_SUBMIT = 'html-button-submit';
public const DETECTED_FEATURES_HTML_CODE = 'html-code';
public const DETECTED_FEATURES_HTML_DEL = 'html-del';
public const DETECTED_FEATURES_HTML_DFN = 'html-dfn';
public const DETECTED_FEATURES_HTML_DIALOG = 'html-dialog';
public const DETECTED_FEATURES_HTML_DIR = 'html-dir';
public const DETECTED_FEATURES_HTML_DIV = 'html-div';
public const DETECTED_FEATURES_HTML_DOCTYPE = 'html-doctype';
public const DETECTED_FEATURES_HTML_FORM = 'html-form';
public const DETECTED_FEATURES_HTML_H1_H6 = 'html-h1-h6';
public const DETECTED_FEATURES_HTML_HEIGHT = 'html-height';
public const DETECTED_FEATURES_HTML_IMAGE_MAPS = 'html-image-maps';
public const DETECTED_FEATURES_HTML_INPUT_CHECKBOX = 'html-input-checkbox';
public const DETECTED_FEATURES_HTML_INPUT_HIDDEN = 'html-input-hidden';
public const DETECTED_FEATURES_HTML_INPUT_RADIO = 'html-input-radio';
public const DETECTED_FEATURES_HTML_INPUT_RESET = 'html-input-reset';
public const DETECTED_FEATURES_HTML_INPUT_SUBMIT = 'html-input-submit';
public const DETECTED_FEATURES_HTML_INPUT_TEXT = 'html-input-text';
public const DETECTED_FEATURES_HTML_LANG = 'html-lang';
public const DETECTED_FEATURES_HTML_LINK = 'html-link';
public const DETECTED_FEATURES_HTML_LISTS = 'html-lists';
public const DETECTED_FEATURES_HTML_LOADING_ATTRIBUTE = 'html-loading-attribute';
public const DETECTED_FEATURES_HTML_MAILTO_LINKS = 'html-mailto-links';
public const DETECTED_FEATURES_HTML_MARQUEE = 'html-marquee';
public const DETECTED_FEATURES_HTML_METER = 'html-meter';
public const DETECTED_FEATURES_HTML_OBJECT = 'html-object';
public const DETECTED_FEATURES_HTML_P = 'html-p';
public const DETECTED_FEATURES_HTML_PICTURE = 'html-picture';
public const DETECTED_FEATURES_HTML_PRE = 'html-pre';
public const DETECTED_FEATURES_HTML_PROGRESS = 'html-progress';
public const DETECTED_FEATURES_HTML_REQUIRED = 'html-required';
public const DETECTED_FEATURES_HTML_ROLE = 'html-role';
public const DETECTED_FEATURES_HTML_RP = 'html-rp';
public const DETECTED_FEATURES_HTML_RT = 'html-rt';
public const DETECTED_FEATURES_HTML_RUBY = 'html-ruby';
public const DETECTED_FEATURES_HTML_SELECT = 'html-select';
public const DETECTED_FEATURES_HTML_SEMANTICS = 'html-semantics';
public const DETECTED_FEATURES_HTML_SMALL = 'html-small';
public const DETECTED_FEATURES_HTML_SPAN = 'html-span';
public const DETECTED_FEATURES_HTML_SRCSET = 'html-srcset';
public const DETECTED_FEATURES_HTML_STRIKE = 'html-strike';
public const DETECTED_FEATURES_HTML_STRONG = 'html-strong';
public const DETECTED_FEATURES_HTML_STYLE = 'html-style';
public const DETECTED_FEATURES_HTML_SVG = 'html-svg';
public const DETECTED_FEATURES_HTML_TABLE = 'html-table';
public const DETECTED_FEATURES_HTML_TARGET = 'html-target';
public const DETECTED_FEATURES_HTML_TEXTAREA = 'html-textarea';
public const DETECTED_FEATURES_HTML_VALIGN = 'html-valign';
public const DETECTED_FEATURES_HTML_VIDEO = 'html-video';
public const DETECTED_FEATURES_HTML_WBR = 'html-wbr';
public const DETECTED_FEATURES_HTML_WIDTH = 'html-width';
public const DETECTED_FEATURES_IMAGE_AVIF = 'image-avif';
public const DETECTED_FEATURES_IMAGE_BASE64 = 'image-base64';
public const DETECTED_FEATURES_IMAGE_BMP = 'image-bmp';
public const DETECTED_FEATURES_IMAGE_GIF = 'image-gif';
public const DETECTED_FEATURES_IMAGE_ICO = 'image-ico';
public const DETECTED_FEATURES_IMAGE_JPG = 'image-jpg';
public const DETECTED_FEATURES_IMAGE_PNG = 'image-png';
public const DETECTED_FEATURES_IMAGE_SVG = 'image-svg';
public const DETECTED_FEATURES_IMAGE_WEBP = 'image-webp';
public const DETECTED_FEATURES_UNSUPPORTED = 'unsupported';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getDetectedFeaturesAllowableValues()
{
return [
self::DETECTED_FEATURES_AMP,
self::DETECTED_FEATURES_CSS_ACCENT_COLOR,
self::DETECTED_FEATURES_CSS_ALIGN_ITEMS,
self::DETECTED_FEATURES_CSS_ANIMATION,
self::DETECTED_FEATURES_CSS_ASPECT_RATIO,
self::DETECTED_FEATURES_CSS_AT_FONT_FACE,
self::DETECTED_FEATURES_CSS_AT_IMPORT,
self::DETECTED_FEATURES_CSS_AT_KEYFRAMES,
self::DETECTED_FEATURES_CSS_AT_MEDIA,
self::DETECTED_FEATURES_CSS_AT_SUPPORTS,
self::DETECTED_FEATURES_CSS_BACKGROUND_BLEND_MODE,
self::DETECTED_FEATURES_CSS_BACKGROUND_CLIP,
self::DETECTED_FEATURES_CSS_BACKGROUND_COLOR,
self::DETECTED_FEATURES_CSS_BACKGROUND_IMAGE,
self::DETECTED_FEATURES_CSS_BACKGROUND_ORIGIN,
self::DETECTED_FEATURES_CSS_BACKGROUND_POSITION,
self::DETECTED_FEATURES_CSS_BACKGROUND_REPEAT,
self::DETECTED_FEATURES_CSS_BACKGROUND_SIZE,
self::DETECTED_FEATURES_CSS_BACKGROUND,
self::DETECTED_FEATURES_CSS_BLOCK_INLINE_SIZE,
self::DETECTED_FEATURES_CSS_BORDER_IMAGE,
self::DETECTED_FEATURES_CSS_BORDER_INLINE_BLOCK_INDIVIDUAL,
self::DETECTED_FEATURES_CSS_BORDER_INLINE_BLOCK_LONGHAND,
self::DETECTED_FEATURES_CSS_BORDER_INLINE_BLOCK,
self::DETECTED_FEATURES_CSS_BORDER_RADIUS_LOGICAL,
self::DETECTED_FEATURES_CSS_BORDER_RADIUS,
self::DETECTED_FEATURES_CSS_BORDER,
self::DETECTED_FEATURES_CSS_BOX_SHADOW,
self::DETECTED_FEATURES_CSS_BOX_SIZING,
self::DETECTED_FEATURES_CSS_CAPTION_SIDE,
self::DETECTED_FEATURES_CSS_CLIP_PATH,
self::DETECTED_FEATURES_CSS_COLUMN_COUNT,
self::DETECTED_FEATURES_CSS_COLUMN_LAYOUT_PROPERTIES,
self::DETECTED_FEATURES_CSS_DIRECTION,
self::DETECTED_FEATURES_CSS_DISPLAY_FLEX,
self::DETECTED_FEATURES_CSS_DISPLAY_GRID,
self::DETECTED_FEATURES_CSS_DISPLAY_NONE,
self::DETECTED_FEATURES_CSS_DISPLAY,
self::DETECTED_FEATURES_CSS_FILTER,
self::DETECTED_FEATURES_CSS_FLEX_DIRECTION,
self::DETECTED_FEATURES_CSS_FLEX_WRAP,
self::DETECTED_FEATURES_CSS_FLOAT,
self::DETECTED_FEATURES_CSS_FONT_KERNING,
self::DETECTED_FEATURES_CSS_FONT_WEIGHT,
self::DETECTED_FEATURES_CSS_FONT,
self::DETECTED_FEATURES_CSS_GAP,
self::DETECTED_FEATURES_CSS_GRID_TEMPLATE,
self::DETECTED_FEATURES_CSS_HEIGHT,
self::DETECTED_FEATURES_CSS_HYPHENS,
self::DETECTED_FEATURES_CSS_INLINE_SIZE,
self::DETECTED_FEATURES_CSS_JUSTIFY_CONTENT,
self::DETECTED_FEATURES_CSS_LEFT_RIGHT_TOP_BOTTOM,
self::DETECTED_FEATURES_CSS_LETTER_SPACING,
self::DETECTED_FEATURES_CSS_LINE_HEIGHT,
self::DETECTED_FEATURES_CSS_LIST_STYLE_IMAGE,
self::DETECTED_FEATURES_CSS_LIST_STYLE_POSITION,
self::DETECTED_FEATURES_CSS_LIST_STYLE_TYPE,
self::DETECTED_FEATURES_CSS_LIST_STYLE,
self::DETECTED_FEATURES_CSS_MARGIN_BLOCK_START_END,
self::DETECTED_FEATURES_CSS_MARGIN_INLINE_BLOCK,
self::DETECTED_FEATURES_CSS_MARGIN_INLINE_START_END,
self::DETECTED_FEATURES_CSS_MARGIN_INLINE,
self::DETECTED_FEATURES_CSS_MARGIN,
self::DETECTED_FEATURES_CSS_MAX_BLOCK_SIZE,
self::DETECTED_FEATURES_CSS_MAX_HEIGHT,
self::DETECTED_FEATURES_CSS_MAX_WIDTH,
self::DETECTED_FEATURES_CSS_MIN_HEIGHT,
self::DETECTED_FEATURES_CSS_MIN_INLINE_SIZE,
self::DETECTED_FEATURES_CSS_MIN_WIDTH,
self::DETECTED_FEATURES_CSS_MIX_BLEND_MODE,
self::DETECTED_FEATURES_CSS_OBJECT_FIT,
self::DETECTED_FEATURES_CSS_OBJECT_POSITION,
self::DETECTED_FEATURES_CSS_OPACITY,
self::DETECTED_FEATURES_CSS_OUTLINE_OFFSET,
self::DETECTED_FEATURES_CSS_OUTLINE,
self::DETECTED_FEATURES_CSS_OVERFLOW_WRAP,
self::DETECTED_FEATURES_CSS_OVERFLOW,
self::DETECTED_FEATURES_CSS_PADDING_BLOCK_START_END,
self::DETECTED_FEATURES_CSS_PADDING_INLINE_BLOCK,
self::DETECTED_FEATURES_CSS_PADDING_INLINE_START_END,
self::DETECTED_FEATURES_CSS_PADDING,
self::DETECTED_FEATURES_CSS_POSITION,
self::DETECTED_FEATURES_CSS_TAB_SIZE,
self::DETECTED_FEATURES_CSS_TABLE_LAYOUT,
self::DETECTED_FEATURES_CSS_TEXT_ALIGN_LAST,
self::DETECTED_FEATURES_CSS_TEXT_ALIGN,
self::DETECTED_FEATURES_CSS_TEXT_DECORATION_COLOR,
self::DETECTED_FEATURES_CSS_TEXT_DECORATION_THICKNESS,
self::DETECTED_FEATURES_CSS_TEXT_DECORATION,
self::DETECTED_FEATURES_CSS_TEXT_EMPHASIS_POSITION,
self::DETECTED_FEATURES_CSS_TEXT_EMPHASIS,
self::DETECTED_FEATURES_CSS_TEXT_INDENT,
self::DETECTED_FEATURES_CSS_TEXT_OVERFLOW,
self::DETECTED_FEATURES_CSS_TEXT_SHADOW,
self::DETECTED_FEATURES_CSS_TEXT_TRANSFORM,
self::DETECTED_FEATURES_CSS_TEXT_UNDERLINE_OFFSET,
self::DETECTED_FEATURES_CSS_TRANSFORM,
self::DETECTED_FEATURES_CSS_VERTICAL_ALIGN,
self::DETECTED_FEATURES_CSS_VISIBILITY,
self::DETECTED_FEATURES_CSS_WHITE_SPACE,
self::DETECTED_FEATURES_CSS_WIDTH,
self::DETECTED_FEATURES_CSS_WORD_BREAK,
self::DETECTED_FEATURES_CSS_WRITING_MODE,
self::DETECTED_FEATURES_CSS_Z_INDEX,
self::DETECTED_FEATURES_HTML_ABBR,
self::DETECTED_FEATURES_HTML_ADDRESS,
self::DETECTED_FEATURES_HTML_ALIGN,
self::DETECTED_FEATURES_HTML_ANCHOR_LINKS,
self::DETECTED_FEATURES_HTML_ARIA_DESCRIBEDBY,
self::DETECTED_FEATURES_HTML_ARIA_HIDDEN,
self::DETECTED_FEATURES_HTML_ARIA_LABEL,
self::DETECTED_FEATURES_HTML_ARIA_LABELLEDBY,
self::DETECTED_FEATURES_HTML_ARIA_LIVE,
self::DETECTED_FEATURES_HTML_AUDIO,
self::DETECTED_FEATURES_HTML_BACKGROUND,
self::DETECTED_FEATURES_HTML_BASE,
self::DETECTED_FEATURES_HTML_BLOCKQUOTE,
self::DETECTED_FEATURES_HTML_BODY,
self::DETECTED_FEATURES_HTML_BUTTON_RESET,
self::DETECTED_FEATURES_HTML_BUTTON_SUBMIT,
self::DETECTED_FEATURES_HTML_CODE,
self::DETECTED_FEATURES_HTML_DEL,
self::DETECTED_FEATURES_HTML_DFN,
self::DETECTED_FEATURES_HTML_DIALOG,
self::DETECTED_FEATURES_HTML_DIR,
self::DETECTED_FEATURES_HTML_DIV,
self::DETECTED_FEATURES_HTML_DOCTYPE,
self::DETECTED_FEATURES_HTML_FORM,
self::DETECTED_FEATURES_HTML_H1_H6,
self::DETECTED_FEATURES_HTML_HEIGHT,
self::DETECTED_FEATURES_HTML_IMAGE_MAPS,
self::DETECTED_FEATURES_HTML_INPUT_CHECKBOX,
self::DETECTED_FEATURES_HTML_INPUT_HIDDEN,
self::DETECTED_FEATURES_HTML_INPUT_RADIO,
self::DETECTED_FEATURES_HTML_INPUT_RESET,
self::DETECTED_FEATURES_HTML_INPUT_SUBMIT,
self::DETECTED_FEATURES_HTML_INPUT_TEXT,
self::DETECTED_FEATURES_HTML_LANG,
self::DETECTED_FEATURES_HTML_LINK,
self::DETECTED_FEATURES_HTML_LISTS,
self::DETECTED_FEATURES_HTML_LOADING_ATTRIBUTE,
self::DETECTED_FEATURES_HTML_MAILTO_LINKS,
self::DETECTED_FEATURES_HTML_MARQUEE,
self::DETECTED_FEATURES_HTML_METER,
self::DETECTED_FEATURES_HTML_OBJECT,
self::DETECTED_FEATURES_HTML_P,
self::DETECTED_FEATURES_HTML_PICTURE,
self::DETECTED_FEATURES_HTML_PRE,
self::DETECTED_FEATURES_HTML_PROGRESS,
self::DETECTED_FEATURES_HTML_REQUIRED,
self::DETECTED_FEATURES_HTML_ROLE,
self::DETECTED_FEATURES_HTML_RP,
self::DETECTED_FEATURES_HTML_RT,
self::DETECTED_FEATURES_HTML_RUBY,
self::DETECTED_FEATURES_HTML_SELECT,
self::DETECTED_FEATURES_HTML_SEMANTICS,
self::DETECTED_FEATURES_HTML_SMALL,
self::DETECTED_FEATURES_HTML_SPAN,
self::DETECTED_FEATURES_HTML_SRCSET,
self::DETECTED_FEATURES_HTML_STRIKE,
self::DETECTED_FEATURES_HTML_STRONG,
self::DETECTED_FEATURES_HTML_STYLE,
self::DETECTED_FEATURES_HTML_SVG,
self::DETECTED_FEATURES_HTML_TABLE,
self::DETECTED_FEATURES_HTML_TARGET,
self::DETECTED_FEATURES_HTML_TEXTAREA,
self::DETECTED_FEATURES_HTML_VALIGN,
self::DETECTED_FEATURES_HTML_VIDEO,
self::DETECTED_FEATURES_HTML_WBR,
self::DETECTED_FEATURES_HTML_WIDTH,
self::DETECTED_FEATURES_IMAGE_AVIF,
self::DETECTED_FEATURES_IMAGE_BASE64,
self::DETECTED_FEATURES_IMAGE_BMP,
self::DETECTED_FEATURES_IMAGE_GIF,
self::DETECTED_FEATURES_IMAGE_ICO,
self::DETECTED_FEATURES_IMAGE_JPG,
self::DETECTED_FEATURES_IMAGE_PNG,
self::DETECTED_FEATURES_IMAGE_SVG,
self::DETECTED_FEATURES_IMAGE_WEBP,
self::DETECTED_FEATURES_UNSUPPORTED,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('names', $data ?? [], null);
$this->setIfExists('detected_features', $data ?? [], null);
$this->setIfExists('feature_overviews', $data ?? [], null);
$this->setIfExists('feature_percentages', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['names'] === null) {
$invalidProperties[] = "'names' can't be null";
}
if ($this->container['detected_features'] === null) {
$invalidProperties[] = "'detected_features' can't be null";
}
if ($this->container['feature_overviews'] === null) {
$invalidProperties[] = "'feature_overviews' can't be null";
}
if ($this->container['feature_percentages'] === null) {
$invalidProperties[] = "'feature_percentages' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets names
*
* @return \MailSlurp\Models\EmailFeatureNames
*/
public function getNames()
{
return $this->container['names'];
}
/**
* Sets names
*
* @param \MailSlurp\Models\EmailFeatureNames $names names
*
* @return self
*/
public function setNames($names)
{
if (is_null($names)) {
throw new \InvalidArgumentException('non-nullable names cannot be null');
}
$this->container['names'] = $names;
return $this;
}
/**
* Gets detected_features
*
* @return string[]
*/
public function getDetectedFeatures()
{
return $this->container['detected_features'];
}
/**
* Sets detected_features
*
* @param string[] $detected_features detected_features
*
* @return self
*/
public function setDetectedFeatures($detected_features)
{
$allowedValues = $this->getDetectedFeaturesAllowableValues();
if (array_diff($detected_features, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'detected_features', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
if (is_null($detected_features)) {
throw new \InvalidArgumentException('non-nullable detected_features cannot be null');
}
$this->container['detected_features'] = $detected_features;
return $this;
}
/**
* Gets feature_overviews
*
* @return \MailSlurp\Models\EmailFeatureOverview[]
*/
public function getFeatureOverviews()
{
return $this->container['feature_overviews'];
}
/**
* Sets feature_overviews
*
* @param \MailSlurp\Models\EmailFeatureOverview[] $feature_overviews feature_overviews
*
* @return self
*/
public function setFeatureOverviews($feature_overviews)
{
if (is_null($feature_overviews)) {
throw new \InvalidArgumentException('non-nullable feature_overviews cannot be null');
}
$this->container['feature_overviews'] = $feature_overviews;
return $this;
}
/**
* Gets feature_percentages
*
* @return \MailSlurp\Models\EmailFeatureSupportStatusPercentage[]
*/
public function getFeaturePercentages()
{
return $this->container['feature_percentages'];
}
/**
* Sets feature_percentages
*
* @param \MailSlurp\Models\EmailFeatureSupportStatusPercentage[] $feature_percentages feature_percentages
*
* @return self
*/
public function setFeaturePercentages($feature_percentages)
{
if (is_null($feature_percentages)) {
throw new \InvalidArgumentException('non-nullable feature_percentages cannot be null');
}
$this->container['feature_percentages'] = $feature_percentages;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureSupportFlags
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureSupportFlags Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureSupportFlags implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureSupportFlags';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'status' => 'string',
'notes' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'status' => null,
'notes' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'status' => false,
'notes' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'status' => 'status',
'notes' => 'notes'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'status' => 'setStatus',
'notes' => 'setNotes'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'status' => 'getStatus',
'notes' => 'getNotes'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_SUPPORTED = 'SUPPORTED';
public const STATUS_PARTIAL = 'PARTIAL';
public const STATUS_NOT_SUPPORTED = 'NOT_SUPPORTED';
public const STATUS_UNKNOWN = 'UNKNOWN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_SUPPORTED,
self::STATUS_PARTIAL,
self::STATUS_NOT_SUPPORTED,
self::STATUS_UNKNOWN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('status', $data ?? [], null);
$this->setIfExists('notes', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['status'] === null) {
$invalidProperties[] = "'status' can't be null";
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets status
*
* @return string
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string $status status
*
* @return self
*/
public function setStatus($status)
{
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets notes
*
* @return string[]|null
*/
public function getNotes()
{
return $this->container['notes'];
}
/**
* Sets notes
*
* @param string[]|null $notes notes
*
* @return self
*/
public function setNotes($notes)
{
if (is_null($notes)) {
throw new \InvalidArgumentException('non-nullable notes cannot be null');
}
$this->container['notes'] = $notes;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeaturePlatformStatistics
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeaturePlatformStatistics Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeaturePlatformStatistics implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeaturePlatformStatistics';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'platform' => 'string',
'versions' => '\MailSlurp\Models\EmailFeatureVersionStatistics[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'platform' => null,
'versions' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'platform' => false,
'versions' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'platform' => 'platform',
'versions' => 'versions'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'platform' => 'setPlatform',
'versions' => 'setVersions'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'platform' => 'getPlatform',
'versions' => 'getVersions'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const PLATFORM_ANDROID = 'android';
public const PLATFORM_DESKTOP_APP = 'desktop-app';
public const PLATFORM_DESKTOP_WEBMAIL = 'desktop-webmail';
public const PLATFORM_IOS = 'ios';
public const PLATFORM_MACOS = 'macos';
public const PLATFORM_MOBILE_WEBMAIL = 'mobile-webmail';
public const PLATFORM_OUTLOOK_COM = 'outlook-com';
public const PLATFORM_WEBMAIL = 'webmail';
public const PLATFORM_WINDOWS = 'windows';
public const PLATFORM_WINDOWS_MAIL = 'windows-mail';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getPlatformAllowableValues()
{
return [
self::PLATFORM_ANDROID,
self::PLATFORM_DESKTOP_APP,
self::PLATFORM_DESKTOP_WEBMAIL,
self::PLATFORM_IOS,
self::PLATFORM_MACOS,
self::PLATFORM_MOBILE_WEBMAIL,
self::PLATFORM_OUTLOOK_COM,
self::PLATFORM_WEBMAIL,
self::PLATFORM_WINDOWS,
self::PLATFORM_WINDOWS_MAIL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('platform', $data ?? [], null);
$this->setIfExists('versions', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['platform'] === null) {
$invalidProperties[] = "'platform' can't be null";
}
$allowedValues = $this->getPlatformAllowableValues();
if (!is_null($this->container['platform']) && !in_array($this->container['platform'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'platform', must be one of '%s'",
$this->container['platform'],
implode("', '", $allowedValues)
);
}
if ($this->container['versions'] === null) {
$invalidProperties[] = "'versions' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets platform
*
* @return string
*/
public function getPlatform()
{
return $this->container['platform'];
}
/**
* Sets platform
*
* @param string $platform platform
*
* @return self
*/
public function setPlatform($platform)
{
$allowedValues = $this->getPlatformAllowableValues();
if (!in_array($platform, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'platform', must be one of '%s'",
$platform,
implode("', '", $allowedValues)
)
);
}
if (is_null($platform)) {
throw new \InvalidArgumentException('non-nullable platform cannot be null');
}
$this->container['platform'] = $platform;
return $this;
}
/**
* Gets versions
*
* @return \MailSlurp\Models\EmailFeatureVersionStatistics[]
*/
public function getVersions()
{
return $this->container['versions'];
}
/**
* Sets versions
*
* @param \MailSlurp\Models\EmailFeatureVersionStatistics[] $versions versions
*
* @return self
*/
public function setVersions($versions)
{
if (is_null($versions)) {
throw new \InvalidArgumentException('non-nullable versions cannot be null');
}
$this->container['versions'] = $versions;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeaturePlatformName
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeaturePlatformName Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeaturePlatformName implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeaturePlatformName';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'slug' => 'string',
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'slug' => null,
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'slug' => false,
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'slug' => 'slug',
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'slug' => 'setSlug',
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'slug' => 'getSlug',
'name' => 'getName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SLUG_ANDROID = 'android';
public const SLUG_DESKTOP_APP = 'desktop-app';
public const SLUG_DESKTOP_WEBMAIL = 'desktop-webmail';
public const SLUG_IOS = 'ios';
public const SLUG_MACOS = 'macos';
public const SLUG_MOBILE_WEBMAIL = 'mobile-webmail';
public const SLUG_OUTLOOK_COM = 'outlook-com';
public const SLUG_WEBMAIL = 'webmail';
public const SLUG_WINDOWS = 'windows';
public const SLUG_WINDOWS_MAIL = 'windows-mail';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSlugAllowableValues()
{
return [
self::SLUG_ANDROID,
self::SLUG_DESKTOP_APP,
self::SLUG_DESKTOP_WEBMAIL,
self::SLUG_IOS,
self::SLUG_MACOS,
self::SLUG_MOBILE_WEBMAIL,
self::SLUG_OUTLOOK_COM,
self::SLUG_WEBMAIL,
self::SLUG_WINDOWS,
self::SLUG_WINDOWS_MAIL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('slug', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['slug'] === null) {
$invalidProperties[] = "'slug' can't be null";
}
$allowedValues = $this->getSlugAllowableValues();
if (!is_null($this->container['slug']) && !in_array($this->container['slug'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'slug', must be one of '%s'",
$this->container['slug'],
implode("', '", $allowedValues)
);
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets slug
*
* @return string
*/
public function getSlug()
{
return $this->container['slug'];
}
/**
* Sets slug
*
* @param string $slug slug
*
* @return self
*/
public function setSlug($slug)
{
$allowedValues = $this->getSlugAllowableValues();
if (!in_array($slug, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'slug', must be one of '%s'",
$slug,
implode("', '", $allowedValues)
)
);
}
if (is_null($slug)) {
throw new \InvalidArgumentException('non-nullable slug cannot be null');
}
$this->container['slug'] = $slug;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureOverview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureOverview Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureOverview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureOverview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'feature' => 'string',
'title' => 'string',
'description' => 'string',
'category' => 'string',
'notes' => 'string',
'notes_numbers' => 'array<string,string>',
'feature_statistics' => '\MailSlurp\Models\EmailFeatureFamilyStatistics[]',
'statuses' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'feature' => null,
'title' => null,
'description' => null,
'category' => null,
'notes' => null,
'notes_numbers' => null,
'feature_statistics' => null,
'statuses' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'feature' => false,
'title' => false,
'description' => false,
'category' => false,
'notes' => false,
'notes_numbers' => false,
'feature_statistics' => false,
'statuses' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'feature' => 'feature',
'title' => 'title',
'description' => 'description',
'category' => 'category',
'notes' => 'notes',
'notes_numbers' => 'notesNumbers',
'feature_statistics' => 'featureStatistics',
'statuses' => 'statuses'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'feature' => 'setFeature',
'title' => 'setTitle',
'description' => 'setDescription',
'category' => 'setCategory',
'notes' => 'setNotes',
'notes_numbers' => 'setNotesNumbers',
'feature_statistics' => 'setFeatureStatistics',
'statuses' => 'setStatuses'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'feature' => 'getFeature',
'title' => 'getTitle',
'description' => 'getDescription',
'category' => 'getCategory',
'notes' => 'getNotes',
'notes_numbers' => 'getNotesNumbers',
'feature_statistics' => 'getFeatureStatistics',
'statuses' => 'getStatuses'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FEATURE_AMP = 'amp';
public const FEATURE_CSS_ACCENT_COLOR = 'css-accent-color';
public const FEATURE_CSS_ALIGN_ITEMS = 'css-align-items';
public const FEATURE_CSS_ANIMATION = 'css-animation';
public const FEATURE_CSS_ASPECT_RATIO = 'css-aspect-ratio';
public const FEATURE_CSS_AT_FONT_FACE = 'css-at-font-face';
public const FEATURE_CSS_AT_IMPORT = 'css-at-import';
public const FEATURE_CSS_AT_KEYFRAMES = 'css-at-keyframes';
public const FEATURE_CSS_AT_MEDIA = 'css-at-media';
public const FEATURE_CSS_AT_SUPPORTS = 'css-at-supports';
public const FEATURE_CSS_BACKGROUND_BLEND_MODE = 'css-background-blend-mode';
public const FEATURE_CSS_BACKGROUND_CLIP = 'css-background-clip';
public const FEATURE_CSS_BACKGROUND_COLOR = 'css-background-color';
public const FEATURE_CSS_BACKGROUND_IMAGE = 'css-background-image';
public const FEATURE_CSS_BACKGROUND_ORIGIN = 'css-background-origin';
public const FEATURE_CSS_BACKGROUND_POSITION = 'css-background-position';
public const FEATURE_CSS_BACKGROUND_REPEAT = 'css-background-repeat';
public const FEATURE_CSS_BACKGROUND_SIZE = 'css-background-size';
public const FEATURE_CSS_BACKGROUND = 'css-background';
public const FEATURE_CSS_BLOCK_INLINE_SIZE = 'css-block-inline-size';
public const FEATURE_CSS_BORDER_IMAGE = 'css-border-image';
public const FEATURE_CSS_BORDER_INLINE_BLOCK_INDIVIDUAL = 'css-border-inline-block-individual';
public const FEATURE_CSS_BORDER_INLINE_BLOCK_LONGHAND = 'css-border-inline-block-longhand';
public const FEATURE_CSS_BORDER_INLINE_BLOCK = 'css-border-inline-block';
public const FEATURE_CSS_BORDER_RADIUS_LOGICAL = 'css-border-radius-logical';
public const FEATURE_CSS_BORDER_RADIUS = 'css-border-radius';
public const FEATURE_CSS_BORDER = 'css-border';
public const FEATURE_CSS_BOX_SHADOW = 'css-box-shadow';
public const FEATURE_CSS_BOX_SIZING = 'css-box-sizing';
public const FEATURE_CSS_CAPTION_SIDE = 'css-caption-side';
public const FEATURE_CSS_CLIP_PATH = 'css-clip-path';
public const FEATURE_CSS_COLUMN_COUNT = 'css-column-count';
public const FEATURE_CSS_COLUMN_LAYOUT_PROPERTIES = 'css-column-layout-properties';
public const FEATURE_CSS_DIRECTION = 'css-direction';
public const FEATURE_CSS_DISPLAY_FLEX = 'css-display-flex';
public const FEATURE_CSS_DISPLAY_GRID = 'css-display-grid';
public const FEATURE_CSS_DISPLAY_NONE = 'css-display-none';
public const FEATURE_CSS_DISPLAY = 'css-display';
public const FEATURE_CSS_FILTER = 'css-filter';
public const FEATURE_CSS_FLEX_DIRECTION = 'css-flex-direction';
public const FEATURE_CSS_FLEX_WRAP = 'css-flex-wrap';
public const FEATURE_CSS_FLOAT = 'css-float';
public const FEATURE_CSS_FONT_KERNING = 'css-font-kerning';
public const FEATURE_CSS_FONT_WEIGHT = 'css-font-weight';
public const FEATURE_CSS_FONT = 'css-font';
public const FEATURE_CSS_GAP = 'css-gap';
public const FEATURE_CSS_GRID_TEMPLATE = 'css-grid-template';
public const FEATURE_CSS_HEIGHT = 'css-height';
public const FEATURE_CSS_HYPHENS = 'css-hyphens';
public const FEATURE_CSS_INLINE_SIZE = 'css-inline-size';
public const FEATURE_CSS_JUSTIFY_CONTENT = 'css-justify-content';
public const FEATURE_CSS_LEFT_RIGHT_TOP_BOTTOM = 'css-left-right-top-bottom';
public const FEATURE_CSS_LETTER_SPACING = 'css-letter-spacing';
public const FEATURE_CSS_LINE_HEIGHT = 'css-line-height';
public const FEATURE_CSS_LIST_STYLE_IMAGE = 'css-list-style-image';
public const FEATURE_CSS_LIST_STYLE_POSITION = 'css-list-style-position';
public const FEATURE_CSS_LIST_STYLE_TYPE = 'css-list-style-type';
public const FEATURE_CSS_LIST_STYLE = 'css-list-style';
public const FEATURE_CSS_MARGIN_BLOCK_START_END = 'css-margin-block-start-end';
public const FEATURE_CSS_MARGIN_INLINE_BLOCK = 'css-margin-inline-block';
public const FEATURE_CSS_MARGIN_INLINE_START_END = 'css-margin-inline-start-end';
public const FEATURE_CSS_MARGIN_INLINE = 'css-margin-inline';
public const FEATURE_CSS_MARGIN = 'css-margin';
public const FEATURE_CSS_MAX_BLOCK_SIZE = 'css-max-block-size';
public const FEATURE_CSS_MAX_HEIGHT = 'css-max-height';
public const FEATURE_CSS_MAX_WIDTH = 'css-max-width';
public const FEATURE_CSS_MIN_HEIGHT = 'css-min-height';
public const FEATURE_CSS_MIN_INLINE_SIZE = 'css-min-inline-size';
public const FEATURE_CSS_MIN_WIDTH = 'css-min-width';
public const FEATURE_CSS_MIX_BLEND_MODE = 'css-mix-blend-mode';
public const FEATURE_CSS_OBJECT_FIT = 'css-object-fit';
public const FEATURE_CSS_OBJECT_POSITION = 'css-object-position';
public const FEATURE_CSS_OPACITY = 'css-opacity';
public const FEATURE_CSS_OUTLINE_OFFSET = 'css-outline-offset';
public const FEATURE_CSS_OUTLINE = 'css-outline';
public const FEATURE_CSS_OVERFLOW_WRAP = 'css-overflow-wrap';
public const FEATURE_CSS_OVERFLOW = 'css-overflow';
public const FEATURE_CSS_PADDING_BLOCK_START_END = 'css-padding-block-start-end';
public const FEATURE_CSS_PADDING_INLINE_BLOCK = 'css-padding-inline-block';
public const FEATURE_CSS_PADDING_INLINE_START_END = 'css-padding-inline-start-end';
public const FEATURE_CSS_PADDING = 'css-padding';
public const FEATURE_CSS_POSITION = 'css-position';
public const FEATURE_CSS_TAB_SIZE = 'css-tab-size';
public const FEATURE_CSS_TABLE_LAYOUT = 'css-table-layout';
public const FEATURE_CSS_TEXT_ALIGN_LAST = 'css-text-align-last';
public const FEATURE_CSS_TEXT_ALIGN = 'css-text-align';
public const FEATURE_CSS_TEXT_DECORATION_COLOR = 'css-text-decoration-color';
public const FEATURE_CSS_TEXT_DECORATION_THICKNESS = 'css-text-decoration-thickness';
public const FEATURE_CSS_TEXT_DECORATION = 'css-text-decoration';
public const FEATURE_CSS_TEXT_EMPHASIS_POSITION = 'css-text-emphasis-position';
public const FEATURE_CSS_TEXT_EMPHASIS = 'css-text-emphasis';
public const FEATURE_CSS_TEXT_INDENT = 'css-text-indent';
public const FEATURE_CSS_TEXT_OVERFLOW = 'css-text-overflow';
public const FEATURE_CSS_TEXT_SHADOW = 'css-text-shadow';
public const FEATURE_CSS_TEXT_TRANSFORM = 'css-text-transform';
public const FEATURE_CSS_TEXT_UNDERLINE_OFFSET = 'css-text-underline-offset';
public const FEATURE_CSS_TRANSFORM = 'css-transform';
public const FEATURE_CSS_VERTICAL_ALIGN = 'css-vertical-align';
public const FEATURE_CSS_VISIBILITY = 'css-visibility';
public const FEATURE_CSS_WHITE_SPACE = 'css-white-space';
public const FEATURE_CSS_WIDTH = 'css-width';
public const FEATURE_CSS_WORD_BREAK = 'css-word-break';
public const FEATURE_CSS_WRITING_MODE = 'css-writing-mode';
public const FEATURE_CSS_Z_INDEX = 'css-z-index';
public const FEATURE_HTML_ABBR = 'html-abbr';
public const FEATURE_HTML_ADDRESS = 'html-address';
public const FEATURE_HTML_ALIGN = 'html-align';
public const FEATURE_HTML_ANCHOR_LINKS = 'html-anchor-links';
public const FEATURE_HTML_ARIA_DESCRIBEDBY = 'html-aria-describedby';
public const FEATURE_HTML_ARIA_HIDDEN = 'html-aria-hidden';
public const FEATURE_HTML_ARIA_LABEL = 'html-aria-label';
public const FEATURE_HTML_ARIA_LABELLEDBY = 'html-aria-labelledby';
public const FEATURE_HTML_ARIA_LIVE = 'html-aria-live';
public const FEATURE_HTML_AUDIO = 'html-audio';
public const FEATURE_HTML_BACKGROUND = 'html-background';
public const FEATURE_HTML_BASE = 'html-base';
public const FEATURE_HTML_BLOCKQUOTE = 'html-blockquote';
public const FEATURE_HTML_BODY = 'html-body';
public const FEATURE_HTML_BUTTON_RESET = 'html-button-reset';
public const FEATURE_HTML_BUTTON_SUBMIT = 'html-button-submit';
public const FEATURE_HTML_CODE = 'html-code';
public const FEATURE_HTML_DEL = 'html-del';
public const FEATURE_HTML_DFN = 'html-dfn';
public const FEATURE_HTML_DIALOG = 'html-dialog';
public const FEATURE_HTML_DIR = 'html-dir';
public const FEATURE_HTML_DIV = 'html-div';
public const FEATURE_HTML_DOCTYPE = 'html-doctype';
public const FEATURE_HTML_FORM = 'html-form';
public const FEATURE_HTML_H1_H6 = 'html-h1-h6';
public const FEATURE_HTML_HEIGHT = 'html-height';
public const FEATURE_HTML_IMAGE_MAPS = 'html-image-maps';
public const FEATURE_HTML_INPUT_CHECKBOX = 'html-input-checkbox';
public const FEATURE_HTML_INPUT_HIDDEN = 'html-input-hidden';
public const FEATURE_HTML_INPUT_RADIO = 'html-input-radio';
public const FEATURE_HTML_INPUT_RESET = 'html-input-reset';
public const FEATURE_HTML_INPUT_SUBMIT = 'html-input-submit';
public const FEATURE_HTML_INPUT_TEXT = 'html-input-text';
public const FEATURE_HTML_LANG = 'html-lang';
public const FEATURE_HTML_LINK = 'html-link';
public const FEATURE_HTML_LISTS = 'html-lists';
public const FEATURE_HTML_LOADING_ATTRIBUTE = 'html-loading-attribute';
public const FEATURE_HTML_MAILTO_LINKS = 'html-mailto-links';
public const FEATURE_HTML_MARQUEE = 'html-marquee';
public const FEATURE_HTML_METER = 'html-meter';
public const FEATURE_HTML_OBJECT = 'html-object';
public const FEATURE_HTML_P = 'html-p';
public const FEATURE_HTML_PICTURE = 'html-picture';
public const FEATURE_HTML_PRE = 'html-pre';
public const FEATURE_HTML_PROGRESS = 'html-progress';
public const FEATURE_HTML_REQUIRED = 'html-required';
public const FEATURE_HTML_ROLE = 'html-role';
public const FEATURE_HTML_RP = 'html-rp';
public const FEATURE_HTML_RT = 'html-rt';
public const FEATURE_HTML_RUBY = 'html-ruby';
public const FEATURE_HTML_SELECT = 'html-select';
public const FEATURE_HTML_SEMANTICS = 'html-semantics';
public const FEATURE_HTML_SMALL = 'html-small';
public const FEATURE_HTML_SPAN = 'html-span';
public const FEATURE_HTML_SRCSET = 'html-srcset';
public const FEATURE_HTML_STRIKE = 'html-strike';
public const FEATURE_HTML_STRONG = 'html-strong';
public const FEATURE_HTML_STYLE = 'html-style';
public const FEATURE_HTML_SVG = 'html-svg';
public const FEATURE_HTML_TABLE = 'html-table';
public const FEATURE_HTML_TARGET = 'html-target';
public const FEATURE_HTML_TEXTAREA = 'html-textarea';
public const FEATURE_HTML_VALIGN = 'html-valign';
public const FEATURE_HTML_VIDEO = 'html-video';
public const FEATURE_HTML_WBR = 'html-wbr';
public const FEATURE_HTML_WIDTH = 'html-width';
public const FEATURE_IMAGE_AVIF = 'image-avif';
public const FEATURE_IMAGE_BASE64 = 'image-base64';
public const FEATURE_IMAGE_BMP = 'image-bmp';
public const FEATURE_IMAGE_GIF = 'image-gif';
public const FEATURE_IMAGE_ICO = 'image-ico';
public const FEATURE_IMAGE_JPG = 'image-jpg';
public const FEATURE_IMAGE_PNG = 'image-png';
public const FEATURE_IMAGE_SVG = 'image-svg';
public const FEATURE_IMAGE_WEBP = 'image-webp';
public const FEATURE_UNSUPPORTED = 'unsupported';
public const CATEGORY_CSS = 'css';
public const CATEGORY_HTML = 'html';
public const CATEGORY_IMAGE = 'image';
public const CATEGORY_OTHERS = 'others';
public const STATUSES_SUPPORTED = 'SUPPORTED';
public const STATUSES_PARTIAL = 'PARTIAL';
public const STATUSES_NOT_SUPPORTED = 'NOT_SUPPORTED';
public const STATUSES_UNKNOWN = 'UNKNOWN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFeatureAllowableValues()
{
return [
self::FEATURE_AMP,
self::FEATURE_CSS_ACCENT_COLOR,
self::FEATURE_CSS_ALIGN_ITEMS,
self::FEATURE_CSS_ANIMATION,
self::FEATURE_CSS_ASPECT_RATIO,
self::FEATURE_CSS_AT_FONT_FACE,
self::FEATURE_CSS_AT_IMPORT,
self::FEATURE_CSS_AT_KEYFRAMES,
self::FEATURE_CSS_AT_MEDIA,
self::FEATURE_CSS_AT_SUPPORTS,
self::FEATURE_CSS_BACKGROUND_BLEND_MODE,
self::FEATURE_CSS_BACKGROUND_CLIP,
self::FEATURE_CSS_BACKGROUND_COLOR,
self::FEATURE_CSS_BACKGROUND_IMAGE,
self::FEATURE_CSS_BACKGROUND_ORIGIN,
self::FEATURE_CSS_BACKGROUND_POSITION,
self::FEATURE_CSS_BACKGROUND_REPEAT,
self::FEATURE_CSS_BACKGROUND_SIZE,
self::FEATURE_CSS_BACKGROUND,
self::FEATURE_CSS_BLOCK_INLINE_SIZE,
self::FEATURE_CSS_BORDER_IMAGE,
self::FEATURE_CSS_BORDER_INLINE_BLOCK_INDIVIDUAL,
self::FEATURE_CSS_BORDER_INLINE_BLOCK_LONGHAND,
self::FEATURE_CSS_BORDER_INLINE_BLOCK,
self::FEATURE_CSS_BORDER_RADIUS_LOGICAL,
self::FEATURE_CSS_BORDER_RADIUS,
self::FEATURE_CSS_BORDER,
self::FEATURE_CSS_BOX_SHADOW,
self::FEATURE_CSS_BOX_SIZING,
self::FEATURE_CSS_CAPTION_SIDE,
self::FEATURE_CSS_CLIP_PATH,
self::FEATURE_CSS_COLUMN_COUNT,
self::FEATURE_CSS_COLUMN_LAYOUT_PROPERTIES,
self::FEATURE_CSS_DIRECTION,
self::FEATURE_CSS_DISPLAY_FLEX,
self::FEATURE_CSS_DISPLAY_GRID,
self::FEATURE_CSS_DISPLAY_NONE,
self::FEATURE_CSS_DISPLAY,
self::FEATURE_CSS_FILTER,
self::FEATURE_CSS_FLEX_DIRECTION,
self::FEATURE_CSS_FLEX_WRAP,
self::FEATURE_CSS_FLOAT,
self::FEATURE_CSS_FONT_KERNING,
self::FEATURE_CSS_FONT_WEIGHT,
self::FEATURE_CSS_FONT,
self::FEATURE_CSS_GAP,
self::FEATURE_CSS_GRID_TEMPLATE,
self::FEATURE_CSS_HEIGHT,
self::FEATURE_CSS_HYPHENS,
self::FEATURE_CSS_INLINE_SIZE,
self::FEATURE_CSS_JUSTIFY_CONTENT,
self::FEATURE_CSS_LEFT_RIGHT_TOP_BOTTOM,
self::FEATURE_CSS_LETTER_SPACING,
self::FEATURE_CSS_LINE_HEIGHT,
self::FEATURE_CSS_LIST_STYLE_IMAGE,
self::FEATURE_CSS_LIST_STYLE_POSITION,
self::FEATURE_CSS_LIST_STYLE_TYPE,
self::FEATURE_CSS_LIST_STYLE,
self::FEATURE_CSS_MARGIN_BLOCK_START_END,
self::FEATURE_CSS_MARGIN_INLINE_BLOCK,
self::FEATURE_CSS_MARGIN_INLINE_START_END,
self::FEATURE_CSS_MARGIN_INLINE,
self::FEATURE_CSS_MARGIN,
self::FEATURE_CSS_MAX_BLOCK_SIZE,
self::FEATURE_CSS_MAX_HEIGHT,
self::FEATURE_CSS_MAX_WIDTH,
self::FEATURE_CSS_MIN_HEIGHT,
self::FEATURE_CSS_MIN_INLINE_SIZE,
self::FEATURE_CSS_MIN_WIDTH,
self::FEATURE_CSS_MIX_BLEND_MODE,
self::FEATURE_CSS_OBJECT_FIT,
self::FEATURE_CSS_OBJECT_POSITION,
self::FEATURE_CSS_OPACITY,
self::FEATURE_CSS_OUTLINE_OFFSET,
self::FEATURE_CSS_OUTLINE,
self::FEATURE_CSS_OVERFLOW_WRAP,
self::FEATURE_CSS_OVERFLOW,
self::FEATURE_CSS_PADDING_BLOCK_START_END,
self::FEATURE_CSS_PADDING_INLINE_BLOCK,
self::FEATURE_CSS_PADDING_INLINE_START_END,
self::FEATURE_CSS_PADDING,
self::FEATURE_CSS_POSITION,
self::FEATURE_CSS_TAB_SIZE,
self::FEATURE_CSS_TABLE_LAYOUT,
self::FEATURE_CSS_TEXT_ALIGN_LAST,
self::FEATURE_CSS_TEXT_ALIGN,
self::FEATURE_CSS_TEXT_DECORATION_COLOR,
self::FEATURE_CSS_TEXT_DECORATION_THICKNESS,
self::FEATURE_CSS_TEXT_DECORATION,
self::FEATURE_CSS_TEXT_EMPHASIS_POSITION,
self::FEATURE_CSS_TEXT_EMPHASIS,
self::FEATURE_CSS_TEXT_INDENT,
self::FEATURE_CSS_TEXT_OVERFLOW,
self::FEATURE_CSS_TEXT_SHADOW,
self::FEATURE_CSS_TEXT_TRANSFORM,
self::FEATURE_CSS_TEXT_UNDERLINE_OFFSET,
self::FEATURE_CSS_TRANSFORM,
self::FEATURE_CSS_VERTICAL_ALIGN,
self::FEATURE_CSS_VISIBILITY,
self::FEATURE_CSS_WHITE_SPACE,
self::FEATURE_CSS_WIDTH,
self::FEATURE_CSS_WORD_BREAK,
self::FEATURE_CSS_WRITING_MODE,
self::FEATURE_CSS_Z_INDEX,
self::FEATURE_HTML_ABBR,
self::FEATURE_HTML_ADDRESS,
self::FEATURE_HTML_ALIGN,
self::FEATURE_HTML_ANCHOR_LINKS,
self::FEATURE_HTML_ARIA_DESCRIBEDBY,
self::FEATURE_HTML_ARIA_HIDDEN,
self::FEATURE_HTML_ARIA_LABEL,
self::FEATURE_HTML_ARIA_LABELLEDBY,
self::FEATURE_HTML_ARIA_LIVE,
self::FEATURE_HTML_AUDIO,
self::FEATURE_HTML_BACKGROUND,
self::FEATURE_HTML_BASE,
self::FEATURE_HTML_BLOCKQUOTE,
self::FEATURE_HTML_BODY,
self::FEATURE_HTML_BUTTON_RESET,
self::FEATURE_HTML_BUTTON_SUBMIT,
self::FEATURE_HTML_CODE,
self::FEATURE_HTML_DEL,
self::FEATURE_HTML_DFN,
self::FEATURE_HTML_DIALOG,
self::FEATURE_HTML_DIR,
self::FEATURE_HTML_DIV,
self::FEATURE_HTML_DOCTYPE,
self::FEATURE_HTML_FORM,
self::FEATURE_HTML_H1_H6,
self::FEATURE_HTML_HEIGHT,
self::FEATURE_HTML_IMAGE_MAPS,
self::FEATURE_HTML_INPUT_CHECKBOX,
self::FEATURE_HTML_INPUT_HIDDEN,
self::FEATURE_HTML_INPUT_RADIO,
self::FEATURE_HTML_INPUT_RESET,
self::FEATURE_HTML_INPUT_SUBMIT,
self::FEATURE_HTML_INPUT_TEXT,
self::FEATURE_HTML_LANG,
self::FEATURE_HTML_LINK,
self::FEATURE_HTML_LISTS,
self::FEATURE_HTML_LOADING_ATTRIBUTE,
self::FEATURE_HTML_MAILTO_LINKS,
self::FEATURE_HTML_MARQUEE,
self::FEATURE_HTML_METER,
self::FEATURE_HTML_OBJECT,
self::FEATURE_HTML_P,
self::FEATURE_HTML_PICTURE,
self::FEATURE_HTML_PRE,
self::FEATURE_HTML_PROGRESS,
self::FEATURE_HTML_REQUIRED,
self::FEATURE_HTML_ROLE,
self::FEATURE_HTML_RP,
self::FEATURE_HTML_RT,
self::FEATURE_HTML_RUBY,
self::FEATURE_HTML_SELECT,
self::FEATURE_HTML_SEMANTICS,
self::FEATURE_HTML_SMALL,
self::FEATURE_HTML_SPAN,
self::FEATURE_HTML_SRCSET,
self::FEATURE_HTML_STRIKE,
self::FEATURE_HTML_STRONG,
self::FEATURE_HTML_STYLE,
self::FEATURE_HTML_SVG,
self::FEATURE_HTML_TABLE,
self::FEATURE_HTML_TARGET,
self::FEATURE_HTML_TEXTAREA,
self::FEATURE_HTML_VALIGN,
self::FEATURE_HTML_VIDEO,
self::FEATURE_HTML_WBR,
self::FEATURE_HTML_WIDTH,
self::FEATURE_IMAGE_AVIF,
self::FEATURE_IMAGE_BASE64,
self::FEATURE_IMAGE_BMP,
self::FEATURE_IMAGE_GIF,
self::FEATURE_IMAGE_ICO,
self::FEATURE_IMAGE_JPG,
self::FEATURE_IMAGE_PNG,
self::FEATURE_IMAGE_SVG,
self::FEATURE_IMAGE_WEBP,
self::FEATURE_UNSUPPORTED,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getCategoryAllowableValues()
{
return [
self::CATEGORY_CSS,
self::CATEGORY_HTML,
self::CATEGORY_IMAGE,
self::CATEGORY_OTHERS,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusesAllowableValues()
{
return [
self::STATUSES_SUPPORTED,
self::STATUSES_PARTIAL,
self::STATUSES_NOT_SUPPORTED,
self::STATUSES_UNKNOWN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('feature', $data ?? [], null);
$this->setIfExists('title', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('category', $data ?? [], null);
$this->setIfExists('notes', $data ?? [], null);
$this->setIfExists('notes_numbers', $data ?? [], null);
$this->setIfExists('feature_statistics', $data ?? [], null);
$this->setIfExists('statuses', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['feature'] === null) {
$invalidProperties[] = "'feature' can't be null";
}
$allowedValues = $this->getFeatureAllowableValues();
if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'feature', must be one of '%s'",
$this->container['feature'],
implode("', '", $allowedValues)
);
}
$allowedValues = $this->getCategoryAllowableValues();
if (!is_null($this->container['category']) && !in_array($this->container['category'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'category', must be one of '%s'",
$this->container['category'],
implode("', '", $allowedValues)
);
}
if ($this->container['statuses'] === null) {
$invalidProperties[] = "'statuses' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets feature
*
* @return string
*/
public function getFeature()
{
return $this->container['feature'];
}
/**
* Sets feature
*
* @param string $feature feature
*
* @return self
*/
public function setFeature($feature)
{
$allowedValues = $this->getFeatureAllowableValues();
if (!in_array($feature, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'feature', must be one of '%s'",
$feature,
implode("', '", $allowedValues)
)
);
}
if (is_null($feature)) {
throw new \InvalidArgumentException('non-nullable feature cannot be null');
}
$this->container['feature'] = $feature;
return $this;
}
/**
* Gets title
*
* @return string|null
*/
public function getTitle()
{
return $this->container['title'];
}
/**
* Sets title
*
* @param string|null $title title
*
* @return self
*/
public function setTitle($title)
{
if (is_null($title)) {
throw new \InvalidArgumentException('non-nullable title cannot be null');
}
$this->container['title'] = $title;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description description
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
throw new \InvalidArgumentException('non-nullable description cannot be null');
}
$this->container['description'] = $description;
return $this;
}
/**
* Gets category
*
* @return string|null
*/
public function getCategory()
{
return $this->container['category'];
}
/**
* Sets category
*
* @param string|null $category category
*
* @return self
*/
public function setCategory($category)
{
$allowedValues = $this->getCategoryAllowableValues();
if (!is_null($category) && !in_array($category, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'category', must be one of '%s'",
$category,
implode("', '", $allowedValues)
)
);
}
if (is_null($category)) {
throw new \InvalidArgumentException('non-nullable category cannot be null');
}
$this->container['category'] = $category;
return $this;
}
/**
* Gets notes
*
* @return string|null
*/
public function getNotes()
{
return $this->container['notes'];
}
/**
* Sets notes
*
* @param string|null $notes notes
*
* @return self
*/
public function setNotes($notes)
{
if (is_null($notes)) {
throw new \InvalidArgumentException('non-nullable notes cannot be null');
}
$this->container['notes'] = $notes;
return $this;
}
/**
* Gets notes_numbers
*
* @return array<string,string>|null
*/
public function getNotesNumbers()
{
return $this->container['notes_numbers'];
}
/**
* Sets notes_numbers
*
* @param array<string,string>|null $notes_numbers notes_numbers
*
* @return self
*/
public function setNotesNumbers($notes_numbers)
{
if (is_null($notes_numbers)) {
throw new \InvalidArgumentException('non-nullable notes_numbers cannot be null');
}
$this->container['notes_numbers'] = $notes_numbers;
return $this;
}
/**
* Gets feature_statistics
*
* @return \MailSlurp\Models\EmailFeatureFamilyStatistics[]|null
*/
public function getFeatureStatistics()
{
return $this->container['feature_statistics'];
}
/**
* Sets feature_statistics
*
* @param \MailSlurp\Models\EmailFeatureFamilyStatistics[]|null $feature_statistics feature_statistics
*
* @return self
*/
public function setFeatureStatistics($feature_statistics)
{
if (is_null($feature_statistics)) {
throw new \InvalidArgumentException('non-nullable feature_statistics cannot be null');
}
$this->container['feature_statistics'] = $feature_statistics;
return $this;
}
/**
* Gets statuses
*
* @return string[]
*/
public function getStatuses()
{
return $this->container['statuses'];
}
/**
* Sets statuses
*
* @param string[] $statuses statuses
*
* @return self
*/
public function setStatuses($statuses)
{
$allowedValues = $this->getStatusesAllowableValues();
if (array_diff($statuses, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'statuses', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
if (is_null($statuses)) {
throw new \InvalidArgumentException('non-nullable statuses cannot be null');
}
$this->container['statuses'] = $statuses;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureNames
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureNames Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureNames implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureNames';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'family' => '\MailSlurp\Models\EmailFeatureFamilyName[]',
'platform' => '\MailSlurp\Models\EmailFeaturePlatformName[]',
'category' => '\MailSlurp\Models\EmailFeatureCategoryName[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'family' => null,
'platform' => null,
'category' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'family' => false,
'platform' => false,
'category' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'family' => 'family',
'platform' => 'platform',
'category' => 'category'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'family' => 'setFamily',
'platform' => 'setPlatform',
'category' => 'setCategory'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'family' => 'getFamily',
'platform' => 'getPlatform',
'category' => 'getCategory'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('family', $data ?? [], null);
$this->setIfExists('platform', $data ?? [], null);
$this->setIfExists('category', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['family'] === null) {
$invalidProperties[] = "'family' can't be null";
}
if ($this->container['platform'] === null) {
$invalidProperties[] = "'platform' can't be null";
}
if ($this->container['category'] === null) {
$invalidProperties[] = "'category' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets family
*
* @return \MailSlurp\Models\EmailFeatureFamilyName[]
*/
public function getFamily()
{
return $this->container['family'];
}
/**
* Sets family
*
* @param \MailSlurp\Models\EmailFeatureFamilyName[] $family family
*
* @return self
*/
public function setFamily($family)
{
if (is_null($family)) {
throw new \InvalidArgumentException('non-nullable family cannot be null');
}
$this->container['family'] = $family;
return $this;
}
/**
* Gets platform
*
* @return \MailSlurp\Models\EmailFeaturePlatformName[]
*/
public function getPlatform()
{
return $this->container['platform'];
}
/**
* Sets platform
*
* @param \MailSlurp\Models\EmailFeaturePlatformName[] $platform platform
*
* @return self
*/
public function setPlatform($platform)
{
if (is_null($platform)) {
throw new \InvalidArgumentException('non-nullable platform cannot be null');
}
$this->container['platform'] = $platform;
return $this;
}
/**
* Gets category
*
* @return \MailSlurp\Models\EmailFeatureCategoryName[]
*/
public function getCategory()
{
return $this->container['category'];
}
/**
* Sets category
*
* @param \MailSlurp\Models\EmailFeatureCategoryName[] $category category
*
* @return self
*/
public function setCategory($category)
{
if (is_null($category)) {
throw new \InvalidArgumentException('non-nullable category cannot be null');
}
$this->container['category'] = $category;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureFamilyStatistics
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureFamilyStatistics Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureFamilyStatistics implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureFamilyStatistics';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'feature' => 'string',
'family' => 'string',
'platforms' => '\MailSlurp\Models\EmailFeaturePlatformStatistics[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'feature' => null,
'family' => null,
'platforms' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'feature' => false,
'family' => false,
'platforms' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'feature' => 'feature',
'family' => 'family',
'platforms' => 'platforms'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'feature' => 'setFeature',
'family' => 'setFamily',
'platforms' => 'setPlatforms'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'feature' => 'getFeature',
'family' => 'getFamily',
'platforms' => 'getPlatforms'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FEATURE_AMP = 'amp';
public const FEATURE_CSS_ACCENT_COLOR = 'css-accent-color';
public const FEATURE_CSS_ALIGN_ITEMS = 'css-align-items';
public const FEATURE_CSS_ANIMATION = 'css-animation';
public const FEATURE_CSS_ASPECT_RATIO = 'css-aspect-ratio';
public const FEATURE_CSS_AT_FONT_FACE = 'css-at-font-face';
public const FEATURE_CSS_AT_IMPORT = 'css-at-import';
public const FEATURE_CSS_AT_KEYFRAMES = 'css-at-keyframes';
public const FEATURE_CSS_AT_MEDIA = 'css-at-media';
public const FEATURE_CSS_AT_SUPPORTS = 'css-at-supports';
public const FEATURE_CSS_BACKGROUND_BLEND_MODE = 'css-background-blend-mode';
public const FEATURE_CSS_BACKGROUND_CLIP = 'css-background-clip';
public const FEATURE_CSS_BACKGROUND_COLOR = 'css-background-color';
public const FEATURE_CSS_BACKGROUND_IMAGE = 'css-background-image';
public const FEATURE_CSS_BACKGROUND_ORIGIN = 'css-background-origin';
public const FEATURE_CSS_BACKGROUND_POSITION = 'css-background-position';
public const FEATURE_CSS_BACKGROUND_REPEAT = 'css-background-repeat';
public const FEATURE_CSS_BACKGROUND_SIZE = 'css-background-size';
public const FEATURE_CSS_BACKGROUND = 'css-background';
public const FEATURE_CSS_BLOCK_INLINE_SIZE = 'css-block-inline-size';
public const FEATURE_CSS_BORDER_IMAGE = 'css-border-image';
public const FEATURE_CSS_BORDER_INLINE_BLOCK_INDIVIDUAL = 'css-border-inline-block-individual';
public const FEATURE_CSS_BORDER_INLINE_BLOCK_LONGHAND = 'css-border-inline-block-longhand';
public const FEATURE_CSS_BORDER_INLINE_BLOCK = 'css-border-inline-block';
public const FEATURE_CSS_BORDER_RADIUS_LOGICAL = 'css-border-radius-logical';
public const FEATURE_CSS_BORDER_RADIUS = 'css-border-radius';
public const FEATURE_CSS_BORDER = 'css-border';
public const FEATURE_CSS_BOX_SHADOW = 'css-box-shadow';
public const FEATURE_CSS_BOX_SIZING = 'css-box-sizing';
public const FEATURE_CSS_CAPTION_SIDE = 'css-caption-side';
public const FEATURE_CSS_CLIP_PATH = 'css-clip-path';
public const FEATURE_CSS_COLUMN_COUNT = 'css-column-count';
public const FEATURE_CSS_COLUMN_LAYOUT_PROPERTIES = 'css-column-layout-properties';
public const FEATURE_CSS_DIRECTION = 'css-direction';
public const FEATURE_CSS_DISPLAY_FLEX = 'css-display-flex';
public const FEATURE_CSS_DISPLAY_GRID = 'css-display-grid';
public const FEATURE_CSS_DISPLAY_NONE = 'css-display-none';
public const FEATURE_CSS_DISPLAY = 'css-display';
public const FEATURE_CSS_FILTER = 'css-filter';
public const FEATURE_CSS_FLEX_DIRECTION = 'css-flex-direction';
public const FEATURE_CSS_FLEX_WRAP = 'css-flex-wrap';
public const FEATURE_CSS_FLOAT = 'css-float';
public const FEATURE_CSS_FONT_KERNING = 'css-font-kerning';
public const FEATURE_CSS_FONT_WEIGHT = 'css-font-weight';
public const FEATURE_CSS_FONT = 'css-font';
public const FEATURE_CSS_GAP = 'css-gap';
public const FEATURE_CSS_GRID_TEMPLATE = 'css-grid-template';
public const FEATURE_CSS_HEIGHT = 'css-height';
public const FEATURE_CSS_HYPHENS = 'css-hyphens';
public const FEATURE_CSS_INLINE_SIZE = 'css-inline-size';
public const FEATURE_CSS_JUSTIFY_CONTENT = 'css-justify-content';
public const FEATURE_CSS_LEFT_RIGHT_TOP_BOTTOM = 'css-left-right-top-bottom';
public const FEATURE_CSS_LETTER_SPACING = 'css-letter-spacing';
public const FEATURE_CSS_LINE_HEIGHT = 'css-line-height';
public const FEATURE_CSS_LIST_STYLE_IMAGE = 'css-list-style-image';
public const FEATURE_CSS_LIST_STYLE_POSITION = 'css-list-style-position';
public const FEATURE_CSS_LIST_STYLE_TYPE = 'css-list-style-type';
public const FEATURE_CSS_LIST_STYLE = 'css-list-style';
public const FEATURE_CSS_MARGIN_BLOCK_START_END = 'css-margin-block-start-end';
public const FEATURE_CSS_MARGIN_INLINE_BLOCK = 'css-margin-inline-block';
public const FEATURE_CSS_MARGIN_INLINE_START_END = 'css-margin-inline-start-end';
public const FEATURE_CSS_MARGIN_INLINE = 'css-margin-inline';
public const FEATURE_CSS_MARGIN = 'css-margin';
public const FEATURE_CSS_MAX_BLOCK_SIZE = 'css-max-block-size';
public const FEATURE_CSS_MAX_HEIGHT = 'css-max-height';
public const FEATURE_CSS_MAX_WIDTH = 'css-max-width';
public const FEATURE_CSS_MIN_HEIGHT = 'css-min-height';
public const FEATURE_CSS_MIN_INLINE_SIZE = 'css-min-inline-size';
public const FEATURE_CSS_MIN_WIDTH = 'css-min-width';
public const FEATURE_CSS_MIX_BLEND_MODE = 'css-mix-blend-mode';
public const FEATURE_CSS_OBJECT_FIT = 'css-object-fit';
public const FEATURE_CSS_OBJECT_POSITION = 'css-object-position';
public const FEATURE_CSS_OPACITY = 'css-opacity';
public const FEATURE_CSS_OUTLINE_OFFSET = 'css-outline-offset';
public const FEATURE_CSS_OUTLINE = 'css-outline';
public const FEATURE_CSS_OVERFLOW_WRAP = 'css-overflow-wrap';
public const FEATURE_CSS_OVERFLOW = 'css-overflow';
public const FEATURE_CSS_PADDING_BLOCK_START_END = 'css-padding-block-start-end';
public const FEATURE_CSS_PADDING_INLINE_BLOCK = 'css-padding-inline-block';
public const FEATURE_CSS_PADDING_INLINE_START_END = 'css-padding-inline-start-end';
public const FEATURE_CSS_PADDING = 'css-padding';
public const FEATURE_CSS_POSITION = 'css-position';
public const FEATURE_CSS_TAB_SIZE = 'css-tab-size';
public const FEATURE_CSS_TABLE_LAYOUT = 'css-table-layout';
public const FEATURE_CSS_TEXT_ALIGN_LAST = 'css-text-align-last';
public const FEATURE_CSS_TEXT_ALIGN = 'css-text-align';
public const FEATURE_CSS_TEXT_DECORATION_COLOR = 'css-text-decoration-color';
public const FEATURE_CSS_TEXT_DECORATION_THICKNESS = 'css-text-decoration-thickness';
public const FEATURE_CSS_TEXT_DECORATION = 'css-text-decoration';
public const FEATURE_CSS_TEXT_EMPHASIS_POSITION = 'css-text-emphasis-position';
public const FEATURE_CSS_TEXT_EMPHASIS = 'css-text-emphasis';
public const FEATURE_CSS_TEXT_INDENT = 'css-text-indent';
public const FEATURE_CSS_TEXT_OVERFLOW = 'css-text-overflow';
public const FEATURE_CSS_TEXT_SHADOW = 'css-text-shadow';
public const FEATURE_CSS_TEXT_TRANSFORM = 'css-text-transform';
public const FEATURE_CSS_TEXT_UNDERLINE_OFFSET = 'css-text-underline-offset';
public const FEATURE_CSS_TRANSFORM = 'css-transform';
public const FEATURE_CSS_VERTICAL_ALIGN = 'css-vertical-align';
public const FEATURE_CSS_VISIBILITY = 'css-visibility';
public const FEATURE_CSS_WHITE_SPACE = 'css-white-space';
public const FEATURE_CSS_WIDTH = 'css-width';
public const FEATURE_CSS_WORD_BREAK = 'css-word-break';
public const FEATURE_CSS_WRITING_MODE = 'css-writing-mode';
public const FEATURE_CSS_Z_INDEX = 'css-z-index';
public const FEATURE_HTML_ABBR = 'html-abbr';
public const FEATURE_HTML_ADDRESS = 'html-address';
public const FEATURE_HTML_ALIGN = 'html-align';
public const FEATURE_HTML_ANCHOR_LINKS = 'html-anchor-links';
public const FEATURE_HTML_ARIA_DESCRIBEDBY = 'html-aria-describedby';
public const FEATURE_HTML_ARIA_HIDDEN = 'html-aria-hidden';
public const FEATURE_HTML_ARIA_LABEL = 'html-aria-label';
public const FEATURE_HTML_ARIA_LABELLEDBY = 'html-aria-labelledby';
public const FEATURE_HTML_ARIA_LIVE = 'html-aria-live';
public const FEATURE_HTML_AUDIO = 'html-audio';
public const FEATURE_HTML_BACKGROUND = 'html-background';
public const FEATURE_HTML_BASE = 'html-base';
public const FEATURE_HTML_BLOCKQUOTE = 'html-blockquote';
public const FEATURE_HTML_BODY = 'html-body';
public const FEATURE_HTML_BUTTON_RESET = 'html-button-reset';
public const FEATURE_HTML_BUTTON_SUBMIT = 'html-button-submit';
public const FEATURE_HTML_CODE = 'html-code';
public const FEATURE_HTML_DEL = 'html-del';
public const FEATURE_HTML_DFN = 'html-dfn';
public const FEATURE_HTML_DIALOG = 'html-dialog';
public const FEATURE_HTML_DIR = 'html-dir';
public const FEATURE_HTML_DIV = 'html-div';
public const FEATURE_HTML_DOCTYPE = 'html-doctype';
public const FEATURE_HTML_FORM = 'html-form';
public const FEATURE_HTML_H1_H6 = 'html-h1-h6';
public const FEATURE_HTML_HEIGHT = 'html-height';
public const FEATURE_HTML_IMAGE_MAPS = 'html-image-maps';
public const FEATURE_HTML_INPUT_CHECKBOX = 'html-input-checkbox';
public const FEATURE_HTML_INPUT_HIDDEN = 'html-input-hidden';
public const FEATURE_HTML_INPUT_RADIO = 'html-input-radio';
public const FEATURE_HTML_INPUT_RESET = 'html-input-reset';
public const FEATURE_HTML_INPUT_SUBMIT = 'html-input-submit';
public const FEATURE_HTML_INPUT_TEXT = 'html-input-text';
public const FEATURE_HTML_LANG = 'html-lang';
public const FEATURE_HTML_LINK = 'html-link';
public const FEATURE_HTML_LISTS = 'html-lists';
public const FEATURE_HTML_LOADING_ATTRIBUTE = 'html-loading-attribute';
public const FEATURE_HTML_MAILTO_LINKS = 'html-mailto-links';
public const FEATURE_HTML_MARQUEE = 'html-marquee';
public const FEATURE_HTML_METER = 'html-meter';
public const FEATURE_HTML_OBJECT = 'html-object';
public const FEATURE_HTML_P = 'html-p';
public const FEATURE_HTML_PICTURE = 'html-picture';
public const FEATURE_HTML_PRE = 'html-pre';
public const FEATURE_HTML_PROGRESS = 'html-progress';
public const FEATURE_HTML_REQUIRED = 'html-required';
public const FEATURE_HTML_ROLE = 'html-role';
public const FEATURE_HTML_RP = 'html-rp';
public const FEATURE_HTML_RT = 'html-rt';
public const FEATURE_HTML_RUBY = 'html-ruby';
public const FEATURE_HTML_SELECT = 'html-select';
public const FEATURE_HTML_SEMANTICS = 'html-semantics';
public const FEATURE_HTML_SMALL = 'html-small';
public const FEATURE_HTML_SPAN = 'html-span';
public const FEATURE_HTML_SRCSET = 'html-srcset';
public const FEATURE_HTML_STRIKE = 'html-strike';
public const FEATURE_HTML_STRONG = 'html-strong';
public const FEATURE_HTML_STYLE = 'html-style';
public const FEATURE_HTML_SVG = 'html-svg';
public const FEATURE_HTML_TABLE = 'html-table';
public const FEATURE_HTML_TARGET = 'html-target';
public const FEATURE_HTML_TEXTAREA = 'html-textarea';
public const FEATURE_HTML_VALIGN = 'html-valign';
public const FEATURE_HTML_VIDEO = 'html-video';
public const FEATURE_HTML_WBR = 'html-wbr';
public const FEATURE_HTML_WIDTH = 'html-width';
public const FEATURE_IMAGE_AVIF = 'image-avif';
public const FEATURE_IMAGE_BASE64 = 'image-base64';
public const FEATURE_IMAGE_BMP = 'image-bmp';
public const FEATURE_IMAGE_GIF = 'image-gif';
public const FEATURE_IMAGE_ICO = 'image-ico';
public const FEATURE_IMAGE_JPG = 'image-jpg';
public const FEATURE_IMAGE_PNG = 'image-png';
public const FEATURE_IMAGE_SVG = 'image-svg';
public const FEATURE_IMAGE_WEBP = 'image-webp';
public const FEATURE_UNSUPPORTED = 'unsupported';
public const FAMILY_AOL = 'aol';
public const FAMILY_APPLE_MAIL = 'apple-mail';
public const FAMILY_FASTMAIL = 'fastmail';
public const FAMILY_FREE_FR = 'free-fr';
public const FAMILY_GMAIL = 'gmail';
public const FAMILY_GMX = 'gmx';
public const FAMILY_HEY = 'hey';
public const FAMILY_IONOS_1AND1 = 'ionos-1and1';
public const FAMILY_LAPOSTE = 'laposte';
public const FAMILY_MAIL_RU = 'mail-ru';
public const FAMILY_MICROSOFT = 'microsoft';
public const FAMILY_ORANGE = 'orange';
public const FAMILY_OUTLOOK = 'outlook';
public const FAMILY_PROTONMAIL = 'protonmail';
public const FAMILY_RAINLOOP = 'rainloop';
public const FAMILY_SAMSUNG_EMAIL = 'samsung-email';
public const FAMILY_SFR = 'sfr';
public const FAMILY_T_ONLINE_DE = 't-online-de';
public const FAMILY_THUNDERBIRD = 'thunderbird';
public const FAMILY_WEB_DE = 'web-de';
public const FAMILY_YAHOO = 'yahoo';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFeatureAllowableValues()
{
return [
self::FEATURE_AMP,
self::FEATURE_CSS_ACCENT_COLOR,
self::FEATURE_CSS_ALIGN_ITEMS,
self::FEATURE_CSS_ANIMATION,
self::FEATURE_CSS_ASPECT_RATIO,
self::FEATURE_CSS_AT_FONT_FACE,
self::FEATURE_CSS_AT_IMPORT,
self::FEATURE_CSS_AT_KEYFRAMES,
self::FEATURE_CSS_AT_MEDIA,
self::FEATURE_CSS_AT_SUPPORTS,
self::FEATURE_CSS_BACKGROUND_BLEND_MODE,
self::FEATURE_CSS_BACKGROUND_CLIP,
self::FEATURE_CSS_BACKGROUND_COLOR,
self::FEATURE_CSS_BACKGROUND_IMAGE,
self::FEATURE_CSS_BACKGROUND_ORIGIN,
self::FEATURE_CSS_BACKGROUND_POSITION,
self::FEATURE_CSS_BACKGROUND_REPEAT,
self::FEATURE_CSS_BACKGROUND_SIZE,
self::FEATURE_CSS_BACKGROUND,
self::FEATURE_CSS_BLOCK_INLINE_SIZE,
self::FEATURE_CSS_BORDER_IMAGE,
self::FEATURE_CSS_BORDER_INLINE_BLOCK_INDIVIDUAL,
self::FEATURE_CSS_BORDER_INLINE_BLOCK_LONGHAND,
self::FEATURE_CSS_BORDER_INLINE_BLOCK,
self::FEATURE_CSS_BORDER_RADIUS_LOGICAL,
self::FEATURE_CSS_BORDER_RADIUS,
self::FEATURE_CSS_BORDER,
self::FEATURE_CSS_BOX_SHADOW,
self::FEATURE_CSS_BOX_SIZING,
self::FEATURE_CSS_CAPTION_SIDE,
self::FEATURE_CSS_CLIP_PATH,
self::FEATURE_CSS_COLUMN_COUNT,
self::FEATURE_CSS_COLUMN_LAYOUT_PROPERTIES,
self::FEATURE_CSS_DIRECTION,
self::FEATURE_CSS_DISPLAY_FLEX,
self::FEATURE_CSS_DISPLAY_GRID,
self::FEATURE_CSS_DISPLAY_NONE,
self::FEATURE_CSS_DISPLAY,
self::FEATURE_CSS_FILTER,
self::FEATURE_CSS_FLEX_DIRECTION,
self::FEATURE_CSS_FLEX_WRAP,
self::FEATURE_CSS_FLOAT,
self::FEATURE_CSS_FONT_KERNING,
self::FEATURE_CSS_FONT_WEIGHT,
self::FEATURE_CSS_FONT,
self::FEATURE_CSS_GAP,
self::FEATURE_CSS_GRID_TEMPLATE,
self::FEATURE_CSS_HEIGHT,
self::FEATURE_CSS_HYPHENS,
self::FEATURE_CSS_INLINE_SIZE,
self::FEATURE_CSS_JUSTIFY_CONTENT,
self::FEATURE_CSS_LEFT_RIGHT_TOP_BOTTOM,
self::FEATURE_CSS_LETTER_SPACING,
self::FEATURE_CSS_LINE_HEIGHT,
self::FEATURE_CSS_LIST_STYLE_IMAGE,
self::FEATURE_CSS_LIST_STYLE_POSITION,
self::FEATURE_CSS_LIST_STYLE_TYPE,
self::FEATURE_CSS_LIST_STYLE,
self::FEATURE_CSS_MARGIN_BLOCK_START_END,
self::FEATURE_CSS_MARGIN_INLINE_BLOCK,
self::FEATURE_CSS_MARGIN_INLINE_START_END,
self::FEATURE_CSS_MARGIN_INLINE,
self::FEATURE_CSS_MARGIN,
self::FEATURE_CSS_MAX_BLOCK_SIZE,
self::FEATURE_CSS_MAX_HEIGHT,
self::FEATURE_CSS_MAX_WIDTH,
self::FEATURE_CSS_MIN_HEIGHT,
self::FEATURE_CSS_MIN_INLINE_SIZE,
self::FEATURE_CSS_MIN_WIDTH,
self::FEATURE_CSS_MIX_BLEND_MODE,
self::FEATURE_CSS_OBJECT_FIT,
self::FEATURE_CSS_OBJECT_POSITION,
self::FEATURE_CSS_OPACITY,
self::FEATURE_CSS_OUTLINE_OFFSET,
self::FEATURE_CSS_OUTLINE,
self::FEATURE_CSS_OVERFLOW_WRAP,
self::FEATURE_CSS_OVERFLOW,
self::FEATURE_CSS_PADDING_BLOCK_START_END,
self::FEATURE_CSS_PADDING_INLINE_BLOCK,
self::FEATURE_CSS_PADDING_INLINE_START_END,
self::FEATURE_CSS_PADDING,
self::FEATURE_CSS_POSITION,
self::FEATURE_CSS_TAB_SIZE,
self::FEATURE_CSS_TABLE_LAYOUT,
self::FEATURE_CSS_TEXT_ALIGN_LAST,
self::FEATURE_CSS_TEXT_ALIGN,
self::FEATURE_CSS_TEXT_DECORATION_COLOR,
self::FEATURE_CSS_TEXT_DECORATION_THICKNESS,
self::FEATURE_CSS_TEXT_DECORATION,
self::FEATURE_CSS_TEXT_EMPHASIS_POSITION,
self::FEATURE_CSS_TEXT_EMPHASIS,
self::FEATURE_CSS_TEXT_INDENT,
self::FEATURE_CSS_TEXT_OVERFLOW,
self::FEATURE_CSS_TEXT_SHADOW,
self::FEATURE_CSS_TEXT_TRANSFORM,
self::FEATURE_CSS_TEXT_UNDERLINE_OFFSET,
self::FEATURE_CSS_TRANSFORM,
self::FEATURE_CSS_VERTICAL_ALIGN,
self::FEATURE_CSS_VISIBILITY,
self::FEATURE_CSS_WHITE_SPACE,
self::FEATURE_CSS_WIDTH,
self::FEATURE_CSS_WORD_BREAK,
self::FEATURE_CSS_WRITING_MODE,
self::FEATURE_CSS_Z_INDEX,
self::FEATURE_HTML_ABBR,
self::FEATURE_HTML_ADDRESS,
self::FEATURE_HTML_ALIGN,
self::FEATURE_HTML_ANCHOR_LINKS,
self::FEATURE_HTML_ARIA_DESCRIBEDBY,
self::FEATURE_HTML_ARIA_HIDDEN,
self::FEATURE_HTML_ARIA_LABEL,
self::FEATURE_HTML_ARIA_LABELLEDBY,
self::FEATURE_HTML_ARIA_LIVE,
self::FEATURE_HTML_AUDIO,
self::FEATURE_HTML_BACKGROUND,
self::FEATURE_HTML_BASE,
self::FEATURE_HTML_BLOCKQUOTE,
self::FEATURE_HTML_BODY,
self::FEATURE_HTML_BUTTON_RESET,
self::FEATURE_HTML_BUTTON_SUBMIT,
self::FEATURE_HTML_CODE,
self::FEATURE_HTML_DEL,
self::FEATURE_HTML_DFN,
self::FEATURE_HTML_DIALOG,
self::FEATURE_HTML_DIR,
self::FEATURE_HTML_DIV,
self::FEATURE_HTML_DOCTYPE,
self::FEATURE_HTML_FORM,
self::FEATURE_HTML_H1_H6,
self::FEATURE_HTML_HEIGHT,
self::FEATURE_HTML_IMAGE_MAPS,
self::FEATURE_HTML_INPUT_CHECKBOX,
self::FEATURE_HTML_INPUT_HIDDEN,
self::FEATURE_HTML_INPUT_RADIO,
self::FEATURE_HTML_INPUT_RESET,
self::FEATURE_HTML_INPUT_SUBMIT,
self::FEATURE_HTML_INPUT_TEXT,
self::FEATURE_HTML_LANG,
self::FEATURE_HTML_LINK,
self::FEATURE_HTML_LISTS,
self::FEATURE_HTML_LOADING_ATTRIBUTE,
self::FEATURE_HTML_MAILTO_LINKS,
self::FEATURE_HTML_MARQUEE,
self::FEATURE_HTML_METER,
self::FEATURE_HTML_OBJECT,
self::FEATURE_HTML_P,
self::FEATURE_HTML_PICTURE,
self::FEATURE_HTML_PRE,
self::FEATURE_HTML_PROGRESS,
self::FEATURE_HTML_REQUIRED,
self::FEATURE_HTML_ROLE,
self::FEATURE_HTML_RP,
self::FEATURE_HTML_RT,
self::FEATURE_HTML_RUBY,
self::FEATURE_HTML_SELECT,
self::FEATURE_HTML_SEMANTICS,
self::FEATURE_HTML_SMALL,
self::FEATURE_HTML_SPAN,
self::FEATURE_HTML_SRCSET,
self::FEATURE_HTML_STRIKE,
self::FEATURE_HTML_STRONG,
self::FEATURE_HTML_STYLE,
self::FEATURE_HTML_SVG,
self::FEATURE_HTML_TABLE,
self::FEATURE_HTML_TARGET,
self::FEATURE_HTML_TEXTAREA,
self::FEATURE_HTML_VALIGN,
self::FEATURE_HTML_VIDEO,
self::FEATURE_HTML_WBR,
self::FEATURE_HTML_WIDTH,
self::FEATURE_IMAGE_AVIF,
self::FEATURE_IMAGE_BASE64,
self::FEATURE_IMAGE_BMP,
self::FEATURE_IMAGE_GIF,
self::FEATURE_IMAGE_ICO,
self::FEATURE_IMAGE_JPG,
self::FEATURE_IMAGE_PNG,
self::FEATURE_IMAGE_SVG,
self::FEATURE_IMAGE_WEBP,
self::FEATURE_UNSUPPORTED,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFamilyAllowableValues()
{
return [
self::FAMILY_AOL,
self::FAMILY_APPLE_MAIL,
self::FAMILY_FASTMAIL,
self::FAMILY_FREE_FR,
self::FAMILY_GMAIL,
self::FAMILY_GMX,
self::FAMILY_HEY,
self::FAMILY_IONOS_1AND1,
self::FAMILY_LAPOSTE,
self::FAMILY_MAIL_RU,
self::FAMILY_MICROSOFT,
self::FAMILY_ORANGE,
self::FAMILY_OUTLOOK,
self::FAMILY_PROTONMAIL,
self::FAMILY_RAINLOOP,
self::FAMILY_SAMSUNG_EMAIL,
self::FAMILY_SFR,
self::FAMILY_T_ONLINE_DE,
self::FAMILY_THUNDERBIRD,
self::FAMILY_WEB_DE,
self::FAMILY_YAHOO,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('feature', $data ?? [], null);
$this->setIfExists('family', $data ?? [], null);
$this->setIfExists('platforms', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['feature'] === null) {
$invalidProperties[] = "'feature' can't be null";
}
$allowedValues = $this->getFeatureAllowableValues();
if (!is_null($this->container['feature']) && !in_array($this->container['feature'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'feature', must be one of '%s'",
$this->container['feature'],
implode("', '", $allowedValues)
);
}
if ($this->container['family'] === null) {
$invalidProperties[] = "'family' can't be null";
}
$allowedValues = $this->getFamilyAllowableValues();
if (!is_null($this->container['family']) && !in_array($this->container['family'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'family', must be one of '%s'",
$this->container['family'],
implode("', '", $allowedValues)
);
}
if ($this->container['platforms'] === null) {
$invalidProperties[] = "'platforms' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets feature
*
* @return string
*/
public function getFeature()
{
return $this->container['feature'];
}
/**
* Sets feature
*
* @param string $feature feature
*
* @return self
*/
public function setFeature($feature)
{
$allowedValues = $this->getFeatureAllowableValues();
if (!in_array($feature, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'feature', must be one of '%s'",
$feature,
implode("', '", $allowedValues)
)
);
}
if (is_null($feature)) {
throw new \InvalidArgumentException('non-nullable feature cannot be null');
}
$this->container['feature'] = $feature;
return $this;
}
/**
* Gets family
*
* @return string
*/
public function getFamily()
{
return $this->container['family'];
}
/**
* Sets family
*
* @param string $family family
*
* @return self
*/
public function setFamily($family)
{
$allowedValues = $this->getFamilyAllowableValues();
if (!in_array($family, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'family', must be one of '%s'",
$family,
implode("', '", $allowedValues)
)
);
}
if (is_null($family)) {
throw new \InvalidArgumentException('non-nullable family cannot be null');
}
$this->container['family'] = $family;
return $this;
}
/**
* Gets platforms
*
* @return \MailSlurp\Models\EmailFeaturePlatformStatistics[]
*/
public function getPlatforms()
{
return $this->container['platforms'];
}
/**
* Sets platforms
*
* @param \MailSlurp\Models\EmailFeaturePlatformStatistics[] $platforms platforms
*
* @return self
*/
public function setPlatforms($platforms)
{
if (is_null($platforms)) {
throw new \InvalidArgumentException('non-nullable platforms cannot be null');
}
$this->container['platforms'] = $platforms;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureFamilyName
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureFamilyName Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureFamilyName implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureFamilyName';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'slug' => 'string',
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'slug' => null,
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'slug' => false,
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'slug' => 'slug',
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'slug' => 'setSlug',
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'slug' => 'getSlug',
'name' => 'getName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SLUG_AOL = 'aol';
public const SLUG_APPLE_MAIL = 'apple-mail';
public const SLUG_FASTMAIL = 'fastmail';
public const SLUG_FREE_FR = 'free-fr';
public const SLUG_GMAIL = 'gmail';
public const SLUG_GMX = 'gmx';
public const SLUG_HEY = 'hey';
public const SLUG_IONOS_1AND1 = 'ionos-1and1';
public const SLUG_LAPOSTE = 'laposte';
public const SLUG_MAIL_RU = 'mail-ru';
public const SLUG_MICROSOFT = 'microsoft';
public const SLUG_ORANGE = 'orange';
public const SLUG_OUTLOOK = 'outlook';
public const SLUG_PROTONMAIL = 'protonmail';
public const SLUG_RAINLOOP = 'rainloop';
public const SLUG_SAMSUNG_EMAIL = 'samsung-email';
public const SLUG_SFR = 'sfr';
public const SLUG_T_ONLINE_DE = 't-online-de';
public const SLUG_THUNDERBIRD = 'thunderbird';
public const SLUG_WEB_DE = 'web-de';
public const SLUG_YAHOO = 'yahoo';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSlugAllowableValues()
{
return [
self::SLUG_AOL,
self::SLUG_APPLE_MAIL,
self::SLUG_FASTMAIL,
self::SLUG_FREE_FR,
self::SLUG_GMAIL,
self::SLUG_GMX,
self::SLUG_HEY,
self::SLUG_IONOS_1AND1,
self::SLUG_LAPOSTE,
self::SLUG_MAIL_RU,
self::SLUG_MICROSOFT,
self::SLUG_ORANGE,
self::SLUG_OUTLOOK,
self::SLUG_PROTONMAIL,
self::SLUG_RAINLOOP,
self::SLUG_SAMSUNG_EMAIL,
self::SLUG_SFR,
self::SLUG_T_ONLINE_DE,
self::SLUG_THUNDERBIRD,
self::SLUG_WEB_DE,
self::SLUG_YAHOO,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('slug', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['slug'] === null) {
$invalidProperties[] = "'slug' can't be null";
}
$allowedValues = $this->getSlugAllowableValues();
if (!is_null($this->container['slug']) && !in_array($this->container['slug'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'slug', must be one of '%s'",
$this->container['slug'],
implode("', '", $allowedValues)
);
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets slug
*
* @return string
*/
public function getSlug()
{
return $this->container['slug'];
}
/**
* Sets slug
*
* @param string $slug slug
*
* @return self
*/
public function setSlug($slug)
{
$allowedValues = $this->getSlugAllowableValues();
if (!in_array($slug, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'slug', must be one of '%s'",
$slug,
implode("', '", $allowedValues)
)
);
}
if (is_null($slug)) {
throw new \InvalidArgumentException('non-nullable slug cannot be null');
}
$this->container['slug'] = $slug;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailFeatureCategoryName
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailFeatureCategoryName Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailFeatureCategoryName implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailFeatureCategoryName';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'slug' => 'string',
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'slug' => null,
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'slug' => false,
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'slug' => 'slug',
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'slug' => 'setSlug',
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'slug' => 'getSlug',
'name' => 'getName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SLUG_CSS = 'css';
public const SLUG_HTML = 'html';
public const SLUG_IMAGE = 'image';
public const SLUG_OTHERS = 'others';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSlugAllowableValues()
{
return [
self::SLUG_CSS,
self::SLUG_HTML,
self::SLUG_IMAGE,
self::SLUG_OTHERS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('slug', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['slug'] === null) {
$invalidProperties[] = "'slug' can't be null";
}
$allowedValues = $this->getSlugAllowableValues();
if (!is_null($this->container['slug']) && !in_array($this->container['slug'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'slug', must be one of '%s'",
$this->container['slug'],
implode("', '", $allowedValues)
);
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets slug
*
* @return string
*/
public function getSlug()
{
return $this->container['slug'];
}
/**
* Sets slug
*
* @param string $slug slug
*
* @return self
*/
public function setSlug($slug)
{
$allowedValues = $this->getSlugAllowableValues();
if (!in_array($slug, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'slug', must be one of '%s'",
$slug,
implode("', '", $allowedValues)
)
);
}
if (is_null($slug)) {
throw new \InvalidArgumentException('non-nullable slug cannot be null');
}
$this->container['slug'] = $slug;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailContentPartResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailContentPartResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailContentPartResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailContentPartResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'content' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'content' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'content' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'content' => 'content'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'content' => 'setContent'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'content' => 'getContent'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('content', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets content
*
* @return string|null
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param string|null $content content
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
array_push($this->openAPINullablesSetToNull, 'content');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('content', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['content'] = $content;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailContentMatchResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailContentMatchResult Class Doc Comment
*
* @category Class
* @description Matches for the given pattern
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailContentMatchResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailContentMatchResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'pattern' => 'string',
'matches' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'pattern' => null,
'matches' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'pattern' => false,
'matches' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'pattern' => 'pattern',
'matches' => 'matches'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'pattern' => 'setPattern',
'matches' => 'setMatches'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'pattern' => 'getPattern',
'matches' => 'getMatches'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('pattern', $data ?? [], null);
$this->setIfExists('matches', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['pattern'] === null) {
$invalidProperties[] = "'pattern' can't be null";
}
if ($this->container['matches'] === null) {
$invalidProperties[] = "'matches' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets pattern
*
* @return string
*/
public function getPattern()
{
return $this->container['pattern'];
}
/**
* Sets pattern
*
* @param string $pattern pattern
*
* @return self
*/
public function setPattern($pattern)
{
if (is_null($pattern)) {
throw new \InvalidArgumentException('non-nullable pattern cannot be null');
}
$this->container['pattern'] = $pattern;
return $this;
}
/**
* Gets matches
*
* @return string[]
*/
public function getMatches()
{
return $this->container['matches'];
}
/**
* Sets matches
*
* @param string[] $matches matches
*
* @return self
*/
public function setMatches($matches)
{
if (is_null($matches)) {
throw new \InvalidArgumentException('non-nullable matches cannot be null');
}
$this->container['matches'] = $matches;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailAvailableResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailAvailableResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailAvailableResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailAvailableResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'available' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'available' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'available' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'available' => 'available'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'available' => 'setAvailable'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'available' => 'getAvailable'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('available', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['available'] === null) {
$invalidProperties[] = "'available' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets available
*
* @return bool
*/
public function getAvailable()
{
return $this->container['available'];
}
/**
* Sets available
*
* @param bool $available available
*
* @return self
*/
public function setAvailable($available)
{
if (is_null($available)) {
throw new \InvalidArgumentException('non-nullable available cannot be null');
}
$this->container['available'] = $available;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* EmailAnalysis
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* EmailAnalysis Class Doc Comment
*
* @category Class
* @description Analysis result for email. Each verdict property is a string PASS|FAIL|GRAY or dynamic error message
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class EmailAnalysis implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'EmailAnalysis';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'spam_verdict' => 'string',
'virus_verdict' => 'string',
'spf_verdict' => 'string',
'dkim_verdict' => 'string',
'dmarc_verdict' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'spam_verdict' => null,
'virus_verdict' => null,
'spf_verdict' => null,
'dkim_verdict' => null,
'dmarc_verdict' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'spam_verdict' => true,
'virus_verdict' => true,
'spf_verdict' => true,
'dkim_verdict' => true,
'dmarc_verdict' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'spam_verdict' => 'spamVerdict',
'virus_verdict' => 'virusVerdict',
'spf_verdict' => 'spfVerdict',
'dkim_verdict' => 'dkimVerdict',
'dmarc_verdict' => 'dmarcVerdict'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'spam_verdict' => 'setSpamVerdict',
'virus_verdict' => 'setVirusVerdict',
'spf_verdict' => 'setSpfVerdict',
'dkim_verdict' => 'setDkimVerdict',
'dmarc_verdict' => 'setDmarcVerdict'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'spam_verdict' => 'getSpamVerdict',
'virus_verdict' => 'getVirusVerdict',
'spf_verdict' => 'getSpfVerdict',
'dkim_verdict' => 'getDkimVerdict',
'dmarc_verdict' => 'getDmarcVerdict'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('spam_verdict', $data ?? [], null);
$this->setIfExists('virus_verdict', $data ?? [], null);
$this->setIfExists('spf_verdict', $data ?? [], null);
$this->setIfExists('dkim_verdict', $data ?? [], null);
$this->setIfExists('dmarc_verdict', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets spam_verdict
*
* @return string|null
*/
public function getSpamVerdict()
{
return $this->container['spam_verdict'];
}
/**
* Sets spam_verdict
*
* @param string|null $spam_verdict Verdict of spam ranking analysis
*
* @return self
*/
public function setSpamVerdict($spam_verdict)
{
if (is_null($spam_verdict)) {
array_push($this->openAPINullablesSetToNull, 'spam_verdict');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('spam_verdict', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['spam_verdict'] = $spam_verdict;
return $this;
}
/**
* Gets virus_verdict
*
* @return string|null
*/
public function getVirusVerdict()
{
return $this->container['virus_verdict'];
}
/**
* Sets virus_verdict
*
* @param string|null $virus_verdict Verdict of virus scan analysis
*
* @return self
*/
public function setVirusVerdict($virus_verdict)
{
if (is_null($virus_verdict)) {
array_push($this->openAPINullablesSetToNull, 'virus_verdict');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('virus_verdict', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['virus_verdict'] = $virus_verdict;
return $this;
}
/**
* Gets spf_verdict
*
* @return string|null
*/
public function getSpfVerdict()
{
return $this->container['spf_verdict'];
}
/**
* Sets spf_verdict
*
* @param string|null $spf_verdict Verdict of Send Policy Framework record spoofing analysis
*
* @return self
*/
public function setSpfVerdict($spf_verdict)
{
if (is_null($spf_verdict)) {
array_push($this->openAPINullablesSetToNull, 'spf_verdict');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('spf_verdict', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['spf_verdict'] = $spf_verdict;
return $this;
}
/**
* Gets dkim_verdict
*
* @return string|null
*/
public function getDkimVerdict()
{
return $this->container['dkim_verdict'];
}
/**
* Sets dkim_verdict
*
* @param string|null $dkim_verdict Verdict of DomainKeys Identified Mail analysis
*
* @return self
*/
public function setDkimVerdict($dkim_verdict)
{
if (is_null($dkim_verdict)) {
array_push($this->openAPINullablesSetToNull, 'dkim_verdict');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('dkim_verdict', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['dkim_verdict'] = $dkim_verdict;
return $this;
}
/**
* Gets dmarc_verdict
*
* @return string|null
*/
public function getDmarcVerdict()
{
return $this->container['dmarc_verdict'];
}
/**
* Sets dmarc_verdict
*
* @param string|null $dmarc_verdict Verdict of Domain-based Message Authentication Reporting and Conformance analysis
*
* @return self
*/
public function setDmarcVerdict($dmarc_verdict)
{
if (is_null($dmarc_verdict)) {
array_push($this->openAPINullablesSetToNull, 'dmarc_verdict');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('dmarc_verdict', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['dmarc_verdict'] = $dmarc_verdict;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* Email
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* Email Class Doc Comment
*
* @category Class
* @description Email entity (also known as EmailDto). When an SMTP email message is received by MailSlurp it is parsed. The body and attachments are written to disk and the fields such as to, from, subject etc are stored in a database. The `body` contains the email content. If you want the original SMTP message see the `getRawEmail` endpoints. The attachments can be fetched using the AttachmentController
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class Email implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'Email';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'inbox_id' => 'string',
'domain_id' => 'string',
'to' => 'string[]',
'from' => 'string',
'sender' => '\MailSlurp\Models\Sender',
'recipients' => '\MailSlurp\Models\EmailRecipients',
'reply_to' => 'string',
'cc' => 'string[]',
'bcc' => 'string[]',
'headers' => 'array<string,string>',
'headers_map' => 'array<string,string[]>',
'attachments' => 'string[]',
'subject' => 'string',
'body' => 'string',
'body_excerpt' => 'string',
'text_excerpt' => 'string',
'body_md5_hash' => 'string',
'is_html' => 'bool',
'charset' => 'string',
'analysis' => '\MailSlurp\Models\EmailAnalysis',
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'read' => 'bool',
'team_access' => 'bool',
'is_x_amp_html' => 'bool',
'body_part_content_types' => 'string[]',
'html' => 'bool',
'xamp_html' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'inbox_id' => 'uuid',
'domain_id' => 'uuid',
'to' => null,
'from' => null,
'sender' => null,
'recipients' => null,
'reply_to' => null,
'cc' => null,
'bcc' => null,
'headers' => null,
'headers_map' => null,
'attachments' => null,
'subject' => null,
'body' => null,
'body_excerpt' => null,
'text_excerpt' => null,
'body_md5_hash' => null,
'is_html' => null,
'charset' => null,
'analysis' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time',
'read' => null,
'team_access' => null,
'is_x_amp_html' => null,
'body_part_content_types' => null,
'html' => null,
'xamp_html' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'inbox_id' => false,
'domain_id' => true,
'to' => false,
'from' => true,
'sender' => true,
'recipients' => true,
'reply_to' => true,
'cc' => true,
'bcc' => true,
'headers' => true,
'headers_map' => true,
'attachments' => true,
'subject' => true,
'body' => true,
'body_excerpt' => true,
'text_excerpt' => true,
'body_md5_hash' => true,
'is_html' => true,
'charset' => true,
'analysis' => true,
'created_at' => false,
'updated_at' => false,
'read' => false,
'team_access' => false,
'is_x_amp_html' => true,
'body_part_content_types' => true,
'html' => false,
'xamp_html' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'inbox_id' => 'inboxId',
'domain_id' => 'domainId',
'to' => 'to',
'from' => 'from',
'sender' => 'sender',
'recipients' => 'recipients',
'reply_to' => 'replyTo',
'cc' => 'cc',
'bcc' => 'bcc',
'headers' => 'headers',
'headers_map' => 'headersMap',
'attachments' => 'attachments',
'subject' => 'subject',
'body' => 'body',
'body_excerpt' => 'bodyExcerpt',
'text_excerpt' => 'textExcerpt',
'body_md5_hash' => 'bodyMD5Hash',
'is_html' => 'isHTML',
'charset' => 'charset',
'analysis' => 'analysis',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'read' => 'read',
'team_access' => 'teamAccess',
'is_x_amp_html' => 'isXAmpHtml',
'body_part_content_types' => 'bodyPartContentTypes',
'html' => 'html',
'xamp_html' => 'xampHtml'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'inbox_id' => 'setInboxId',
'domain_id' => 'setDomainId',
'to' => 'setTo',
'from' => 'setFrom',
'sender' => 'setSender',
'recipients' => 'setRecipients',
'reply_to' => 'setReplyTo',
'cc' => 'setCc',
'bcc' => 'setBcc',
'headers' => 'setHeaders',
'headers_map' => 'setHeadersMap',
'attachments' => 'setAttachments',
'subject' => 'setSubject',
'body' => 'setBody',
'body_excerpt' => 'setBodyExcerpt',
'text_excerpt' => 'setTextExcerpt',
'body_md5_hash' => 'setBodyMd5Hash',
'is_html' => 'setIsHtml',
'charset' => 'setCharset',
'analysis' => 'setAnalysis',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'read' => 'setRead',
'team_access' => 'setTeamAccess',
'is_x_amp_html' => 'setIsXAmpHtml',
'body_part_content_types' => 'setBodyPartContentTypes',
'html' => 'setHtml',
'xamp_html' => 'setXampHtml'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'inbox_id' => 'getInboxId',
'domain_id' => 'getDomainId',
'to' => 'getTo',
'from' => 'getFrom',
'sender' => 'getSender',
'recipients' => 'getRecipients',
'reply_to' => 'getReplyTo',
'cc' => 'getCc',
'bcc' => 'getBcc',
'headers' => 'getHeaders',
'headers_map' => 'getHeadersMap',
'attachments' => 'getAttachments',
'subject' => 'getSubject',
'body' => 'getBody',
'body_excerpt' => 'getBodyExcerpt',
'text_excerpt' => 'getTextExcerpt',
'body_md5_hash' => 'getBodyMd5Hash',
'is_html' => 'getIsHtml',
'charset' => 'getCharset',
'analysis' => 'getAnalysis',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'read' => 'getRead',
'team_access' => 'getTeamAccess',
'is_x_amp_html' => 'getIsXAmpHtml',
'body_part_content_types' => 'getBodyPartContentTypes',
'html' => 'getHtml',
'xamp_html' => 'getXampHtml'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('to', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('sender', $data ?? [], null);
$this->setIfExists('recipients', $data ?? [], null);
$this->setIfExists('reply_to', $data ?? [], null);
$this->setIfExists('cc', $data ?? [], null);
$this->setIfExists('bcc', $data ?? [], null);
$this->setIfExists('headers', $data ?? [], null);
$this->setIfExists('headers_map', $data ?? [], null);
$this->setIfExists('attachments', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('body_excerpt', $data ?? [], null);
$this->setIfExists('text_excerpt', $data ?? [], null);
$this->setIfExists('body_md5_hash', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('analysis', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('read', $data ?? [], null);
$this->setIfExists('team_access', $data ?? [], null);
$this->setIfExists('is_x_amp_html', $data ?? [], null);
$this->setIfExists('body_part_content_types', $data ?? [], null);
$this->setIfExists('html', $data ?? [], null);
$this->setIfExists('xamp_html', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['to'] === null) {
$invalidProperties[] = "'to' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['read'] === null) {
$invalidProperties[] = "'read' can't be null";
}
if ($this->container['team_access'] === null) {
$invalidProperties[] = "'team_access' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of the email entity
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id ID of user that email belongs to
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id ID of the inbox that received the email
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id ID of the domain that received the email
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets to
*
* @return string[]
*/
public function getTo()
{
return $this->container['to'];
}
/**
* Sets to
*
* @param string[] $to List of `To` recipient email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setTo($to)
{
if (is_null($to)) {
throw new \InvalidArgumentException('non-nullable to cannot be null');
}
$this->container['to'] = $to;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from Who the email was sent from. An email address - see fromName for the sender name.
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets sender
*
* @return \MailSlurp\Models\Sender|null
*/
public function getSender()
{
return $this->container['sender'];
}
/**
* Sets sender
*
* @param \MailSlurp\Models\Sender|null $sender sender
*
* @return self
*/
public function setSender($sender)
{
if (is_null($sender)) {
array_push($this->openAPINullablesSetToNull, 'sender');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sender', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sender'] = $sender;
return $this;
}
/**
* Gets recipients
*
* @return \MailSlurp\Models\EmailRecipients|null
*/
public function getRecipients()
{
return $this->container['recipients'];
}
/**
* Sets recipients
*
* @param \MailSlurp\Models\EmailRecipients|null $recipients recipients
*
* @return self
*/
public function setRecipients($recipients)
{
if (is_null($recipients)) {
array_push($this->openAPINullablesSetToNull, 'recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['recipients'] = $recipients;
return $this;
}
/**
* Gets reply_to
*
* @return string|null
*/
public function getReplyTo()
{
return $this->container['reply_to'];
}
/**
* Sets reply_to
*
* @param string|null $reply_to The `replyTo` field on the received email message
*
* @return self
*/
public function setReplyTo($reply_to)
{
if (is_null($reply_to)) {
array_push($this->openAPINullablesSetToNull, 'reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reply_to'] = $reply_to;
return $this;
}
/**
* Gets cc
*
* @return string[]|null
*/
public function getCc()
{
return $this->container['cc'];
}
/**
* Sets cc
*
* @param string[]|null $cc List of `CC` recipients email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setCc($cc)
{
if (is_null($cc)) {
array_push($this->openAPINullablesSetToNull, 'cc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('cc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['cc'] = $cc;
return $this;
}
/**
* Gets bcc
*
* @return string[]|null
*/
public function getBcc()
{
return $this->container['bcc'];
}
/**
* Sets bcc
*
* @param string[]|null $bcc List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names.
*
* @return self
*/
public function setBcc($bcc)
{
if (is_null($bcc)) {
array_push($this->openAPINullablesSetToNull, 'bcc');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bcc', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bcc'] = $bcc;
return $this;
}
/**
* Gets headers
*
* @return array<string,string>|null
* @deprecated
*/
public function getHeaders()
{
return $this->container['headers'];
}
/**
* Sets headers
*
* @param array<string,string>|null $headers Collection of SMTP headers attached to email
*
* @return self
* @deprecated
*/
public function setHeaders($headers)
{
if (is_null($headers)) {
array_push($this->openAPINullablesSetToNull, 'headers');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('headers', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['headers'] = $headers;
return $this;
}
/**
* Gets headers_map
*
* @return array<string,string[]>|null
*/
public function getHeadersMap()
{
return $this->container['headers_map'];
}
/**
* Sets headers_map
*
* @param array<string,string[]>|null $headers_map Multi-value map of SMTP headers attached to email
*
* @return self
*/
public function setHeadersMap($headers_map)
{
if (is_null($headers_map)) {
array_push($this->openAPINullablesSetToNull, 'headers_map');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('headers_map', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['headers_map'] = $headers_map;
return $this;
}
/**
* Gets attachments
*
* @return string[]|null
*/
public function getAttachments()
{
return $this->container['attachments'];
}
/**
* Sets attachments
*
* @param string[]|null $attachments List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension.
*
* @return self
*/
public function setAttachments($attachments)
{
if (is_null($attachments)) {
array_push($this->openAPINullablesSetToNull, 'attachments');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('attachments', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['attachments'] = $attachments;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject The subject line of the email message as specified by SMTP subject header
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets body
*
* @return string|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string|null $body The body of the email message as text parsed from the SMTP message body (does not include attachments). Fetch the raw content to access the SMTP message and use the attachments property to access attachments. The body is stored separately to the email entity so the body is not returned in paginated results only in full single email or wait requests.
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
array_push($this->openAPINullablesSetToNull, 'body');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets body_excerpt
*
* @return string|null
*/
public function getBodyExcerpt()
{
return $this->container['body_excerpt'];
}
/**
* Sets body_excerpt
*
* @param string|null $body_excerpt An excerpt of the body of the email message for quick preview. Takes HTML content part if exists falls back to TEXT content part if not
*
* @return self
*/
public function setBodyExcerpt($body_excerpt)
{
if (is_null($body_excerpt)) {
array_push($this->openAPINullablesSetToNull, 'body_excerpt');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_excerpt', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_excerpt'] = $body_excerpt;
return $this;
}
/**
* Gets text_excerpt
*
* @return string|null
*/
public function getTextExcerpt()
{
return $this->container['text_excerpt'];
}
/**
* Sets text_excerpt
*
* @param string|null $text_excerpt An excerpt of the body of the email message for quick preview. Takes TEXT content part if exists
*
* @return self
*/
public function setTextExcerpt($text_excerpt)
{
if (is_null($text_excerpt)) {
array_push($this->openAPINullablesSetToNull, 'text_excerpt');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('text_excerpt', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['text_excerpt'] = $text_excerpt;
return $this;
}
/**
* Gets body_md5_hash
*
* @return string|null
*/
public function getBodyMd5Hash()
{
return $this->container['body_md5_hash'];
}
/**
* Sets body_md5_hash
*
* @param string|null $body_md5_hash A hash signature of the email message using MD5. Useful for comparing emails without fetching full body.
*
* @return self
*/
public function setBodyMd5Hash($body_md5_hash)
{
if (is_null($body_md5_hash)) {
array_push($this->openAPINullablesSetToNull, 'body_md5_hash');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_md5_hash', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_md5_hash'] = $body_md5_hash;
return $this;
}
/**
* Gets is_html
*
* @return bool|null
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool|null $is_html Is the email body content type HTML?
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
array_push($this->openAPINullablesSetToNull, 'is_html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('is_html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset Detected character set of the email body such as UTF-8
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets analysis
*
* @return \MailSlurp\Models\EmailAnalysis|null
*/
public function getAnalysis()
{
return $this->container['analysis'];
}
/**
* Sets analysis
*
* @param \MailSlurp\Models\EmailAnalysis|null $analysis analysis
*
* @return self
*/
public function setAnalysis($analysis)
{
if (is_null($analysis)) {
array_push($this->openAPINullablesSetToNull, 'analysis');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('analysis', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['analysis'] = $analysis;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at When was the email received by MailSlurp
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at When was the email last updated
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets read
*
* @return bool
*/
public function getRead()
{
return $this->container['read'];
}
/**
* Sets read
*
* @param bool $read Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks.
*
* @return self
*/
public function setRead($read)
{
if (is_null($read)) {
throw new \InvalidArgumentException('non-nullable read cannot be null');
}
$this->container['read'] = $read;
return $this;
}
/**
* Gets team_access
*
* @return bool
*/
public function getTeamAccess()
{
return $this->container['team_access'];
}
/**
* Sets team_access
*
* @param bool $team_access Can the email be accessed by organization team members
*
* @return self
*/
public function setTeamAccess($team_access)
{
if (is_null($team_access)) {
throw new \InvalidArgumentException('non-nullable team_access cannot be null');
}
$this->container['team_access'] = $team_access;
return $this;
}
/**
* Gets is_x_amp_html
*
* @return bool|null
*/
public function getIsXAmpHtml()
{
return $this->container['is_x_amp_html'];
}
/**
* Sets is_x_amp_html
*
* @param bool|null $is_x_amp_html Is the email body content type x-amp-html Amp4Email?
*
* @return self
*/
public function setIsXAmpHtml($is_x_amp_html)
{
if (is_null($is_x_amp_html)) {
array_push($this->openAPINullablesSetToNull, 'is_x_amp_html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('is_x_amp_html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['is_x_amp_html'] = $is_x_amp_html;
return $this;
}
/**
* Gets body_part_content_types
*
* @return string[]|null
*/
public function getBodyPartContentTypes()
{
return $this->container['body_part_content_types'];
}
/**
* Sets body_part_content_types
*
* @param string[]|null $body_part_content_types A list of detected multipart mime message body part content types such as text/plain and text/html. Can be used with email bodyPart endpoints to fetch individual body parts.
*
* @return self
*/
public function setBodyPartContentTypes($body_part_content_types)
{
if (is_null($body_part_content_types)) {
array_push($this->openAPINullablesSetToNull, 'body_part_content_types');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body_part_content_types', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body_part_content_types'] = $body_part_content_types;
return $this;
}
/**
* Gets html
*
* @return bool|null
*/
public function getHtml()
{
return $this->container['html'];
}
/**
* Sets html
*
* @param bool|null $html html
*
* @return self
*/
public function setHtml($html)
{
if (is_null($html)) {
throw new \InvalidArgumentException('non-nullable html cannot be null');
}
$this->container['html'] = $html;
return $this;
}
/**
* Gets xamp_html
*
* @return bool|null
*/
public function getXampHtml()
{
return $this->container['xamp_html'];
}
/**
* Sets xamp_html
*
* @param bool|null $xamp_html xamp_html
*
* @return self
*/
public function setXampHtml($xamp_html)
{
if (is_null($xamp_html)) {
throw new \InvalidArgumentException('non-nullable xamp_html cannot be null');
}
$this->container['xamp_html'] = $xamp_html;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DownloadAttachmentDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DownloadAttachmentDto Class Doc Comment
*
* @category Class
* @description Content of attachment
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DownloadAttachmentDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DownloadAttachmentDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'base64_file_contents' => 'string',
'content_type' => 'string',
'size_bytes' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'base64_file_contents' => null,
'content_type' => null,
'size_bytes' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'base64_file_contents' => false,
'content_type' => false,
'size_bytes' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'base64_file_contents' => 'base64FileContents',
'content_type' => 'contentType',
'size_bytes' => 'sizeBytes'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'base64_file_contents' => 'setBase64FileContents',
'content_type' => 'setContentType',
'size_bytes' => 'setSizeBytes'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'base64_file_contents' => 'getBase64FileContents',
'content_type' => 'getContentType',
'size_bytes' => 'getSizeBytes'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('base64_file_contents', $data ?? [], null);
$this->setIfExists('content_type', $data ?? [], null);
$this->setIfExists('size_bytes', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['base64_file_contents'] === null) {
$invalidProperties[] = "'base64_file_contents' can't be null";
}
if ($this->container['content_type'] === null) {
$invalidProperties[] = "'content_type' can't be null";
}
if ($this->container['size_bytes'] === null) {
$invalidProperties[] = "'size_bytes' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets base64_file_contents
*
* @return string
*/
public function getBase64FileContents()
{
return $this->container['base64_file_contents'];
}
/**
* Sets base64_file_contents
*
* @param string $base64_file_contents Base64 encoded string of attachment bytes. Decode the base64 encoded string to get the raw contents. If the file has a content type such as `text/html` you can read the contents directly by converting it to string using `utf-8` encoding.
*
* @return self
*/
public function setBase64FileContents($base64_file_contents)
{
if (is_null($base64_file_contents)) {
throw new \InvalidArgumentException('non-nullable base64_file_contents cannot be null');
}
$this->container['base64_file_contents'] = $base64_file_contents;
return $this;
}
/**
* Gets content_type
*
* @return string
*/
public function getContentType()
{
return $this->container['content_type'];
}
/**
* Sets content_type
*
* @param string $content_type Content type of attachment. Examples are `image/png`, `application/msword`, `text/csv` etc.
*
* @return self
*/
public function setContentType($content_type)
{
if (is_null($content_type)) {
throw new \InvalidArgumentException('non-nullable content_type cannot be null');
}
$this->container['content_type'] = $content_type;
return $this;
}
/**
* Gets size_bytes
*
* @return int
*/
public function getSizeBytes()
{
return $this->container['size_bytes'];
}
/**
* Sets size_bytes
*
* @param int $size_bytes Size in bytes of attachment content
*
* @return self
*/
public function setSizeBytes($size_bytes)
{
if (is_null($size_bytes)) {
throw new \InvalidArgumentException('non-nullable size_bytes cannot be null');
}
$this->container['size_bytes'] = $size_bytes;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DomainPreview
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DomainPreview Class Doc Comment
*
* @category Class
* @description Preview object for domain entity
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DomainPreview implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DomainPreview';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'domain' => 'string',
'catch_all_inbox_id' => 'string',
'created_at' => '\DateTime',
'domain_type' => 'string',
'is_verified' => 'bool',
'has_missing_records' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'domain' => null,
'catch_all_inbox_id' => 'uuid',
'created_at' => 'date-time',
'domain_type' => null,
'is_verified' => null,
'has_missing_records' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'domain' => false,
'catch_all_inbox_id' => true,
'created_at' => false,
'domain_type' => false,
'is_verified' => false,
'has_missing_records' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'domain' => 'domain',
'catch_all_inbox_id' => 'catchAllInboxId',
'created_at' => 'createdAt',
'domain_type' => 'domainType',
'is_verified' => 'isVerified',
'has_missing_records' => 'hasMissingRecords'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'domain' => 'setDomain',
'catch_all_inbox_id' => 'setCatchAllInboxId',
'created_at' => 'setCreatedAt',
'domain_type' => 'setDomainType',
'is_verified' => 'setIsVerified',
'has_missing_records' => 'setHasMissingRecords'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'domain' => 'getDomain',
'catch_all_inbox_id' => 'getCatchAllInboxId',
'created_at' => 'getCreatedAt',
'domain_type' => 'getDomainType',
'is_verified' => 'getIsVerified',
'has_missing_records' => 'getHasMissingRecords'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const DOMAIN_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const DOMAIN_TYPE_SMTP_DOMAIN = 'SMTP_DOMAIN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getDomainTypeAllowableValues()
{
return [
self::DOMAIN_TYPE_HTTP_INBOX,
self::DOMAIN_TYPE_SMTP_DOMAIN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('domain', $data ?? [], null);
$this->setIfExists('catch_all_inbox_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('domain_type', $data ?? [], null);
$this->setIfExists('is_verified', $data ?? [], null);
$this->setIfExists('has_missing_records', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['domain'] === null) {
$invalidProperties[] = "'domain' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['domain_type'] === null) {
$invalidProperties[] = "'domain_type' can't be null";
}
$allowedValues = $this->getDomainTypeAllowableValues();
if (!is_null($this->container['domain_type']) && !in_array($this->container['domain_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'domain_type', must be one of '%s'",
$this->container['domain_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['is_verified'] === null) {
$invalidProperties[] = "'is_verified' can't be null";
}
if ($this->container['has_missing_records'] === null) {
$invalidProperties[] = "'has_missing_records' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets domain
*
* @return string
*/
public function getDomain()
{
return $this->container['domain'];
}
/**
* Sets domain
*
* @param string $domain domain
*
* @return self
*/
public function setDomain($domain)
{
if (is_null($domain)) {
throw new \InvalidArgumentException('non-nullable domain cannot be null');
}
$this->container['domain'] = $domain;
return $this;
}
/**
* Gets catch_all_inbox_id
*
* @return string|null
*/
public function getCatchAllInboxId()
{
return $this->container['catch_all_inbox_id'];
}
/**
* Sets catch_all_inbox_id
*
* @param string|null $catch_all_inbox_id catch_all_inbox_id
*
* @return self
*/
public function setCatchAllInboxId($catch_all_inbox_id)
{
if (is_null($catch_all_inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'catch_all_inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('catch_all_inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['catch_all_inbox_id'] = $catch_all_inbox_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets domain_type
*
* @return string
*/
public function getDomainType()
{
return $this->container['domain_type'];
}
/**
* Sets domain_type
*
* @param string $domain_type Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails.
*
* @return self
*/
public function setDomainType($domain_type)
{
$allowedValues = $this->getDomainTypeAllowableValues();
if (!in_array($domain_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'domain_type', must be one of '%s'",
$domain_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($domain_type)) {
throw new \InvalidArgumentException('non-nullable domain_type cannot be null');
}
$this->container['domain_type'] = $domain_type;
return $this;
}
/**
* Gets is_verified
*
* @return bool
*/
public function getIsVerified()
{
return $this->container['is_verified'];
}
/**
* Sets is_verified
*
* @param bool $is_verified is_verified
*
* @return self
*/
public function setIsVerified($is_verified)
{
if (is_null($is_verified)) {
throw new \InvalidArgumentException('non-nullable is_verified cannot be null');
}
$this->container['is_verified'] = $is_verified;
return $this;
}
/**
* Gets has_missing_records
*
* @return bool
*/
public function getHasMissingRecords()
{
return $this->container['has_missing_records'];
}
/**
* Sets has_missing_records
*
* @param bool $has_missing_records has_missing_records
*
* @return self
*/
public function setHasMissingRecords($has_missing_records)
{
if (is_null($has_missing_records)) {
throw new \InvalidArgumentException('non-nullable has_missing_records cannot be null');
}
$this->container['has_missing_records'] = $has_missing_records;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DomainNameRecord
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DomainNameRecord Class Doc Comment
*
* @category Class
* @description DNS Record required for verification of a domain. Record vary depending on domain type.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DomainNameRecord implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DomainNameRecord';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'label' => 'string',
'required' => 'bool',
'record_type' => 'string',
'name' => 'string',
'record_entries' => 'string[]',
'ttl' => 'int',
'alternative_record_entries' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'label' => null,
'required' => null,
'record_type' => null,
'name' => null,
'record_entries' => null,
'ttl' => 'int64',
'alternative_record_entries' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'label' => false,
'required' => false,
'record_type' => false,
'name' => false,
'record_entries' => false,
'ttl' => false,
'alternative_record_entries' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'label' => 'label',
'required' => 'required',
'record_type' => 'recordType',
'name' => 'name',
'record_entries' => 'recordEntries',
'ttl' => 'ttl',
'alternative_record_entries' => 'alternativeRecordEntries'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'label' => 'setLabel',
'required' => 'setRequired',
'record_type' => 'setRecordType',
'name' => 'setName',
'record_entries' => 'setRecordEntries',
'ttl' => 'setTtl',
'alternative_record_entries' => 'setAlternativeRecordEntries'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'label' => 'getLabel',
'required' => 'getRequired',
'record_type' => 'getRecordType',
'name' => 'getName',
'record_entries' => 'getRecordEntries',
'ttl' => 'getTtl',
'alternative_record_entries' => 'getAlternativeRecordEntries'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const LABEL_VERIFICATION = 'VERIFICATION';
public const LABEL_MX = 'MX';
public const LABEL_SPF = 'SPF';
public const LABEL_DKIM = 'DKIM';
public const LABEL_DMARC = 'DMARC';
public const RECORD_TYPE_A = 'A';
public const RECORD_TYPE_NS = 'NS';
public const RECORD_TYPE_MD = 'MD';
public const RECORD_TYPE_MF = 'MF';
public const RECORD_TYPE_CNAME = 'CNAME';
public const RECORD_TYPE_SOA = 'SOA';
public const RECORD_TYPE_MB = 'MB';
public const RECORD_TYPE_MG = 'MG';
public const RECORD_TYPE_MR = 'MR';
public const RECORD_TYPE_NULL = 'NULL';
public const RECORD_TYPE_WKS = 'WKS';
public const RECORD_TYPE_PTR = 'PTR';
public const RECORD_TYPE_HINFO = 'HINFO';
public const RECORD_TYPE_MINFO = 'MINFO';
public const RECORD_TYPE_MX = 'MX';
public const RECORD_TYPE_TXT = 'TXT';
public const RECORD_TYPE_RP = 'RP';
public const RECORD_TYPE_AFSDB = 'AFSDB';
public const RECORD_TYPE_X25 = 'X25';
public const RECORD_TYPE_ISDN = 'ISDN';
public const RECORD_TYPE_RT = 'RT';
public const RECORD_TYPE_NSAP = 'NSAP';
public const RECORD_TYPE_NSAP_PTR = 'NSAP_PTR';
public const RECORD_TYPE_SIG = 'SIG';
public const RECORD_TYPE_KEY = 'KEY';
public const RECORD_TYPE_PX = 'PX';
public const RECORD_TYPE_GPOS = 'GPOS';
public const RECORD_TYPE_AAAA = 'AAAA';
public const RECORD_TYPE_LOC = 'LOC';
public const RECORD_TYPE_NXT = 'NXT';
public const RECORD_TYPE_EID = 'EID';
public const RECORD_TYPE_NIMLOC = 'NIMLOC';
public const RECORD_TYPE_SRV = 'SRV';
public const RECORD_TYPE_ATMA = 'ATMA';
public const RECORD_TYPE_NAPTR = 'NAPTR';
public const RECORD_TYPE_KX = 'KX';
public const RECORD_TYPE_CERT = 'CERT';
public const RECORD_TYPE_A6 = 'A6';
public const RECORD_TYPE_DNAME = 'DNAME';
public const RECORD_TYPE_SINK = 'SINK';
public const RECORD_TYPE_OPT = 'OPT';
public const RECORD_TYPE_APL = 'APL';
public const RECORD_TYPE_DS = 'DS';
public const RECORD_TYPE_SSHFP = 'SSHFP';
public const RECORD_TYPE_IPSECKEY = 'IPSECKEY';
public const RECORD_TYPE_RRSIG = 'RRSIG';
public const RECORD_TYPE_NSEC = 'NSEC';
public const RECORD_TYPE_DNSKEY = 'DNSKEY';
public const RECORD_TYPE_DHCID = 'DHCID';
public const RECORD_TYPE_NSEC3 = 'NSEC3';
public const RECORD_TYPE_NSEC3_PARAM = 'NSEC3PARAM';
public const RECORD_TYPE_TLSA = 'TLSA';
public const RECORD_TYPE_SMIMEA = 'SMIMEA';
public const RECORD_TYPE_HIP = 'HIP';
public const RECORD_TYPE_NINFO = 'NINFO';
public const RECORD_TYPE_RKEY = 'RKEY';
public const RECORD_TYPE_TALINK = 'TALINK';
public const RECORD_TYPE_CDS = 'CDS';
public const RECORD_TYPE_CDNSKEY = 'CDNSKEY';
public const RECORD_TYPE_OPENPGPKEY = 'OPENPGPKEY';
public const RECORD_TYPE_CSYNC = 'CSYNC';
public const RECORD_TYPE_ZONEMD = 'ZONEMD';
public const RECORD_TYPE_SVCB = 'SVCB';
public const RECORD_TYPE_HTTPS = 'HTTPS';
public const RECORD_TYPE_SPF = 'SPF';
public const RECORD_TYPE_UINFO = 'UINFO';
public const RECORD_TYPE_UID = 'UID';
public const RECORD_TYPE_GID = 'GID';
public const RECORD_TYPE_UNSPEC = 'UNSPEC';
public const RECORD_TYPE_NID = 'NID';
public const RECORD_TYPE_L32 = 'L32';
public const RECORD_TYPE_L64 = 'L64';
public const RECORD_TYPE_LP = 'LP';
public const RECORD_TYPE_EUI48 = 'EUI48';
public const RECORD_TYPE_EUI64 = 'EUI64';
public const RECORD_TYPE_TKEY = 'TKEY';
public const RECORD_TYPE_TSIG = 'TSIG';
public const RECORD_TYPE_IXFR = 'IXFR';
public const RECORD_TYPE_AXFR = 'AXFR';
public const RECORD_TYPE_MAILB = 'MAILB';
public const RECORD_TYPE_MAILA = 'MAILA';
public const RECORD_TYPE_ANY = 'ANY';
public const RECORD_TYPE_URI = 'URI';
public const RECORD_TYPE_CAA = 'CAA';
public const RECORD_TYPE_AVC = 'AVC';
public const RECORD_TYPE_DOA = 'DOA';
public const RECORD_TYPE_AMTRELAY = 'AMTRELAY';
public const RECORD_TYPE_TA = 'TA';
public const RECORD_TYPE_DLV = 'DLV';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getLabelAllowableValues()
{
return [
self::LABEL_VERIFICATION,
self::LABEL_MX,
self::LABEL_SPF,
self::LABEL_DKIM,
self::LABEL_DMARC,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getRecordTypeAllowableValues()
{
return [
self::RECORD_TYPE_A,
self::RECORD_TYPE_NS,
self::RECORD_TYPE_MD,
self::RECORD_TYPE_MF,
self::RECORD_TYPE_CNAME,
self::RECORD_TYPE_SOA,
self::RECORD_TYPE_MB,
self::RECORD_TYPE_MG,
self::RECORD_TYPE_MR,
self::RECORD_TYPE_NULL,
self::RECORD_TYPE_WKS,
self::RECORD_TYPE_PTR,
self::RECORD_TYPE_HINFO,
self::RECORD_TYPE_MINFO,
self::RECORD_TYPE_MX,
self::RECORD_TYPE_TXT,
self::RECORD_TYPE_RP,
self::RECORD_TYPE_AFSDB,
self::RECORD_TYPE_X25,
self::RECORD_TYPE_ISDN,
self::RECORD_TYPE_RT,
self::RECORD_TYPE_NSAP,
self::RECORD_TYPE_NSAP_PTR,
self::RECORD_TYPE_SIG,
self::RECORD_TYPE_KEY,
self::RECORD_TYPE_PX,
self::RECORD_TYPE_GPOS,
self::RECORD_TYPE_AAAA,
self::RECORD_TYPE_LOC,
self::RECORD_TYPE_NXT,
self::RECORD_TYPE_EID,
self::RECORD_TYPE_NIMLOC,
self::RECORD_TYPE_SRV,
self::RECORD_TYPE_ATMA,
self::RECORD_TYPE_NAPTR,
self::RECORD_TYPE_KX,
self::RECORD_TYPE_CERT,
self::RECORD_TYPE_A6,
self::RECORD_TYPE_DNAME,
self::RECORD_TYPE_SINK,
self::RECORD_TYPE_OPT,
self::RECORD_TYPE_APL,
self::RECORD_TYPE_DS,
self::RECORD_TYPE_SSHFP,
self::RECORD_TYPE_IPSECKEY,
self::RECORD_TYPE_RRSIG,
self::RECORD_TYPE_NSEC,
self::RECORD_TYPE_DNSKEY,
self::RECORD_TYPE_DHCID,
self::RECORD_TYPE_NSEC3,
self::RECORD_TYPE_NSEC3_PARAM,
self::RECORD_TYPE_TLSA,
self::RECORD_TYPE_SMIMEA,
self::RECORD_TYPE_HIP,
self::RECORD_TYPE_NINFO,
self::RECORD_TYPE_RKEY,
self::RECORD_TYPE_TALINK,
self::RECORD_TYPE_CDS,
self::RECORD_TYPE_CDNSKEY,
self::RECORD_TYPE_OPENPGPKEY,
self::RECORD_TYPE_CSYNC,
self::RECORD_TYPE_ZONEMD,
self::RECORD_TYPE_SVCB,
self::RECORD_TYPE_HTTPS,
self::RECORD_TYPE_SPF,
self::RECORD_TYPE_UINFO,
self::RECORD_TYPE_UID,
self::RECORD_TYPE_GID,
self::RECORD_TYPE_UNSPEC,
self::RECORD_TYPE_NID,
self::RECORD_TYPE_L32,
self::RECORD_TYPE_L64,
self::RECORD_TYPE_LP,
self::RECORD_TYPE_EUI48,
self::RECORD_TYPE_EUI64,
self::RECORD_TYPE_TKEY,
self::RECORD_TYPE_TSIG,
self::RECORD_TYPE_IXFR,
self::RECORD_TYPE_AXFR,
self::RECORD_TYPE_MAILB,
self::RECORD_TYPE_MAILA,
self::RECORD_TYPE_ANY,
self::RECORD_TYPE_URI,
self::RECORD_TYPE_CAA,
self::RECORD_TYPE_AVC,
self::RECORD_TYPE_DOA,
self::RECORD_TYPE_AMTRELAY,
self::RECORD_TYPE_TA,
self::RECORD_TYPE_DLV,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('label', $data ?? [], null);
$this->setIfExists('required', $data ?? [], null);
$this->setIfExists('record_type', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('record_entries', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
$this->setIfExists('alternative_record_entries', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['label'] === null) {
$invalidProperties[] = "'label' can't be null";
}
$allowedValues = $this->getLabelAllowableValues();
if (!is_null($this->container['label']) && !in_array($this->container['label'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'label', must be one of '%s'",
$this->container['label'],
implode("', '", $allowedValues)
);
}
if ($this->container['required'] === null) {
$invalidProperties[] = "'required' can't be null";
}
if ($this->container['record_type'] === null) {
$invalidProperties[] = "'record_type' can't be null";
}
$allowedValues = $this->getRecordTypeAllowableValues();
if (!is_null($this->container['record_type']) && !in_array($this->container['record_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'record_type', must be one of '%s'",
$this->container['record_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['record_entries'] === null) {
$invalidProperties[] = "'record_entries' can't be null";
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets label
*
* @return string
*/
public function getLabel()
{
return $this->container['label'];
}
/**
* Sets label
*
* @param string $label Domain Name Server Record Label
*
* @return self
*/
public function setLabel($label)
{
$allowedValues = $this->getLabelAllowableValues();
if (!in_array($label, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'label', must be one of '%s'",
$label,
implode("', '", $allowedValues)
)
);
}
if (is_null($label)) {
throw new \InvalidArgumentException('non-nullable label cannot be null');
}
$this->container['label'] = $label;
return $this;
}
/**
* Gets required
*
* @return bool
*/
public function getRequired()
{
return $this->container['required'];
}
/**
* Sets required
*
* @param bool $required required
*
* @return self
*/
public function setRequired($required)
{
if (is_null($required)) {
throw new \InvalidArgumentException('non-nullable required cannot be null');
}
$this->container['required'] = $required;
return $this;
}
/**
* Gets record_type
*
* @return string
*/
public function getRecordType()
{
return $this->container['record_type'];
}
/**
* Sets record_type
*
* @param string $record_type Domain Name Server Record Types
*
* @return self
*/
public function setRecordType($record_type)
{
$allowedValues = $this->getRecordTypeAllowableValues();
if (!in_array($record_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'record_type', must be one of '%s'",
$record_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($record_type)) {
throw new \InvalidArgumentException('non-nullable record_type cannot be null');
}
$this->container['record_type'] = $record_type;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets record_entries
*
* @return string[]
*/
public function getRecordEntries()
{
return $this->container['record_entries'];
}
/**
* Sets record_entries
*
* @param string[] $record_entries record_entries
*
* @return self
*/
public function setRecordEntries($record_entries)
{
if (is_null($record_entries)) {
throw new \InvalidArgumentException('non-nullable record_entries cannot be null');
}
$this->container['record_entries'] = $record_entries;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Gets alternative_record_entries
*
* @return string[]|null
*/
public function getAlternativeRecordEntries()
{
return $this->container['alternative_record_entries'];
}
/**
* Sets alternative_record_entries
*
* @param string[]|null $alternative_record_entries alternative_record_entries
*
* @return self
*/
public function setAlternativeRecordEntries($alternative_record_entries)
{
if (is_null($alternative_record_entries)) {
array_push($this->openAPINullablesSetToNull, 'alternative_record_entries');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('alternative_record_entries', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['alternative_record_entries'] = $alternative_record_entries;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DomainIssuesDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DomainIssuesDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DomainIssuesDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DomainIssuesDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'has_issues' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'has_issues' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'has_issues' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'has_issues' => 'hasIssues'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'has_issues' => 'setHasIssues'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'has_issues' => 'getHasIssues'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('has_issues', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['has_issues'] === null) {
$invalidProperties[] = "'has_issues' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets has_issues
*
* @return bool
*/
public function getHasIssues()
{
return $this->container['has_issues'];
}
/**
* Sets has_issues
*
* @param bool $has_issues has_issues
*
* @return self
*/
public function setHasIssues($has_issues)
{
if (is_null($has_issues)) {
throw new \InvalidArgumentException('non-nullable has_issues cannot be null');
}
$this->container['has_issues'] = $has_issues;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DomainInformation
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DomainInformation Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DomainInformation implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DomainInformation';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'domain_name' => 'string',
'verified' => 'bool',
'domain_type' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'domain_name' => null,
'verified' => null,
'domain_type' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'domain_name' => false,
'verified' => false,
'domain_type' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'domain_name' => 'domainName',
'verified' => 'verified',
'domain_type' => 'domainType'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'domain_name' => 'setDomainName',
'verified' => 'setVerified',
'domain_type' => 'setDomainType'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'domain_name' => 'getDomainName',
'verified' => 'getVerified',
'domain_type' => 'getDomainType'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const DOMAIN_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const DOMAIN_TYPE_SMTP_DOMAIN = 'SMTP_DOMAIN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getDomainTypeAllowableValues()
{
return [
self::DOMAIN_TYPE_HTTP_INBOX,
self::DOMAIN_TYPE_SMTP_DOMAIN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('domain_name', $data ?? [], null);
$this->setIfExists('verified', $data ?? [], null);
$this->setIfExists('domain_type', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['domain_name'] === null) {
$invalidProperties[] = "'domain_name' can't be null";
}
if ($this->container['verified'] === null) {
$invalidProperties[] = "'verified' can't be null";
}
if ($this->container['domain_type'] === null) {
$invalidProperties[] = "'domain_type' can't be null";
}
$allowedValues = $this->getDomainTypeAllowableValues();
if (!is_null($this->container['domain_type']) && !in_array($this->container['domain_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'domain_type', must be one of '%s'",
$this->container['domain_type'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets domain_name
*
* @return string
*/
public function getDomainName()
{
return $this->container['domain_name'];
}
/**
* Sets domain_name
*
* @param string $domain_name domain_name
*
* @return self
*/
public function setDomainName($domain_name)
{
if (is_null($domain_name)) {
throw new \InvalidArgumentException('non-nullable domain_name cannot be null');
}
$this->container['domain_name'] = $domain_name;
return $this;
}
/**
* Gets verified
*
* @return bool
*/
public function getVerified()
{
return $this->container['verified'];
}
/**
* Sets verified
*
* @param bool $verified verified
*
* @return self
*/
public function setVerified($verified)
{
if (is_null($verified)) {
throw new \InvalidArgumentException('non-nullable verified cannot be null');
}
$this->container['verified'] = $verified;
return $this;
}
/**
* Gets domain_type
*
* @return string
*/
public function getDomainType()
{
return $this->container['domain_type'];
}
/**
* Sets domain_type
*
* @param string $domain_type Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails.
*
* @return self
*/
public function setDomainType($domain_type)
{
$allowedValues = $this->getDomainTypeAllowableValues();
if (!in_array($domain_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'domain_type', must be one of '%s'",
$domain_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($domain_type)) {
throw new \InvalidArgumentException('non-nullable domain_type cannot be null');
}
$this->container['domain_type'] = $domain_type;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DomainGroupsDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DomainGroupsDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DomainGroupsDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DomainGroupsDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'domain_groups' => '\MailSlurp\Models\DomainGroup[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'domain_groups' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'domain_groups' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'domain_groups' => 'domainGroups'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'domain_groups' => 'setDomainGroups'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'domain_groups' => 'getDomainGroups'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('domain_groups', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['domain_groups'] === null) {
$invalidProperties[] = "'domain_groups' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets domain_groups
*
* @return \MailSlurp\Models\DomainGroup[]
*/
public function getDomainGroups()
{
return $this->container['domain_groups'];
}
/**
* Sets domain_groups
*
* @param \MailSlurp\Models\DomainGroup[] $domain_groups domain_groups
*
* @return self
*/
public function setDomainGroups($domain_groups)
{
if (is_null($domain_groups)) {
throw new \InvalidArgumentException('non-nullable domain_groups cannot be null');
}
$this->container['domain_groups'] = $domain_groups;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DomainGroup
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DomainGroup Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DomainGroup implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DomainGroup';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'label' => 'string',
'domains' => '\MailSlurp\Models\DomainInformation[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'label' => null,
'domains' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'label' => false,
'domains' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'label' => 'label',
'domains' => 'domains'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'label' => 'setLabel',
'domains' => 'setDomains'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'label' => 'getLabel',
'domains' => 'getDomains'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const LABEL__DEFAULT = 'DEFAULT';
public const LABEL_DOMAIN_POOL = 'DOMAIN_POOL';
public const LABEL_CUSTOM = 'CUSTOM';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getLabelAllowableValues()
{
return [
self::LABEL__DEFAULT,
self::LABEL_DOMAIN_POOL,
self::LABEL_CUSTOM,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('label', $data ?? [], null);
$this->setIfExists('domains', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['label'] === null) {
$invalidProperties[] = "'label' can't be null";
}
$allowedValues = $this->getLabelAllowableValues();
if (!is_null($this->container['label']) && !in_array($this->container['label'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'label', must be one of '%s'",
$this->container['label'],
implode("', '", $allowedValues)
);
}
if ($this->container['domains'] === null) {
$invalidProperties[] = "'domains' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets label
*
* @return string
*/
public function getLabel()
{
return $this->container['label'];
}
/**
* Sets label
*
* @param string $label label
*
* @return self
*/
public function setLabel($label)
{
$allowedValues = $this->getLabelAllowableValues();
if (!in_array($label, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'label', must be one of '%s'",
$label,
implode("', '", $allowedValues)
)
);
}
if (is_null($label)) {
throw new \InvalidArgumentException('non-nullable label cannot be null');
}
$this->container['label'] = $label;
return $this;
}
/**
* Gets domains
*
* @return \MailSlurp\Models\DomainInformation[]
*/
public function getDomains()
{
return $this->container['domains'];
}
/**
* Sets domains
*
* @param \MailSlurp\Models\DomainInformation[] $domains domains
*
* @return self
*/
public function setDomains($domains)
{
if (is_null($domains)) {
throw new \InvalidArgumentException('non-nullable domains cannot be null');
}
$this->container['domains'] = $domains;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DomainDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DomainDto Class Doc Comment
*
* @category Class
* @description Domain plus verification records and status
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DomainDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DomainDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'domain' => 'string',
'verification_token' => 'string',
'dkim_tokens' => 'string[]',
'missing_records_message' => 'string',
'has_missing_records' => 'bool',
'is_verified' => 'bool',
'domain_name_records' => '\MailSlurp\Models\DomainNameRecord[]',
'catch_all_inbox_id' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'domain_type' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'domain' => null,
'verification_token' => null,
'dkim_tokens' => null,
'missing_records_message' => null,
'has_missing_records' => null,
'is_verified' => null,
'domain_name_records' => null,
'catch_all_inbox_id' => 'uuid',
'created_at' => 'date-time',
'updated_at' => 'date-time',
'domain_type' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'domain' => false,
'verification_token' => false,
'dkim_tokens' => false,
'missing_records_message' => true,
'has_missing_records' => false,
'is_verified' => false,
'domain_name_records' => false,
'catch_all_inbox_id' => true,
'created_at' => false,
'updated_at' => false,
'domain_type' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'domain' => 'domain',
'verification_token' => 'verificationToken',
'dkim_tokens' => 'dkimTokens',
'missing_records_message' => 'missingRecordsMessage',
'has_missing_records' => 'hasMissingRecords',
'is_verified' => 'isVerified',
'domain_name_records' => 'domainNameRecords',
'catch_all_inbox_id' => 'catchAllInboxId',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'domain_type' => 'domainType'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'domain' => 'setDomain',
'verification_token' => 'setVerificationToken',
'dkim_tokens' => 'setDkimTokens',
'missing_records_message' => 'setMissingRecordsMessage',
'has_missing_records' => 'setHasMissingRecords',
'is_verified' => 'setIsVerified',
'domain_name_records' => 'setDomainNameRecords',
'catch_all_inbox_id' => 'setCatchAllInboxId',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'domain_type' => 'setDomainType'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'domain' => 'getDomain',
'verification_token' => 'getVerificationToken',
'dkim_tokens' => 'getDkimTokens',
'missing_records_message' => 'getMissingRecordsMessage',
'has_missing_records' => 'getHasMissingRecords',
'is_verified' => 'getIsVerified',
'domain_name_records' => 'getDomainNameRecords',
'catch_all_inbox_id' => 'getCatchAllInboxId',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'domain_type' => 'getDomainType'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const DOMAIN_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const DOMAIN_TYPE_SMTP_DOMAIN = 'SMTP_DOMAIN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getDomainTypeAllowableValues()
{
return [
self::DOMAIN_TYPE_HTTP_INBOX,
self::DOMAIN_TYPE_SMTP_DOMAIN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('domain', $data ?? [], null);
$this->setIfExists('verification_token', $data ?? [], null);
$this->setIfExists('dkim_tokens', $data ?? [], null);
$this->setIfExists('missing_records_message', $data ?? [], null);
$this->setIfExists('has_missing_records', $data ?? [], null);
$this->setIfExists('is_verified', $data ?? [], null);
$this->setIfExists('domain_name_records', $data ?? [], null);
$this->setIfExists('catch_all_inbox_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('domain_type', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['domain'] === null) {
$invalidProperties[] = "'domain' can't be null";
}
if ($this->container['verification_token'] === null) {
$invalidProperties[] = "'verification_token' can't be null";
}
if ($this->container['dkim_tokens'] === null) {
$invalidProperties[] = "'dkim_tokens' can't be null";
}
if ($this->container['has_missing_records'] === null) {
$invalidProperties[] = "'has_missing_records' can't be null";
}
if ($this->container['is_verified'] === null) {
$invalidProperties[] = "'is_verified' can't be null";
}
if ($this->container['domain_name_records'] === null) {
$invalidProperties[] = "'domain_name_records' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['domain_type'] === null) {
$invalidProperties[] = "'domain_type' can't be null";
}
$allowedValues = $this->getDomainTypeAllowableValues();
if (!is_null($this->container['domain_type']) && !in_array($this->container['domain_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'domain_type', must be one of '%s'",
$this->container['domain_type'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets domain
*
* @return string
*/
public function getDomain()
{
return $this->container['domain'];
}
/**
* Sets domain
*
* @param string $domain Custom domain name
*
* @return self
*/
public function setDomain($domain)
{
if (is_null($domain)) {
throw new \InvalidArgumentException('non-nullable domain cannot be null');
}
$this->container['domain'] = $domain;
return $this;
}
/**
* Gets verification_token
*
* @return string
*/
public function getVerificationToken()
{
return $this->container['verification_token'];
}
/**
* Sets verification_token
*
* @param string $verification_token Verification tokens
*
* @return self
*/
public function setVerificationToken($verification_token)
{
if (is_null($verification_token)) {
throw new \InvalidArgumentException('non-nullable verification_token cannot be null');
}
$this->container['verification_token'] = $verification_token;
return $this;
}
/**
* Gets dkim_tokens
*
* @return string[]
*/
public function getDkimTokens()
{
return $this->container['dkim_tokens'];
}
/**
* Sets dkim_tokens
*
* @param string[] $dkim_tokens Unique token DKIM tokens
*
* @return self
*/
public function setDkimTokens($dkim_tokens)
{
if (is_null($dkim_tokens)) {
throw new \InvalidArgumentException('non-nullable dkim_tokens cannot be null');
}
$this->container['dkim_tokens'] = $dkim_tokens;
return $this;
}
/**
* Gets missing_records_message
*
* @return string|null
*/
public function getMissingRecordsMessage()
{
return $this->container['missing_records_message'];
}
/**
* Sets missing_records_message
*
* @param string|null $missing_records_message If the domain is missing records then show which pairs are missing.
*
* @return self
*/
public function setMissingRecordsMessage($missing_records_message)
{
if (is_null($missing_records_message)) {
array_push($this->openAPINullablesSetToNull, 'missing_records_message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('missing_records_message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['missing_records_message'] = $missing_records_message;
return $this;
}
/**
* Gets has_missing_records
*
* @return bool
*/
public function getHasMissingRecords()
{
return $this->container['has_missing_records'];
}
/**
* Sets has_missing_records
*
* @param bool $has_missing_records Whether the domain has missing required records. If true then see the domain in the dashboard app.
*
* @return self
*/
public function setHasMissingRecords($has_missing_records)
{
if (is_null($has_missing_records)) {
throw new \InvalidArgumentException('non-nullable has_missing_records cannot be null');
}
$this->container['has_missing_records'] = $has_missing_records;
return $this;
}
/**
* Gets is_verified
*
* @return bool
*/
public function getIsVerified()
{
return $this->container['is_verified'];
}
/**
* Sets is_verified
*
* @param bool $is_verified Whether domain has been verified or not. If the domain is not verified after 72 hours there is most likely an issue with the domains DNS records.
*
* @return self
*/
public function setIsVerified($is_verified)
{
if (is_null($is_verified)) {
throw new \InvalidArgumentException('non-nullable is_verified cannot be null');
}
$this->container['is_verified'] = $is_verified;
return $this;
}
/**
* Gets domain_name_records
*
* @return \MailSlurp\Models\DomainNameRecord[]
*/
public function getDomainNameRecords()
{
return $this->container['domain_name_records'];
}
/**
* Sets domain_name_records
*
* @param \MailSlurp\Models\DomainNameRecord[] $domain_name_records List of DNS domain name records (C, MX, TXT) etc that you must add to the DNS server associated with your domain provider.
*
* @return self
*/
public function setDomainNameRecords($domain_name_records)
{
if (is_null($domain_name_records)) {
throw new \InvalidArgumentException('non-nullable domain_name_records cannot be null');
}
$this->container['domain_name_records'] = $domain_name_records;
return $this;
}
/**
* Gets catch_all_inbox_id
*
* @return string|null
*/
public function getCatchAllInboxId()
{
return $this->container['catch_all_inbox_id'];
}
/**
* Sets catch_all_inbox_id
*
* @param string|null $catch_all_inbox_id The optional catch all inbox that will receive emails sent to the domain that cannot be matched.
*
* @return self
*/
public function setCatchAllInboxId($catch_all_inbox_id)
{
if (is_null($catch_all_inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'catch_all_inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('catch_all_inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['catch_all_inbox_id'] = $catch_all_inbox_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets domain_type
*
* @return string
*/
public function getDomainType()
{
return $this->container['domain_type'];
}
/**
* Sets domain_type
*
* @param string $domain_type Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails.
*
* @return self
*/
public function setDomainType($domain_type)
{
$allowedValues = $this->getDomainTypeAllowableValues();
if (!in_array($domain_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'domain_type', must be one of '%s'",
$domain_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($domain_type)) {
throw new \InvalidArgumentException('non-nullable domain_type cannot be null');
}
$this->container['domain_type'] = $domain_type;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DescribeMailServerDomainResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DescribeMailServerDomainResult Class Doc Comment
*
* @category Class
* @description Name Server lookup result
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DescribeMailServerDomainResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DescribeMailServerDomainResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'mx_records' => '\MailSlurp\Models\NameServerRecord[]',
'domain' => 'string',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'mx_records' => null,
'domain' => null,
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'mx_records' => false,
'domain' => false,
'message' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'mx_records' => 'mxRecords',
'domain' => 'domain',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'mx_records' => 'setMxRecords',
'domain' => 'setDomain',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'mx_records' => 'getMxRecords',
'domain' => 'getDomain',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('mx_records', $data ?? [], null);
$this->setIfExists('domain', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['mx_records'] === null) {
$invalidProperties[] = "'mx_records' can't be null";
}
if ($this->container['domain'] === null) {
$invalidProperties[] = "'domain' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets mx_records
*
* @return \MailSlurp\Models\NameServerRecord[]
*/
public function getMxRecords()
{
return $this->container['mx_records'];
}
/**
* Sets mx_records
*
* @param \MailSlurp\Models\NameServerRecord[] $mx_records mx_records
*
* @return self
*/
public function setMxRecords($mx_records)
{
if (is_null($mx_records)) {
throw new \InvalidArgumentException('non-nullable mx_records cannot be null');
}
$this->container['mx_records'] = $mx_records;
return $this;
}
/**
* Gets domain
*
* @return string
*/
public function getDomain()
{
return $this->container['domain'];
}
/**
* Sets domain
*
* @param string $domain domain
*
* @return self
*/
public function setDomain($domain)
{
if (is_null($domain)) {
throw new \InvalidArgumentException('non-nullable domain cannot be null');
}
$this->container['domain'] = $domain;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
array_push($this->openAPINullablesSetToNull, 'message');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('message', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DescribeDomainOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DescribeDomainOptions Class Doc Comment
*
* @category Class
* @description Domain record description
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DescribeDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DescribeDomainOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'domain' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'domain' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'domain' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'domain' => 'domain'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'domain' => 'setDomain'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'domain' => 'getDomain'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('domain', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['domain'] === null) {
$invalidProperties[] = "'domain' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets domain
*
* @return string
*/
public function getDomain()
{
return $this->container['domain'];
}
/**
* Sets domain
*
* @param string $domain domain
*
* @return self
*/
public function setDomain($domain)
{
if (is_null($domain)) {
throw new \InvalidArgumentException('non-nullable domain cannot be null');
}
$this->container['domain'] = $domain;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DeliveryStatusDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DeliveryStatusDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DeliveryStatusDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DeliveryStatusDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'sent_id' => 'string',
'remote_mta_ip' => 'string',
'inbox_id' => 'string',
'reporting_mta' => 'string',
'recipients' => 'string[]',
'smtp_response' => 'string',
'smtp_status_code' => 'int',
'processing_time_millis' => 'int',
'received' => '\DateTime',
'subject' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'sent_id' => 'uuid',
'remote_mta_ip' => null,
'inbox_id' => 'uuid',
'reporting_mta' => null,
'recipients' => null,
'smtp_response' => null,
'smtp_status_code' => 'int32',
'processing_time_millis' => 'int64',
'received' => 'date-time',
'subject' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'sent_id' => false,
'remote_mta_ip' => false,
'inbox_id' => false,
'reporting_mta' => false,
'recipients' => false,
'smtp_response' => false,
'smtp_status_code' => false,
'processing_time_millis' => false,
'received' => false,
'subject' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'sent_id' => 'sentId',
'remote_mta_ip' => 'remoteMtaIp',
'inbox_id' => 'inboxId',
'reporting_mta' => 'reportingMta',
'recipients' => 'recipients',
'smtp_response' => 'smtpResponse',
'smtp_status_code' => 'smtpStatusCode',
'processing_time_millis' => 'processingTimeMillis',
'received' => 'received',
'subject' => 'subject',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'sent_id' => 'setSentId',
'remote_mta_ip' => 'setRemoteMtaIp',
'inbox_id' => 'setInboxId',
'reporting_mta' => 'setReportingMta',
'recipients' => 'setRecipients',
'smtp_response' => 'setSmtpResponse',
'smtp_status_code' => 'setSmtpStatusCode',
'processing_time_millis' => 'setProcessingTimeMillis',
'received' => 'setReceived',
'subject' => 'setSubject',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'sent_id' => 'getSentId',
'remote_mta_ip' => 'getRemoteMtaIp',
'inbox_id' => 'getInboxId',
'reporting_mta' => 'getReportingMta',
'recipients' => 'getRecipients',
'smtp_response' => 'getSmtpResponse',
'smtp_status_code' => 'getSmtpStatusCode',
'processing_time_millis' => 'getProcessingTimeMillis',
'received' => 'getReceived',
'subject' => 'getSubject',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('sent_id', $data ?? [], null);
$this->setIfExists('remote_mta_ip', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('reporting_mta', $data ?? [], null);
$this->setIfExists('recipients', $data ?? [], null);
$this->setIfExists('smtp_response', $data ?? [], null);
$this->setIfExists('smtp_status_code', $data ?? [], null);
$this->setIfExists('processing_time_millis', $data ?? [], null);
$this->setIfExists('received', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets sent_id
*
* @return string|null
*/
public function getSentId()
{
return $this->container['sent_id'];
}
/**
* Sets sent_id
*
* @param string|null $sent_id sent_id
*
* @return self
*/
public function setSentId($sent_id)
{
if (is_null($sent_id)) {
throw new \InvalidArgumentException('non-nullable sent_id cannot be null');
}
$this->container['sent_id'] = $sent_id;
return $this;
}
/**
* Gets remote_mta_ip
*
* @return string|null
*/
public function getRemoteMtaIp()
{
return $this->container['remote_mta_ip'];
}
/**
* Sets remote_mta_ip
*
* @param string|null $remote_mta_ip remote_mta_ip
*
* @return self
*/
public function setRemoteMtaIp($remote_mta_ip)
{
if (is_null($remote_mta_ip)) {
throw new \InvalidArgumentException('non-nullable remote_mta_ip cannot be null');
}
$this->container['remote_mta_ip'] = $remote_mta_ip;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets reporting_mta
*
* @return string|null
*/
public function getReportingMta()
{
return $this->container['reporting_mta'];
}
/**
* Sets reporting_mta
*
* @param string|null $reporting_mta reporting_mta
*
* @return self
*/
public function setReportingMta($reporting_mta)
{
if (is_null($reporting_mta)) {
throw new \InvalidArgumentException('non-nullable reporting_mta cannot be null');
}
$this->container['reporting_mta'] = $reporting_mta;
return $this;
}
/**
* Gets recipients
*
* @return string[]|null
*/
public function getRecipients()
{
return $this->container['recipients'];
}
/**
* Sets recipients
*
* @param string[]|null $recipients recipients
*
* @return self
*/
public function setRecipients($recipients)
{
if (is_null($recipients)) {
throw new \InvalidArgumentException('non-nullable recipients cannot be null');
}
$this->container['recipients'] = $recipients;
return $this;
}
/**
* Gets smtp_response
*
* @return string|null
*/
public function getSmtpResponse()
{
return $this->container['smtp_response'];
}
/**
* Sets smtp_response
*
* @param string|null $smtp_response smtp_response
*
* @return self
*/
public function setSmtpResponse($smtp_response)
{
if (is_null($smtp_response)) {
throw new \InvalidArgumentException('non-nullable smtp_response cannot be null');
}
$this->container['smtp_response'] = $smtp_response;
return $this;
}
/**
* Gets smtp_status_code
*
* @return int|null
*/
public function getSmtpStatusCode()
{
return $this->container['smtp_status_code'];
}
/**
* Sets smtp_status_code
*
* @param int|null $smtp_status_code smtp_status_code
*
* @return self
*/
public function setSmtpStatusCode($smtp_status_code)
{
if (is_null($smtp_status_code)) {
throw new \InvalidArgumentException('non-nullable smtp_status_code cannot be null');
}
$this->container['smtp_status_code'] = $smtp_status_code;
return $this;
}
/**
* Gets processing_time_millis
*
* @return int|null
*/
public function getProcessingTimeMillis()
{
return $this->container['processing_time_millis'];
}
/**
* Sets processing_time_millis
*
* @param int|null $processing_time_millis processing_time_millis
*
* @return self
*/
public function setProcessingTimeMillis($processing_time_millis)
{
if (is_null($processing_time_millis)) {
throw new \InvalidArgumentException('non-nullable processing_time_millis cannot be null');
}
$this->container['processing_time_millis'] = $processing_time_millis;
return $this;
}
/**
* Gets received
*
* @return \DateTime|null
*/
public function getReceived()
{
return $this->container['received'];
}
/**
* Sets received
*
* @param \DateTime|null $received received
*
* @return self
*/
public function setReceived($received)
{
if (is_null($received)) {
throw new \InvalidArgumentException('non-nullable received cannot be null');
}
$this->container['received'] = $received;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
throw new \InvalidArgumentException('non-nullable subject cannot be null');
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DNSLookupsOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DNSLookupsOptions Class Doc Comment
*
* @category Class
* @description Options for multiple DNS queries
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DNSLookupsOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DNSLookupsOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'lookups' => '\MailSlurp\Models\DNSLookupOptions[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'lookups' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'lookups' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'lookups' => 'lookups'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'lookups' => 'setLookups'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'lookups' => 'getLookups'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('lookups', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['lookups'] === null) {
$invalidProperties[] = "'lookups' can't be null";
}
if ((count($this->container['lookups']) > 10)) {
$invalidProperties[] = "invalid value for 'lookups', number of items must be less than or equal to 10.";
}
if ((count($this->container['lookups']) < 1)) {
$invalidProperties[] = "invalid value for 'lookups', number of items must be greater than or equal to 1.";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets lookups
*
* @return \MailSlurp\Models\DNSLookupOptions[]
*/
public function getLookups()
{
return $this->container['lookups'];
}
/**
* Sets lookups
*
* @param \MailSlurp\Models\DNSLookupOptions[] $lookups lookups
*
* @return self
*/
public function setLookups($lookups)
{
if ((count($lookups) > 10)) {
throw new \InvalidArgumentException('invalid value for $lookups when calling DNSLookupsOptions., number of items must be less than or equal to 10.');
}
if ((count($lookups) < 1)) {
throw new \InvalidArgumentException('invalid length for $lookups when calling DNSLookupsOptions., number of items must be greater than or equal to 1.');
}
if (is_null($lookups)) {
throw new \InvalidArgumentException('non-nullable lookups cannot be null');
}
$this->container['lookups'] = $lookups;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DNSLookupResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DNSLookupResults Class Doc Comment
*
* @category Class
* @description Results of query on domain name servers
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DNSLookupResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DNSLookupResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'results' => '\MailSlurp\Models\DNSLookupResult[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'results' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'results' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'results' => 'results'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'results' => 'setResults'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'results' => 'getResults'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('results', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['results'] === null) {
$invalidProperties[] = "'results' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets results
*
* @return \MailSlurp\Models\DNSLookupResult[]
*/
public function getResults()
{
return $this->container['results'];
}
/**
* Sets results
*
* @param \MailSlurp\Models\DNSLookupResult[] $results results
*
* @return self
*/
public function setResults($results)
{
if (is_null($results)) {
throw new \InvalidArgumentException('non-nullable results cannot be null');
}
$this->container['results'] = $results;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DNSLookupResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DNSLookupResult Class Doc Comment
*
* @category Class
* @description DNS lookup result. Includes record type, time to live, raw response, and name value for the name server response.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DNSLookupResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DNSLookupResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'record_type' => 'string',
'ttl' => 'int',
'record_entries' => 'string[]',
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'record_type' => null,
'ttl' => 'int64',
'record_entries' => null,
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'record_type' => false,
'ttl' => false,
'record_entries' => false,
'name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'record_type' => 'recordType',
'ttl' => 'ttl',
'record_entries' => 'recordEntries',
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'record_type' => 'setRecordType',
'ttl' => 'setTtl',
'record_entries' => 'setRecordEntries',
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'record_type' => 'getRecordType',
'ttl' => 'getTtl',
'record_entries' => 'getRecordEntries',
'name' => 'getName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const RECORD_TYPE_A = 'A';
public const RECORD_TYPE_NS = 'NS';
public const RECORD_TYPE_MD = 'MD';
public const RECORD_TYPE_MF = 'MF';
public const RECORD_TYPE_CNAME = 'CNAME';
public const RECORD_TYPE_SOA = 'SOA';
public const RECORD_TYPE_MB = 'MB';
public const RECORD_TYPE_MG = 'MG';
public const RECORD_TYPE_MR = 'MR';
public const RECORD_TYPE_NULL = 'NULL';
public const RECORD_TYPE_WKS = 'WKS';
public const RECORD_TYPE_PTR = 'PTR';
public const RECORD_TYPE_HINFO = 'HINFO';
public const RECORD_TYPE_MINFO = 'MINFO';
public const RECORD_TYPE_MX = 'MX';
public const RECORD_TYPE_TXT = 'TXT';
public const RECORD_TYPE_RP = 'RP';
public const RECORD_TYPE_AFSDB = 'AFSDB';
public const RECORD_TYPE_X25 = 'X25';
public const RECORD_TYPE_ISDN = 'ISDN';
public const RECORD_TYPE_RT = 'RT';
public const RECORD_TYPE_NSAP = 'NSAP';
public const RECORD_TYPE_NSAP_PTR = 'NSAP_PTR';
public const RECORD_TYPE_SIG = 'SIG';
public const RECORD_TYPE_KEY = 'KEY';
public const RECORD_TYPE_PX = 'PX';
public const RECORD_TYPE_GPOS = 'GPOS';
public const RECORD_TYPE_AAAA = 'AAAA';
public const RECORD_TYPE_LOC = 'LOC';
public const RECORD_TYPE_NXT = 'NXT';
public const RECORD_TYPE_EID = 'EID';
public const RECORD_TYPE_NIMLOC = 'NIMLOC';
public const RECORD_TYPE_SRV = 'SRV';
public const RECORD_TYPE_ATMA = 'ATMA';
public const RECORD_TYPE_NAPTR = 'NAPTR';
public const RECORD_TYPE_KX = 'KX';
public const RECORD_TYPE_CERT = 'CERT';
public const RECORD_TYPE_A6 = 'A6';
public const RECORD_TYPE_DNAME = 'DNAME';
public const RECORD_TYPE_SINK = 'SINK';
public const RECORD_TYPE_OPT = 'OPT';
public const RECORD_TYPE_APL = 'APL';
public const RECORD_TYPE_DS = 'DS';
public const RECORD_TYPE_SSHFP = 'SSHFP';
public const RECORD_TYPE_IPSECKEY = 'IPSECKEY';
public const RECORD_TYPE_RRSIG = 'RRSIG';
public const RECORD_TYPE_NSEC = 'NSEC';
public const RECORD_TYPE_DNSKEY = 'DNSKEY';
public const RECORD_TYPE_DHCID = 'DHCID';
public const RECORD_TYPE_NSEC3 = 'NSEC3';
public const RECORD_TYPE_NSEC3_PARAM = 'NSEC3PARAM';
public const RECORD_TYPE_TLSA = 'TLSA';
public const RECORD_TYPE_SMIMEA = 'SMIMEA';
public const RECORD_TYPE_HIP = 'HIP';
public const RECORD_TYPE_NINFO = 'NINFO';
public const RECORD_TYPE_RKEY = 'RKEY';
public const RECORD_TYPE_TALINK = 'TALINK';
public const RECORD_TYPE_CDS = 'CDS';
public const RECORD_TYPE_CDNSKEY = 'CDNSKEY';
public const RECORD_TYPE_OPENPGPKEY = 'OPENPGPKEY';
public const RECORD_TYPE_CSYNC = 'CSYNC';
public const RECORD_TYPE_ZONEMD = 'ZONEMD';
public const RECORD_TYPE_SVCB = 'SVCB';
public const RECORD_TYPE_HTTPS = 'HTTPS';
public const RECORD_TYPE_SPF = 'SPF';
public const RECORD_TYPE_UINFO = 'UINFO';
public const RECORD_TYPE_UID = 'UID';
public const RECORD_TYPE_GID = 'GID';
public const RECORD_TYPE_UNSPEC = 'UNSPEC';
public const RECORD_TYPE_NID = 'NID';
public const RECORD_TYPE_L32 = 'L32';
public const RECORD_TYPE_L64 = 'L64';
public const RECORD_TYPE_LP = 'LP';
public const RECORD_TYPE_EUI48 = 'EUI48';
public const RECORD_TYPE_EUI64 = 'EUI64';
public const RECORD_TYPE_TKEY = 'TKEY';
public const RECORD_TYPE_TSIG = 'TSIG';
public const RECORD_TYPE_IXFR = 'IXFR';
public const RECORD_TYPE_AXFR = 'AXFR';
public const RECORD_TYPE_MAILB = 'MAILB';
public const RECORD_TYPE_MAILA = 'MAILA';
public const RECORD_TYPE_ANY = 'ANY';
public const RECORD_TYPE_URI = 'URI';
public const RECORD_TYPE_CAA = 'CAA';
public const RECORD_TYPE_AVC = 'AVC';
public const RECORD_TYPE_DOA = 'DOA';
public const RECORD_TYPE_AMTRELAY = 'AMTRELAY';
public const RECORD_TYPE_TA = 'TA';
public const RECORD_TYPE_DLV = 'DLV';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getRecordTypeAllowableValues()
{
return [
self::RECORD_TYPE_A,
self::RECORD_TYPE_NS,
self::RECORD_TYPE_MD,
self::RECORD_TYPE_MF,
self::RECORD_TYPE_CNAME,
self::RECORD_TYPE_SOA,
self::RECORD_TYPE_MB,
self::RECORD_TYPE_MG,
self::RECORD_TYPE_MR,
self::RECORD_TYPE_NULL,
self::RECORD_TYPE_WKS,
self::RECORD_TYPE_PTR,
self::RECORD_TYPE_HINFO,
self::RECORD_TYPE_MINFO,
self::RECORD_TYPE_MX,
self::RECORD_TYPE_TXT,
self::RECORD_TYPE_RP,
self::RECORD_TYPE_AFSDB,
self::RECORD_TYPE_X25,
self::RECORD_TYPE_ISDN,
self::RECORD_TYPE_RT,
self::RECORD_TYPE_NSAP,
self::RECORD_TYPE_NSAP_PTR,
self::RECORD_TYPE_SIG,
self::RECORD_TYPE_KEY,
self::RECORD_TYPE_PX,
self::RECORD_TYPE_GPOS,
self::RECORD_TYPE_AAAA,
self::RECORD_TYPE_LOC,
self::RECORD_TYPE_NXT,
self::RECORD_TYPE_EID,
self::RECORD_TYPE_NIMLOC,
self::RECORD_TYPE_SRV,
self::RECORD_TYPE_ATMA,
self::RECORD_TYPE_NAPTR,
self::RECORD_TYPE_KX,
self::RECORD_TYPE_CERT,
self::RECORD_TYPE_A6,
self::RECORD_TYPE_DNAME,
self::RECORD_TYPE_SINK,
self::RECORD_TYPE_OPT,
self::RECORD_TYPE_APL,
self::RECORD_TYPE_DS,
self::RECORD_TYPE_SSHFP,
self::RECORD_TYPE_IPSECKEY,
self::RECORD_TYPE_RRSIG,
self::RECORD_TYPE_NSEC,
self::RECORD_TYPE_DNSKEY,
self::RECORD_TYPE_DHCID,
self::RECORD_TYPE_NSEC3,
self::RECORD_TYPE_NSEC3_PARAM,
self::RECORD_TYPE_TLSA,
self::RECORD_TYPE_SMIMEA,
self::RECORD_TYPE_HIP,
self::RECORD_TYPE_NINFO,
self::RECORD_TYPE_RKEY,
self::RECORD_TYPE_TALINK,
self::RECORD_TYPE_CDS,
self::RECORD_TYPE_CDNSKEY,
self::RECORD_TYPE_OPENPGPKEY,
self::RECORD_TYPE_CSYNC,
self::RECORD_TYPE_ZONEMD,
self::RECORD_TYPE_SVCB,
self::RECORD_TYPE_HTTPS,
self::RECORD_TYPE_SPF,
self::RECORD_TYPE_UINFO,
self::RECORD_TYPE_UID,
self::RECORD_TYPE_GID,
self::RECORD_TYPE_UNSPEC,
self::RECORD_TYPE_NID,
self::RECORD_TYPE_L32,
self::RECORD_TYPE_L64,
self::RECORD_TYPE_LP,
self::RECORD_TYPE_EUI48,
self::RECORD_TYPE_EUI64,
self::RECORD_TYPE_TKEY,
self::RECORD_TYPE_TSIG,
self::RECORD_TYPE_IXFR,
self::RECORD_TYPE_AXFR,
self::RECORD_TYPE_MAILB,
self::RECORD_TYPE_MAILA,
self::RECORD_TYPE_ANY,
self::RECORD_TYPE_URI,
self::RECORD_TYPE_CAA,
self::RECORD_TYPE_AVC,
self::RECORD_TYPE_DOA,
self::RECORD_TYPE_AMTRELAY,
self::RECORD_TYPE_TA,
self::RECORD_TYPE_DLV,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('record_type', $data ?? [], null);
$this->setIfExists('ttl', $data ?? [], null);
$this->setIfExists('record_entries', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['record_type'] === null) {
$invalidProperties[] = "'record_type' can't be null";
}
$allowedValues = $this->getRecordTypeAllowableValues();
if (!is_null($this->container['record_type']) && !in_array($this->container['record_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'record_type', must be one of '%s'",
$this->container['record_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['ttl'] === null) {
$invalidProperties[] = "'ttl' can't be null";
}
if ($this->container['record_entries'] === null) {
$invalidProperties[] = "'record_entries' can't be null";
}
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets record_type
*
* @return string
*/
public function getRecordType()
{
return $this->container['record_type'];
}
/**
* Sets record_type
*
* @param string $record_type Domain Name Server Record Types
*
* @return self
*/
public function setRecordType($record_type)
{
$allowedValues = $this->getRecordTypeAllowableValues();
if (!in_array($record_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'record_type', must be one of '%s'",
$record_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($record_type)) {
throw new \InvalidArgumentException('non-nullable record_type cannot be null');
}
$this->container['record_type'] = $record_type;
return $this;
}
/**
* Gets ttl
*
* @return int
*/
public function getTtl()
{
return $this->container['ttl'];
}
/**
* Sets ttl
*
* @param int $ttl ttl
*
* @return self
*/
public function setTtl($ttl)
{
if (is_null($ttl)) {
throw new \InvalidArgumentException('non-nullable ttl cannot be null');
}
$this->container['ttl'] = $ttl;
return $this;
}
/**
* Gets record_entries
*
* @return string[]
*/
public function getRecordEntries()
{
return $this->container['record_entries'];
}
/**
* Sets record_entries
*
* @param string[] $record_entries record_entries
*
* @return self
*/
public function setRecordEntries($record_entries)
{
if (is_null($record_entries)) {
throw new \InvalidArgumentException('non-nullable record_entries cannot be null');
}
$this->container['record_entries'] = $record_entries;
return $this;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* DNSLookupOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* DNSLookupOptions Class Doc Comment
*
* @category Class
* @description Options for DNS query.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class DNSLookupOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'DNSLookupOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'hostname' => 'string',
'record_types' => 'string[]',
'omit_final_dns_dot' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'hostname' => null,
'record_types' => null,
'omit_final_dns_dot' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'hostname' => false,
'record_types' => false,
'omit_final_dns_dot' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'hostname' => 'hostname',
'record_types' => 'recordTypes',
'omit_final_dns_dot' => 'omitFinalDNSDot'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'hostname' => 'setHostname',
'record_types' => 'setRecordTypes',
'omit_final_dns_dot' => 'setOmitFinalDnsDot'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'hostname' => 'getHostname',
'record_types' => 'getRecordTypes',
'omit_final_dns_dot' => 'getOmitFinalDnsDot'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const RECORD_TYPES_A = 'A';
public const RECORD_TYPES_NS = 'NS';
public const RECORD_TYPES_MD = 'MD';
public const RECORD_TYPES_MF = 'MF';
public const RECORD_TYPES_CNAME = 'CNAME';
public const RECORD_TYPES_SOA = 'SOA';
public const RECORD_TYPES_MB = 'MB';
public const RECORD_TYPES_MG = 'MG';
public const RECORD_TYPES_MR = 'MR';
public const RECORD_TYPES_NULL = 'NULL';
public const RECORD_TYPES_WKS = 'WKS';
public const RECORD_TYPES_PTR = 'PTR';
public const RECORD_TYPES_HINFO = 'HINFO';
public const RECORD_TYPES_MINFO = 'MINFO';
public const RECORD_TYPES_MX = 'MX';
public const RECORD_TYPES_TXT = 'TXT';
public const RECORD_TYPES_RP = 'RP';
public const RECORD_TYPES_AFSDB = 'AFSDB';
public const RECORD_TYPES_X25 = 'X25';
public const RECORD_TYPES_ISDN = 'ISDN';
public const RECORD_TYPES_RT = 'RT';
public const RECORD_TYPES_NSAP = 'NSAP';
public const RECORD_TYPES_NSAP_PTR = 'NSAP_PTR';
public const RECORD_TYPES_SIG = 'SIG';
public const RECORD_TYPES_KEY = 'KEY';
public const RECORD_TYPES_PX = 'PX';
public const RECORD_TYPES_GPOS = 'GPOS';
public const RECORD_TYPES_AAAA = 'AAAA';
public const RECORD_TYPES_LOC = 'LOC';
public const RECORD_TYPES_NXT = 'NXT';
public const RECORD_TYPES_EID = 'EID';
public const RECORD_TYPES_NIMLOC = 'NIMLOC';
public const RECORD_TYPES_SRV = 'SRV';
public const RECORD_TYPES_ATMA = 'ATMA';
public const RECORD_TYPES_NAPTR = 'NAPTR';
public const RECORD_TYPES_KX = 'KX';
public const RECORD_TYPES_CERT = 'CERT';
public const RECORD_TYPES_A6 = 'A6';
public const RECORD_TYPES_DNAME = 'DNAME';
public const RECORD_TYPES_SINK = 'SINK';
public const RECORD_TYPES_OPT = 'OPT';
public const RECORD_TYPES_APL = 'APL';
public const RECORD_TYPES_DS = 'DS';
public const RECORD_TYPES_SSHFP = 'SSHFP';
public const RECORD_TYPES_IPSECKEY = 'IPSECKEY';
public const RECORD_TYPES_RRSIG = 'RRSIG';
public const RECORD_TYPES_NSEC = 'NSEC';
public const RECORD_TYPES_DNSKEY = 'DNSKEY';
public const RECORD_TYPES_DHCID = 'DHCID';
public const RECORD_TYPES_NSEC3 = 'NSEC3';
public const RECORD_TYPES_NSEC3_PARAM = 'NSEC3PARAM';
public const RECORD_TYPES_TLSA = 'TLSA';
public const RECORD_TYPES_SMIMEA = 'SMIMEA';
public const RECORD_TYPES_HIP = 'HIP';
public const RECORD_TYPES_NINFO = 'NINFO';
public const RECORD_TYPES_RKEY = 'RKEY';
public const RECORD_TYPES_TALINK = 'TALINK';
public const RECORD_TYPES_CDS = 'CDS';
public const RECORD_TYPES_CDNSKEY = 'CDNSKEY';
public const RECORD_TYPES_OPENPGPKEY = 'OPENPGPKEY';
public const RECORD_TYPES_CSYNC = 'CSYNC';
public const RECORD_TYPES_ZONEMD = 'ZONEMD';
public const RECORD_TYPES_SVCB = 'SVCB';
public const RECORD_TYPES_HTTPS = 'HTTPS';
public const RECORD_TYPES_SPF = 'SPF';
public const RECORD_TYPES_UINFO = 'UINFO';
public const RECORD_TYPES_UID = 'UID';
public const RECORD_TYPES_GID = 'GID';
public const RECORD_TYPES_UNSPEC = 'UNSPEC';
public const RECORD_TYPES_NID = 'NID';
public const RECORD_TYPES_L32 = 'L32';
public const RECORD_TYPES_L64 = 'L64';
public const RECORD_TYPES_LP = 'LP';
public const RECORD_TYPES_EUI48 = 'EUI48';
public const RECORD_TYPES_EUI64 = 'EUI64';
public const RECORD_TYPES_TKEY = 'TKEY';
public const RECORD_TYPES_TSIG = 'TSIG';
public const RECORD_TYPES_IXFR = 'IXFR';
public const RECORD_TYPES_AXFR = 'AXFR';
public const RECORD_TYPES_MAILB = 'MAILB';
public const RECORD_TYPES_MAILA = 'MAILA';
public const RECORD_TYPES_ANY = 'ANY';
public const RECORD_TYPES_URI = 'URI';
public const RECORD_TYPES_CAA = 'CAA';
public const RECORD_TYPES_AVC = 'AVC';
public const RECORD_TYPES_DOA = 'DOA';
public const RECORD_TYPES_AMTRELAY = 'AMTRELAY';
public const RECORD_TYPES_TA = 'TA';
public const RECORD_TYPES_DLV = 'DLV';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getRecordTypesAllowableValues()
{
return [
self::RECORD_TYPES_A,
self::RECORD_TYPES_NS,
self::RECORD_TYPES_MD,
self::RECORD_TYPES_MF,
self::RECORD_TYPES_CNAME,
self::RECORD_TYPES_SOA,
self::RECORD_TYPES_MB,
self::RECORD_TYPES_MG,
self::RECORD_TYPES_MR,
self::RECORD_TYPES_NULL,
self::RECORD_TYPES_WKS,
self::RECORD_TYPES_PTR,
self::RECORD_TYPES_HINFO,
self::RECORD_TYPES_MINFO,
self::RECORD_TYPES_MX,
self::RECORD_TYPES_TXT,
self::RECORD_TYPES_RP,
self::RECORD_TYPES_AFSDB,
self::RECORD_TYPES_X25,
self::RECORD_TYPES_ISDN,
self::RECORD_TYPES_RT,
self::RECORD_TYPES_NSAP,
self::RECORD_TYPES_NSAP_PTR,
self::RECORD_TYPES_SIG,
self::RECORD_TYPES_KEY,
self::RECORD_TYPES_PX,
self::RECORD_TYPES_GPOS,
self::RECORD_TYPES_AAAA,
self::RECORD_TYPES_LOC,
self::RECORD_TYPES_NXT,
self::RECORD_TYPES_EID,
self::RECORD_TYPES_NIMLOC,
self::RECORD_TYPES_SRV,
self::RECORD_TYPES_ATMA,
self::RECORD_TYPES_NAPTR,
self::RECORD_TYPES_KX,
self::RECORD_TYPES_CERT,
self::RECORD_TYPES_A6,
self::RECORD_TYPES_DNAME,
self::RECORD_TYPES_SINK,
self::RECORD_TYPES_OPT,
self::RECORD_TYPES_APL,
self::RECORD_TYPES_DS,
self::RECORD_TYPES_SSHFP,
self::RECORD_TYPES_IPSECKEY,
self::RECORD_TYPES_RRSIG,
self::RECORD_TYPES_NSEC,
self::RECORD_TYPES_DNSKEY,
self::RECORD_TYPES_DHCID,
self::RECORD_TYPES_NSEC3,
self::RECORD_TYPES_NSEC3_PARAM,
self::RECORD_TYPES_TLSA,
self::RECORD_TYPES_SMIMEA,
self::RECORD_TYPES_HIP,
self::RECORD_TYPES_NINFO,
self::RECORD_TYPES_RKEY,
self::RECORD_TYPES_TALINK,
self::RECORD_TYPES_CDS,
self::RECORD_TYPES_CDNSKEY,
self::RECORD_TYPES_OPENPGPKEY,
self::RECORD_TYPES_CSYNC,
self::RECORD_TYPES_ZONEMD,
self::RECORD_TYPES_SVCB,
self::RECORD_TYPES_HTTPS,
self::RECORD_TYPES_SPF,
self::RECORD_TYPES_UINFO,
self::RECORD_TYPES_UID,
self::RECORD_TYPES_GID,
self::RECORD_TYPES_UNSPEC,
self::RECORD_TYPES_NID,
self::RECORD_TYPES_L32,
self::RECORD_TYPES_L64,
self::RECORD_TYPES_LP,
self::RECORD_TYPES_EUI48,
self::RECORD_TYPES_EUI64,
self::RECORD_TYPES_TKEY,
self::RECORD_TYPES_TSIG,
self::RECORD_TYPES_IXFR,
self::RECORD_TYPES_AXFR,
self::RECORD_TYPES_MAILB,
self::RECORD_TYPES_MAILA,
self::RECORD_TYPES_ANY,
self::RECORD_TYPES_URI,
self::RECORD_TYPES_CAA,
self::RECORD_TYPES_AVC,
self::RECORD_TYPES_DOA,
self::RECORD_TYPES_AMTRELAY,
self::RECORD_TYPES_TA,
self::RECORD_TYPES_DLV,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('hostname', $data ?? [], null);
$this->setIfExists('record_types', $data ?? [], null);
$this->setIfExists('omit_final_dns_dot', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['hostname'] === null) {
$invalidProperties[] = "'hostname' can't be null";
}
if ($this->container['record_types'] === null) {
$invalidProperties[] = "'record_types' can't be null";
}
if ($this->container['omit_final_dns_dot'] === null) {
$invalidProperties[] = "'omit_final_dns_dot' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets hostname
*
* @return string
*/
public function getHostname()
{
return $this->container['hostname'];
}
/**
* Sets hostname
*
* @param string $hostname List of record types you wish to query such as MX, DNS, TXT, NS, A etc.
*
* @return self
*/
public function setHostname($hostname)
{
if (is_null($hostname)) {
throw new \InvalidArgumentException('non-nullable hostname cannot be null');
}
$this->container['hostname'] = $hostname;
return $this;
}
/**
* Gets record_types
*
* @return string[]
*/
public function getRecordTypes()
{
return $this->container['record_types'];
}
/**
* Sets record_types
*
* @param string[] $record_types List of record types you wish to query such as MX, DNS, TXT, NS, A etc.
*
* @return self
*/
public function setRecordTypes($record_types)
{
$allowedValues = $this->getRecordTypesAllowableValues();
if (array_diff($record_types, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'record_types', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
if (is_null($record_types)) {
throw new \InvalidArgumentException('non-nullable record_types cannot be null');
}
$this->container['record_types'] = $record_types;
return $this;
}
/**
* Gets omit_final_dns_dot
*
* @return bool
*/
public function getOmitFinalDnsDot()
{
return $this->container['omit_final_dns_dot'];
}
/**
* Sets omit_final_dns_dot
*
* @param bool $omit_final_dns_dot Optionally control whether to omit the final dot in full DNS name values.
*
* @return self
*/
public function setOmitFinalDnsDot($omit_final_dns_dot)
{
if (is_null($omit_final_dns_dot)) {
throw new \InvalidArgumentException('non-nullable omit_final_dns_dot cannot be null');
}
$this->container['omit_final_dns_dot'] = $omit_final_dns_dot;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateWebhookOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateWebhookOptions Class Doc Comment
*
* @category Class
* @description Options for creating a webhook. Webhooks can be attached to inboxes and MailSlurp will POST a webhook payload to the URL specified whenever the webhook's event is triggered. Webhooks are great for processing many inbound emails and responding to other events at scale. Customize the payload sent to your endpoint by setting the `requestBodyTemplate` property to a string with moustache style variables. Property names from the standard payload model for the given event are available as variables.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateWebhookOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateWebhookOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'url' => 'string',
'basic_auth' => '\MailSlurp\Models\BasicAuthOptions',
'name' => 'string',
'event_name' => 'string',
'include_headers' => '\MailSlurp\Models\WebhookHeaders',
'request_body_template' => 'string',
'use_static_ip_range' => 'bool',
'ignore_insecure_ssl_certificates' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'url' => null,
'basic_auth' => null,
'name' => null,
'event_name' => null,
'include_headers' => null,
'request_body_template' => null,
'use_static_ip_range' => null,
'ignore_insecure_ssl_certificates' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'url' => false,
'basic_auth' => true,
'name' => true,
'event_name' => true,
'include_headers' => false,
'request_body_template' => true,
'use_static_ip_range' => true,
'ignore_insecure_ssl_certificates' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'url' => 'url',
'basic_auth' => 'basicAuth',
'name' => 'name',
'event_name' => 'eventName',
'include_headers' => 'includeHeaders',
'request_body_template' => 'requestBodyTemplate',
'use_static_ip_range' => 'useStaticIpRange',
'ignore_insecure_ssl_certificates' => 'ignoreInsecureSslCertificates'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'url' => 'setUrl',
'basic_auth' => 'setBasicAuth',
'name' => 'setName',
'event_name' => 'setEventName',
'include_headers' => 'setIncludeHeaders',
'request_body_template' => 'setRequestBodyTemplate',
'use_static_ip_range' => 'setUseStaticIpRange',
'ignore_insecure_ssl_certificates' => 'setIgnoreInsecureSslCertificates'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'url' => 'getUrl',
'basic_auth' => 'getBasicAuth',
'name' => 'getName',
'event_name' => 'getEventName',
'include_headers' => 'getIncludeHeaders',
'request_body_template' => 'getRequestBodyTemplate',
'use_static_ip_range' => 'getUseStaticIpRange',
'ignore_insecure_ssl_certificates' => 'getIgnoreInsecureSslCertificates'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('basic_auth', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('include_headers', $data ?? [], null);
$this->setIfExists('request_body_template', $data ?? [], null);
$this->setIfExists('use_static_ip_range', $data ?? [], false);
$this->setIfExists('ignore_insecure_ssl_certificates', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['url'] === null) {
$invalidProperties[] = "'url' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets url
*
* @return string
*/
public function getUrl()
{
return $this->container['url'];
}
/**
* Sets url
*
* @param string $url Public URL on your server that MailSlurp can post WebhookNotification payload to when an email is received or an event is trigger. The payload of the submitted JSON is dependent on the webhook event type. See docs.mailslurp.com/webhooks for event payload documentation.
*
* @return self
*/
public function setUrl($url)
{
if (is_null($url)) {
throw new \InvalidArgumentException('non-nullable url cannot be null');
}
$this->container['url'] = $url;
return $this;
}
/**
* Gets basic_auth
*
* @return \MailSlurp\Models\BasicAuthOptions|null
*/
public function getBasicAuth()
{
return $this->container['basic_auth'];
}
/**
* Sets basic_auth
*
* @param \MailSlurp\Models\BasicAuthOptions|null $basic_auth basic_auth
*
* @return self
*/
public function setBasicAuth($basic_auth)
{
if (is_null($basic_auth)) {
array_push($this->openAPINullablesSetToNull, 'basic_auth');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('basic_auth', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['basic_auth'] = $basic_auth;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Optional name for the webhook
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets event_name
*
* @return string|null
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string|null $event_name Optional webhook event name. Default is `EMAIL_RECEIVED` and is triggered when an email is received by the inbox associated with the webhook. Payload differ according to the webhook event name.
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($event_name) && !in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
array_push($this->openAPINullablesSetToNull, 'event_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('event_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets include_headers
*
* @return \MailSlurp\Models\WebhookHeaders|null
*/
public function getIncludeHeaders()
{
return $this->container['include_headers'];
}
/**
* Sets include_headers
*
* @param \MailSlurp\Models\WebhookHeaders|null $include_headers include_headers
*
* @return self
*/
public function setIncludeHeaders($include_headers)
{
if (is_null($include_headers)) {
throw new \InvalidArgumentException('non-nullable include_headers cannot be null');
}
$this->container['include_headers'] = $include_headers;
return $this;
}
/**
* Gets request_body_template
*
* @return string|null
*/
public function getRequestBodyTemplate()
{
return $this->container['request_body_template'];
}
/**
* Sets request_body_template
*
* @param string|null $request_body_template Template for the JSON body of the webhook request that will be sent to your server. Use Moustache style `{{variableName}}` templating to use parts of the standard webhook payload for the given event.
*
* @return self
*/
public function setRequestBodyTemplate($request_body_template)
{
if (is_null($request_body_template)) {
array_push($this->openAPINullablesSetToNull, 'request_body_template');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('request_body_template', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['request_body_template'] = $request_body_template;
return $this;
}
/**
* Gets use_static_ip_range
*
* @return bool|null
*/
public function getUseStaticIpRange()
{
return $this->container['use_static_ip_range'];
}
/**
* Sets use_static_ip_range
*
* @param bool|null $use_static_ip_range Use static IP range when calling webhook endpoint
*
* @return self
*/
public function setUseStaticIpRange($use_static_ip_range)
{
if (is_null($use_static_ip_range)) {
array_push($this->openAPINullablesSetToNull, 'use_static_ip_range');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_static_ip_range', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_static_ip_range'] = $use_static_ip_range;
return $this;
}
/**
* Gets ignore_insecure_ssl_certificates
*
* @return bool|null
*/
public function getIgnoreInsecureSslCertificates()
{
return $this->container['ignore_insecure_ssl_certificates'];
}
/**
* Sets ignore_insecure_ssl_certificates
*
* @param bool|null $ignore_insecure_ssl_certificates Ignore insecure SSL certificates when sending request. Useful for self-signed certs.
*
* @return self
*/
public function setIgnoreInsecureSslCertificates($ignore_insecure_ssl_certificates)
{
if (is_null($ignore_insecure_ssl_certificates)) {
array_push($this->openAPINullablesSetToNull, 'ignore_insecure_ssl_certificates');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('ignore_insecure_ssl_certificates', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['ignore_insecure_ssl_certificates'] = $ignore_insecure_ssl_certificates;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateTrackingPixelOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateTrackingPixelOptions Class Doc Comment
*
* @category Class
* @description Options for creating a tracking pixel for email open tracking
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateTrackingPixelOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateTrackingPixelOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'recipient' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'recipient' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => true,
'recipient' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'recipient' => 'recipient'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'recipient' => 'setRecipient'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'recipient' => 'getRecipient'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets recipient
*
* @return string|null
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string|null $recipient recipient
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
array_push($this->openAPINullablesSetToNull, 'recipient');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('recipient', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateTemplateOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateTemplateOptions Class Doc Comment
*
* @category Class
* @description Create template options
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateTemplateOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateTemplateOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'content' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'content' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'content' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'content' => 'content'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'content' => 'setContent'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'content' => 'getContent'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('content', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['content'] === null) {
$invalidProperties[] = "'content' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name Name of template
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets content
*
* @return string
*/
public function getContent()
{
return $this->container['content'];
}
/**
* Sets content
*
* @param string $content Template content. Can include moustache style variables such as {{var_name}}
*
* @return self
*/
public function setContent($content)
{
if (is_null($content)) {
throw new \InvalidArgumentException('non-nullable content cannot be null');
}
$this->container['content'] = $content;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateInboxRulesetOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateInboxRulesetOptions Class Doc Comment
*
* @category Class
* @description Options for creating inbox rulesets. Inbox rulesets can be used to block, allow, filter, or forward emails when sending or receiving using the inbox.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateInboxRulesetOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateInboxRulesetOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'scope' => 'string',
'action' => 'string',
'target' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'scope' => null,
'action' => null,
'target' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'scope' => false,
'action' => false,
'target' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'scope' => 'scope',
'action' => 'action',
'target' => 'target'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'scope' => 'setScope',
'action' => 'setAction',
'target' => 'setTarget'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'scope' => 'getScope',
'action' => 'getAction',
'target' => 'getTarget'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SCOPE_RECEIVING_EMAILS = 'RECEIVING_EMAILS';
public const SCOPE_SENDING_EMAILS = 'SENDING_EMAILS';
public const ACTION_BLOCK = 'BLOCK';
public const ACTION_ALLOW = 'ALLOW';
public const ACTION_FILTER_REMOVE = 'FILTER_REMOVE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getScopeAllowableValues()
{
return [
self::SCOPE_RECEIVING_EMAILS,
self::SCOPE_SENDING_EMAILS,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getActionAllowableValues()
{
return [
self::ACTION_BLOCK,
self::ACTION_ALLOW,
self::ACTION_FILTER_REMOVE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('scope', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('target', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['scope'] === null) {
$invalidProperties[] = "'scope' can't be null";
}
$allowedValues = $this->getScopeAllowableValues();
if (!is_null($this->container['scope']) && !in_array($this->container['scope'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'scope', must be one of '%s'",
$this->container['scope'],
implode("', '", $allowedValues)
);
}
if ($this->container['action'] === null) {
$invalidProperties[] = "'action' can't be null";
}
$allowedValues = $this->getActionAllowableValues();
if (!is_null($this->container['action']) && !in_array($this->container['action'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'action', must be one of '%s'",
$this->container['action'],
implode("', '", $allowedValues)
);
}
if ($this->container['target'] === null) {
$invalidProperties[] = "'target' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets scope
*
* @return string
*/
public function getScope()
{
return $this->container['scope'];
}
/**
* Sets scope
*
* @param string $scope What type of emails actions to apply ruleset to. Either `SENDING_EMAILS` or `RECEIVING_EMAILS` will apply action and target to any sending or receiving of emails respectively.
*
* @return self
*/
public function setScope($scope)
{
$allowedValues = $this->getScopeAllowableValues();
if (!in_array($scope, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'scope', must be one of '%s'",
$scope,
implode("', '", $allowedValues)
)
);
}
if (is_null($scope)) {
throw new \InvalidArgumentException('non-nullable scope cannot be null');
}
$this->container['scope'] = $scope;
return $this;
}
/**
* Gets action
*
* @return string
*/
public function getAction()
{
return $this->container['action'];
}
/**
* Sets action
*
* @param string $action Action to be taken when the ruleset matches an email for the given scope. For example: `BLOCK` action with target `*` and scope `SENDING_EMAILS` blocks sending to all recipients. Note `ALLOW` takes precedent over `BLOCK`. `FILTER_REMOVE` is like block but will remove offending email addresses during a send or receive event instead of blocking the action.
*
* @return self
*/
public function setAction($action)
{
$allowedValues = $this->getActionAllowableValues();
if (!in_array($action, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'action', must be one of '%s'",
$action,
implode("', '", $allowedValues)
)
);
}
if (is_null($action)) {
throw new \InvalidArgumentException('non-nullable action cannot be null');
}
$this->container['action'] = $action;
return $this;
}
/**
* Gets target
*
* @return string
*/
public function getTarget()
{
return $this->container['target'];
}
/**
* Sets target
*
* @param string $target Target to match emails with. Can be a wild-card type pattern or a valid email address. For instance `*@gmail.com` matches all gmail addresses while `test@gmail.com` matches one address exactly. The target is applied to every recipient field email address when `SENDING_EMAILS` is the scope and is applied to sender of email when `RECEIVING_EMAILS`.
*
* @return self
*/
public function setTarget($target)
{
if (is_null($target)) {
throw new \InvalidArgumentException('non-nullable target cannot be null');
}
$this->container['target'] = $target;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateInboxReplierOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateInboxReplierOptions Class Doc Comment
*
* @category Class
* @description Options for creating an inbox replier. Repliers can be attached to inboxes and send automated responses when an inbound email matches given criteria.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateInboxReplierOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateInboxReplierOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_id' => 'string',
'name' => 'string',
'field' => 'string',
'match' => 'string',
'reply_to' => 'string',
'subject' => 'string',
'from' => 'string',
'charset' => 'string',
'ignore_reply_to' => 'bool',
'is_html' => 'bool',
'body' => 'string',
'template_id' => 'string',
'template_variables' => 'array<string,object>'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_id' => 'uuid',
'name' => null,
'field' => null,
'match' => null,
'reply_to' => null,
'subject' => null,
'from' => null,
'charset' => null,
'ignore_reply_to' => null,
'is_html' => null,
'body' => null,
'template_id' => 'uuid',
'template_variables' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_id' => false,
'name' => true,
'field' => false,
'match' => false,
'reply_to' => true,
'subject' => true,
'from' => true,
'charset' => true,
'ignore_reply_to' => true,
'is_html' => true,
'body' => true,
'template_id' => true,
'template_variables' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_id' => 'inboxId',
'name' => 'name',
'field' => 'field',
'match' => 'match',
'reply_to' => 'replyTo',
'subject' => 'subject',
'from' => 'from',
'charset' => 'charset',
'ignore_reply_to' => 'ignoreReplyTo',
'is_html' => 'isHTML',
'body' => 'body',
'template_id' => 'templateId',
'template_variables' => 'templateVariables'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_id' => 'setInboxId',
'name' => 'setName',
'field' => 'setField',
'match' => 'setMatch',
'reply_to' => 'setReplyTo',
'subject' => 'setSubject',
'from' => 'setFrom',
'charset' => 'setCharset',
'ignore_reply_to' => 'setIgnoreReplyTo',
'is_html' => 'setIsHtml',
'body' => 'setBody',
'template_id' => 'setTemplateId',
'template_variables' => 'setTemplateVariables'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_id' => 'getInboxId',
'name' => 'getName',
'field' => 'getField',
'match' => 'getMatch',
'reply_to' => 'getReplyTo',
'subject' => 'getSubject',
'from' => 'getFrom',
'charset' => 'getCharset',
'ignore_reply_to' => 'getIgnoreReplyTo',
'is_html' => 'getIsHtml',
'body' => 'getBody',
'template_id' => 'getTemplateId',
'template_variables' => 'getTemplateVariables'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FIELD_RECIPIENTS = 'RECIPIENTS';
public const FIELD_SENDER = 'SENDER';
public const FIELD_SUBJECT = 'SUBJECT';
public const FIELD_ATTACHMENTS = 'ATTACHMENTS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFieldAllowableValues()
{
return [
self::FIELD_RECIPIENTS,
self::FIELD_SENDER,
self::FIELD_SUBJECT,
self::FIELD_ATTACHMENTS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('field', $data ?? [], null);
$this->setIfExists('match', $data ?? [], null);
$this->setIfExists('reply_to', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('from', $data ?? [], null);
$this->setIfExists('charset', $data ?? [], null);
$this->setIfExists('ignore_reply_to', $data ?? [], null);
$this->setIfExists('is_html', $data ?? [], null);
$this->setIfExists('body', $data ?? [], null);
$this->setIfExists('template_id', $data ?? [], null);
$this->setIfExists('template_variables', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['field'] === null) {
$invalidProperties[] = "'field' can't be null";
}
$allowedValues = $this->getFieldAllowableValues();
if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'field', must be one of '%s'",
$this->container['field'],
implode("', '", $allowedValues)
);
}
if ($this->container['match'] === null) {
$invalidProperties[] = "'match' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Inbox ID to attach replier to
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name for replier
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets field
*
* @return string
*/
public function getField()
{
return $this->container['field'];
}
/**
* Sets field
*
* @param string $field Field to match against to trigger inbox replier for inbound email
*
* @return self
*/
public function setField($field)
{
$allowedValues = $this->getFieldAllowableValues();
if (!in_array($field, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'field', must be one of '%s'",
$field,
implode("', '", $allowedValues)
)
);
}
if (is_null($field)) {
throw new \InvalidArgumentException('non-nullable field cannot be null');
}
$this->container['field'] = $field;
return $this;
}
/**
* Gets match
*
* @return string
*/
public function getMatch()
{
return $this->container['match'];
}
/**
* Sets match
*
* @param string $match String or wildcard style match for field specified when evaluating reply rules. Use `*` to match anything.
*
* @return self
*/
public function setMatch($match)
{
if (is_null($match)) {
throw new \InvalidArgumentException('non-nullable match cannot be null');
}
$this->container['match'] = $match;
return $this;
}
/**
* Gets reply_to
*
* @return string|null
*/
public function getReplyTo()
{
return $this->container['reply_to'];
}
/**
* Sets reply_to
*
* @param string|null $reply_to Reply-to email address when sending replying
*
* @return self
*/
public function setReplyTo($reply_to)
{
if (is_null($reply_to)) {
array_push($this->openAPINullablesSetToNull, 'reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['reply_to'] = $reply_to;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject Subject override when replying to email
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets from
*
* @return string|null
*/
public function getFrom()
{
return $this->container['from'];
}
/**
* Sets from
*
* @param string|null $from Send email from address
*
* @return self
*/
public function setFrom($from)
{
if (is_null($from)) {
array_push($this->openAPINullablesSetToNull, 'from');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('from', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['from'] = $from;
return $this;
}
/**
* Gets charset
*
* @return string|null
*/
public function getCharset()
{
return $this->container['charset'];
}
/**
* Sets charset
*
* @param string|null $charset Email reply charset
*
* @return self
*/
public function setCharset($charset)
{
if (is_null($charset)) {
array_push($this->openAPINullablesSetToNull, 'charset');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('charset', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['charset'] = $charset;
return $this;
}
/**
* Gets ignore_reply_to
*
* @return bool|null
*/
public function getIgnoreReplyTo()
{
return $this->container['ignore_reply_to'];
}
/**
* Sets ignore_reply_to
*
* @param bool|null $ignore_reply_to Ignore sender replyTo when responding. Send directly to the sender if enabled.
*
* @return self
*/
public function setIgnoreReplyTo($ignore_reply_to)
{
if (is_null($ignore_reply_to)) {
array_push($this->openAPINullablesSetToNull, 'ignore_reply_to');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('ignore_reply_to', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['ignore_reply_to'] = $ignore_reply_to;
return $this;
}
/**
* Gets is_html
*
* @return bool|null
*/
public function getIsHtml()
{
return $this->container['is_html'];
}
/**
* Sets is_html
*
* @param bool|null $is_html Send HTML email
*
* @return self
*/
public function setIsHtml($is_html)
{
if (is_null($is_html)) {
array_push($this->openAPINullablesSetToNull, 'is_html');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('is_html', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['is_html'] = $is_html;
return $this;
}
/**
* Gets body
*
* @return string|null
*/
public function getBody()
{
return $this->container['body'];
}
/**
* Sets body
*
* @param string|null $body Email body for reply
*
* @return self
*/
public function setBody($body)
{
if (is_null($body)) {
array_push($this->openAPINullablesSetToNull, 'body');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('body', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['body'] = $body;
return $this;
}
/**
* Gets template_id
*
* @return string|null
*/
public function getTemplateId()
{
return $this->container['template_id'];
}
/**
* Sets template_id
*
* @param string|null $template_id ID of template to use when sending a reply
*
* @return self
*/
public function setTemplateId($template_id)
{
if (is_null($template_id)) {
array_push($this->openAPINullablesSetToNull, 'template_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_id'] = $template_id;
return $this;
}
/**
* Gets template_variables
*
* @return array<string,object>|null
*/
public function getTemplateVariables()
{
return $this->container['template_variables'];
}
/**
* Sets template_variables
*
* @param array<string,object>|null $template_variables Template variable values
*
* @return self
*/
public function setTemplateVariables($template_variables)
{
if (is_null($template_variables)) {
array_push($this->openAPINullablesSetToNull, 'template_variables');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('template_variables', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['template_variables'] = $template_variables;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateInboxForwarderOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateInboxForwarderOptions Class Doc Comment
*
* @category Class
* @description Options for creating an inbox forwarder
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateInboxForwarderOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateInboxForwarderOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'field' => 'string',
'match' => 'string',
'forward_to_recipients' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'field' => null,
'match' => null,
'forward_to_recipients' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'field' => false,
'match' => false,
'forward_to_recipients' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'field' => 'field',
'match' => 'match',
'forward_to_recipients' => 'forwardToRecipients'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'field' => 'setField',
'match' => 'setMatch',
'forward_to_recipients' => 'setForwardToRecipients'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'field' => 'getField',
'match' => 'getMatch',
'forward_to_recipients' => 'getForwardToRecipients'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const FIELD_RECIPIENTS = 'RECIPIENTS';
public const FIELD_SENDER = 'SENDER';
public const FIELD_SUBJECT = 'SUBJECT';
public const FIELD_ATTACHMENTS = 'ATTACHMENTS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getFieldAllowableValues()
{
return [
self::FIELD_RECIPIENTS,
self::FIELD_SENDER,
self::FIELD_SUBJECT,
self::FIELD_ATTACHMENTS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('field', $data ?? [], null);
$this->setIfExists('match', $data ?? [], null);
$this->setIfExists('forward_to_recipients', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['field'] === null) {
$invalidProperties[] = "'field' can't be null";
}
$allowedValues = $this->getFieldAllowableValues();
if (!is_null($this->container['field']) && !in_array($this->container['field'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'field', must be one of '%s'",
$this->container['field'],
implode("', '", $allowedValues)
);
}
if ($this->container['match'] === null) {
$invalidProperties[] = "'match' can't be null";
}
if ($this->container['forward_to_recipients'] === null) {
$invalidProperties[] = "'forward_to_recipients' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets field
*
* @return string
*/
public function getField()
{
return $this->container['field'];
}
/**
* Sets field
*
* @param string $field Field to match against to trigger inbox forwarding for inbound email
*
* @return self
*/
public function setField($field)
{
$allowedValues = $this->getFieldAllowableValues();
if (!in_array($field, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'field', must be one of '%s'",
$field,
implode("', '", $allowedValues)
)
);
}
if (is_null($field)) {
throw new \InvalidArgumentException('non-nullable field cannot be null');
}
$this->container['field'] = $field;
return $this;
}
/**
* Gets match
*
* @return string
*/
public function getMatch()
{
return $this->container['match'];
}
/**
* Sets match
*
* @param string $match String or wildcard style match for field specified when evaluating forwarding rules
*
* @return self
*/
public function setMatch($match)
{
if (is_null($match)) {
throw new \InvalidArgumentException('non-nullable match cannot be null');
}
$this->container['match'] = $match;
return $this;
}
/**
* Gets forward_to_recipients
*
* @return string[]
*/
public function getForwardToRecipients()
{
return $this->container['forward_to_recipients'];
}
/**
* Sets forward_to_recipients
*
* @param string[] $forward_to_recipients Email addresses to forward an email to if it matches the field and match criteria of the forwarder
*
* @return self
*/
public function setForwardToRecipients($forward_to_recipients)
{
if (is_null($forward_to_recipients)) {
throw new \InvalidArgumentException('non-nullable forward_to_recipients cannot be null');
}
$this->container['forward_to_recipients'] = $forward_to_recipients;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateInboxDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateInboxDto Class Doc Comment
*
* @category Class
* @description Options for creating an inbox. An inbox has a real email address that can send and receive emails. Inboxes can be permanent or expire at a given time. Inboxes are either `SMTP` or `HTTP` mailboxes. `SMTP` inboxes are processed by a mail server running at `mailslurp.mx` while `HTTP` inboxes are processed by AWS SES backed mailservers. An inbox email address is randomly assigned by default ending in either `mailslurp.com` or (if `useDomainPool` is enabled) ending in a similar domain such as `mailslurp.xyz` (selected at random). To specify an address use a custom domain: either pass the `emailAddress` options with `<your-recipient>@<your-domain>`. To create a randomized address for your domain set the `domainName` to the domain you have verified or pass the `domainId`. Virtual inboxes prevent outbound sending and instead trap mail.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateInboxDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateInboxDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_address' => 'string',
'domain_name' => 'string',
'domain_id' => 'string',
'name' => 'string',
'description' => 'string',
'use_domain_pool' => 'bool',
'tags' => 'string[]',
'expires_at' => '\DateTime',
'favourite' => 'bool',
'expires_in' => 'int',
'allow_team_access' => 'bool',
'inbox_type' => 'string',
'virtual_inbox' => 'bool',
'use_short_address' => 'bool',
'prefix' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_address' => null,
'domain_name' => null,
'domain_id' => 'uuid',
'name' => null,
'description' => null,
'use_domain_pool' => null,
'tags' => null,
'expires_at' => 'date-time',
'favourite' => null,
'expires_in' => 'int64',
'allow_team_access' => null,
'inbox_type' => null,
'virtual_inbox' => null,
'use_short_address' => null,
'prefix' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_address' => true,
'domain_name' => true,
'domain_id' => true,
'name' => true,
'description' => true,
'use_domain_pool' => true,
'tags' => true,
'expires_at' => true,
'favourite' => true,
'expires_in' => true,
'allow_team_access' => true,
'inbox_type' => true,
'virtual_inbox' => true,
'use_short_address' => true,
'prefix' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_address' => 'emailAddress',
'domain_name' => 'domainName',
'domain_id' => 'domainId',
'name' => 'name',
'description' => 'description',
'use_domain_pool' => 'useDomainPool',
'tags' => 'tags',
'expires_at' => 'expiresAt',
'favourite' => 'favourite',
'expires_in' => 'expiresIn',
'allow_team_access' => 'allowTeamAccess',
'inbox_type' => 'inboxType',
'virtual_inbox' => 'virtualInbox',
'use_short_address' => 'useShortAddress',
'prefix' => 'prefix'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_address' => 'setEmailAddress',
'domain_name' => 'setDomainName',
'domain_id' => 'setDomainId',
'name' => 'setName',
'description' => 'setDescription',
'use_domain_pool' => 'setUseDomainPool',
'tags' => 'setTags',
'expires_at' => 'setExpiresAt',
'favourite' => 'setFavourite',
'expires_in' => 'setExpiresIn',
'allow_team_access' => 'setAllowTeamAccess',
'inbox_type' => 'setInboxType',
'virtual_inbox' => 'setVirtualInbox',
'use_short_address' => 'setUseShortAddress',
'prefix' => 'setPrefix'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_address' => 'getEmailAddress',
'domain_name' => 'getDomainName',
'domain_id' => 'getDomainId',
'name' => 'getName',
'description' => 'getDescription',
'use_domain_pool' => 'getUseDomainPool',
'tags' => 'getTags',
'expires_at' => 'getExpiresAt',
'favourite' => 'getFavourite',
'expires_in' => 'getExpiresIn',
'allow_team_access' => 'getAllowTeamAccess',
'inbox_type' => 'getInboxType',
'virtual_inbox' => 'getVirtualInbox',
'use_short_address' => 'getUseShortAddress',
'prefix' => 'getPrefix'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const INBOX_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const INBOX_TYPE_SMTP_INBOX = 'SMTP_INBOX';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getInboxTypeAllowableValues()
{
return [
self::INBOX_TYPE_HTTP_INBOX,
self::INBOX_TYPE_SMTP_INBOX,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('domain_name', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('use_domain_pool', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('expires_at', $data ?? [], null);
$this->setIfExists('favourite', $data ?? [], null);
$this->setIfExists('expires_in', $data ?? [], null);
$this->setIfExists('allow_team_access', $data ?? [], null);
$this->setIfExists('inbox_type', $data ?? [], null);
$this->setIfExists('virtual_inbox', $data ?? [], null);
$this->setIfExists('use_short_address', $data ?? [], null);
$this->setIfExists('prefix', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($this->container['inbox_type']) && !in_array($this->container['inbox_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'inbox_type', must be one of '%s'",
$this->container['inbox_type'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_address
*
* @return string|null
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string|null $email_address A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Note domain types must match the inbox type - so `SMTP` inboxes will only work with `SMTP` type domains. Avoid `SMTP` inboxes if you need to send emails as they can only receive. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID.
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
array_push($this->openAPINullablesSetToNull, 'email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets domain_name
*
* @return string|null
*/
public function getDomainName()
{
return $this->container['domain_name'];
}
/**
* Sets domain_name
*
* @param string|null $domain_name FQDN domain name for the domain you have verified. Will be appended with a randomly assigned recipient name. Use the `emailAddress` option instead to specify the full custom inbox.
*
* @return self
*/
public function setDomainName($domain_name)
{
if (is_null($domain_name)) {
array_push($this->openAPINullablesSetToNull, 'domain_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_name'] = $domain_name;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id ID of custom domain to use for email address.
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Optional name of the inbox. Displayed in the dashboard for easier search and used as the sender name when sending emails.
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
array_push($this->openAPINullablesSetToNull, 'description');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('description', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['description'] = $description;
return $this;
}
/**
* Gets use_domain_pool
*
* @return bool|null
*/
public function getUseDomainPool()
{
return $this->container['use_domain_pool'];
}
/**
* Sets use_domain_pool
*
* @param bool|null $use_domain_pool Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field. Note this feature is only available for `HTTP` inbox types.
*
* @return self
*/
public function setUseDomainPool($use_domain_pool)
{
if (is_null($use_domain_pool)) {
array_push($this->openAPINullablesSetToNull, 'use_domain_pool');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_domain_pool', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_domain_pool'] = $use_domain_pool;
return $this;
}
/**
* Gets tags
*
* @return string[]|null
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[]|null $tags Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
array_push($this->openAPINullablesSetToNull, 'tags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('tags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets expires_at
*
* @return \DateTime|null
*/
public function getExpiresAt()
{
return $this->container['expires_at'];
}
/**
* Sets expires_at
*
* @param \DateTime|null $expires_at Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX.
*
* @return self
*/
public function setExpiresAt($expires_at)
{
if (is_null($expires_at)) {
array_push($this->openAPINullablesSetToNull, 'expires_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('expires_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['expires_at'] = $expires_at;
return $this;
}
/**
* Gets favourite
*
* @return bool|null
*/
public function getFavourite()
{
return $this->container['favourite'];
}
/**
* Sets favourite
*
* @param bool|null $favourite Is the inbox a favorite. Marking an inbox as a favorite is typically done in the dashboard for quick access or filtering
*
* @return self
*/
public function setFavourite($favourite)
{
if (is_null($favourite)) {
array_push($this->openAPINullablesSetToNull, 'favourite');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('favourite', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['favourite'] = $favourite;
return $this;
}
/**
* Gets expires_in
*
* @return int|null
*/
public function getExpiresIn()
{
return $this->container['expires_in'];
}
/**
* Sets expires_in
*
* @param int|null $expires_in Number of milliseconds that inbox should exist for
*
* @return self
*/
public function setExpiresIn($expires_in)
{
if (is_null($expires_in)) {
array_push($this->openAPINullablesSetToNull, 'expires_in');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('expires_in', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['expires_in'] = $expires_in;
return $this;
}
/**
* Gets allow_team_access
*
* @return bool|null
*/
public function getAllowTeamAccess()
{
return $this->container['allow_team_access'];
}
/**
* Sets allow_team_access
*
* @param bool|null $allow_team_access DEPRECATED (team access is always true). Grant team access to this inbox and the emails that belong to it for team members of your organization.
*
* @return self
*/
public function setAllowTeamAccess($allow_team_access)
{
if (is_null($allow_team_access)) {
array_push($this->openAPINullablesSetToNull, 'allow_team_access');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('allow_team_access', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['allow_team_access'] = $allow_team_access;
return $this;
}
/**
* Gets inbox_type
*
* @return string|null
*/
public function getInboxType()
{
return $this->container['inbox_type'];
}
/**
* Sets inbox_type
*
* @param string|null $inbox_type Type of inbox. HTTP inboxes are faster and better for most cases. SMTP inboxes are more suited for public facing inbound messages (but cannot send).
*
* @return self
*/
public function setInboxType($inbox_type)
{
$allowedValues = $this->getInboxTypeAllowableValues();
if (!is_null($inbox_type) && !in_array($inbox_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'inbox_type', must be one of '%s'",
$inbox_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($inbox_type)) {
array_push($this->openAPINullablesSetToNull, 'inbox_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_type'] = $inbox_type;
return $this;
}
/**
* Gets virtual_inbox
*
* @return bool|null
*/
public function getVirtualInbox()
{
return $this->container['virtual_inbox'];
}
/**
* Sets virtual_inbox
*
* @param bool|null $virtual_inbox Virtual inbox prevents any outbound emails from being sent. It creates sent email records but will never send real emails to recipients. Great for testing and faking email sending.
*
* @return self
*/
public function setVirtualInbox($virtual_inbox)
{
if (is_null($virtual_inbox)) {
array_push($this->openAPINullablesSetToNull, 'virtual_inbox');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('virtual_inbox', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['virtual_inbox'] = $virtual_inbox;
return $this;
}
/**
* Gets use_short_address
*
* @return bool|null
*/
public function getUseShortAddress()
{
return $this->container['use_short_address'];
}
/**
* Sets use_short_address
*
* @param bool|null $use_short_address Use a shorter email address under 31 characters
*
* @return self
*/
public function setUseShortAddress($use_short_address)
{
if (is_null($use_short_address)) {
array_push($this->openAPINullablesSetToNull, 'use_short_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_short_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_short_address'] = $use_short_address;
return $this;
}
/**
* Gets prefix
*
* @return string|null
*/
public function getPrefix()
{
return $this->container['prefix'];
}
/**
* Sets prefix
*
* @param string|null $prefix Prefix to add before the email address for easier labelling or identification.
*
* @return self
*/
public function setPrefix($prefix)
{
if (is_null($prefix)) {
array_push($this->openAPINullablesSetToNull, 'prefix');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('prefix', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['prefix'] = $prefix;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateGroupOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateGroupOptions Class Doc Comment
*
* @category Class
* @description Create contact group options
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateGroupOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateGroupOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'description' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'description' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'description' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'description' => 'description'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'description' => 'setDescription'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'description' => 'getDescription'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description description
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
array_push($this->openAPINullablesSetToNull, 'description');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('description', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['description'] = $description;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateEmergencyAddressOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateEmergencyAddressOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateEmergencyAddressOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateEmergencyAddressOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'customer_name' => 'string',
'address1' => 'string',
'city' => 'string',
'region' => 'string',
'postal_code' => 'string',
'iso_country_code' => 'string',
'display_name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'customer_name' => null,
'address1' => null,
'city' => null,
'region' => null,
'postal_code' => null,
'iso_country_code' => null,
'display_name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'customer_name' => false,
'address1' => false,
'city' => false,
'region' => false,
'postal_code' => false,
'iso_country_code' => false,
'display_name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'customer_name' => 'customerName',
'address1' => 'address1',
'city' => 'city',
'region' => 'region',
'postal_code' => 'postalCode',
'iso_country_code' => 'isoCountryCode',
'display_name' => 'displayName'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'customer_name' => 'setCustomerName',
'address1' => 'setAddress1',
'city' => 'setCity',
'region' => 'setRegion',
'postal_code' => 'setPostalCode',
'iso_country_code' => 'setIsoCountryCode',
'display_name' => 'setDisplayName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'customer_name' => 'getCustomerName',
'address1' => 'getAddress1',
'city' => 'getCity',
'region' => 'getRegion',
'postal_code' => 'getPostalCode',
'iso_country_code' => 'getIsoCountryCode',
'display_name' => 'getDisplayName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const ISO_COUNTRY_CODE_US = 'US';
public const ISO_COUNTRY_CODE_GB = 'GB';
public const ISO_COUNTRY_CODE_AU = 'AU';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getIsoCountryCodeAllowableValues()
{
return [
self::ISO_COUNTRY_CODE_US,
self::ISO_COUNTRY_CODE_GB,
self::ISO_COUNTRY_CODE_AU,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('customer_name', $data ?? [], null);
$this->setIfExists('address1', $data ?? [], null);
$this->setIfExists('city', $data ?? [], null);
$this->setIfExists('region', $data ?? [], null);
$this->setIfExists('postal_code', $data ?? [], null);
$this->setIfExists('iso_country_code', $data ?? [], null);
$this->setIfExists('display_name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['customer_name'] === null) {
$invalidProperties[] = "'customer_name' can't be null";
}
if ($this->container['address1'] === null) {
$invalidProperties[] = "'address1' can't be null";
}
if ($this->container['city'] === null) {
$invalidProperties[] = "'city' can't be null";
}
if ($this->container['region'] === null) {
$invalidProperties[] = "'region' can't be null";
}
if ($this->container['postal_code'] === null) {
$invalidProperties[] = "'postal_code' can't be null";
}
if ($this->container['iso_country_code'] === null) {
$invalidProperties[] = "'iso_country_code' can't be null";
}
$allowedValues = $this->getIsoCountryCodeAllowableValues();
if (!is_null($this->container['iso_country_code']) && !in_array($this->container['iso_country_code'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'iso_country_code', must be one of '%s'",
$this->container['iso_country_code'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets customer_name
*
* @return string
*/
public function getCustomerName()
{
return $this->container['customer_name'];
}
/**
* Sets customer_name
*
* @param string $customer_name customer_name
*
* @return self
*/
public function setCustomerName($customer_name)
{
if (is_null($customer_name)) {
throw new \InvalidArgumentException('non-nullable customer_name cannot be null');
}
$this->container['customer_name'] = $customer_name;
return $this;
}
/**
* Gets address1
*
* @return string
*/
public function getAddress1()
{
return $this->container['address1'];
}
/**
* Sets address1
*
* @param string $address1 address1
*
* @return self
*/
public function setAddress1($address1)
{
if (is_null($address1)) {
throw new \InvalidArgumentException('non-nullable address1 cannot be null');
}
$this->container['address1'] = $address1;
return $this;
}
/**
* Gets city
*
* @return string
*/
public function getCity()
{
return $this->container['city'];
}
/**
* Sets city
*
* @param string $city city
*
* @return self
*/
public function setCity($city)
{
if (is_null($city)) {
throw new \InvalidArgumentException('non-nullable city cannot be null');
}
$this->container['city'] = $city;
return $this;
}
/**
* Gets region
*
* @return string
*/
public function getRegion()
{
return $this->container['region'];
}
/**
* Sets region
*
* @param string $region region
*
* @return self
*/
public function setRegion($region)
{
if (is_null($region)) {
throw new \InvalidArgumentException('non-nullable region cannot be null');
}
$this->container['region'] = $region;
return $this;
}
/**
* Gets postal_code
*
* @return string
*/
public function getPostalCode()
{
return $this->container['postal_code'];
}
/**
* Sets postal_code
*
* @param string $postal_code postal_code
*
* @return self
*/
public function setPostalCode($postal_code)
{
if (is_null($postal_code)) {
throw new \InvalidArgumentException('non-nullable postal_code cannot be null');
}
$this->container['postal_code'] = $postal_code;
return $this;
}
/**
* Gets iso_country_code
*
* @return string
*/
public function getIsoCountryCode()
{
return $this->container['iso_country_code'];
}
/**
* Sets iso_country_code
*
* @param string $iso_country_code iso_country_code
*
* @return self
*/
public function setIsoCountryCode($iso_country_code)
{
$allowedValues = $this->getIsoCountryCodeAllowableValues();
if (!in_array($iso_country_code, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'iso_country_code', must be one of '%s'",
$iso_country_code,
implode("', '", $allowedValues)
)
);
}
if (is_null($iso_country_code)) {
throw new \InvalidArgumentException('non-nullable iso_country_code cannot be null');
}
$this->container['iso_country_code'] = $iso_country_code;
return $this;
}
/**
* Gets display_name
*
* @return string|null
*/
public function getDisplayName()
{
return $this->container['display_name'];
}
/**
* Sets display_name
*
* @param string|null $display_name display_name
*
* @return self
*/
public function setDisplayName($display_name)
{
if (is_null($display_name)) {
throw new \InvalidArgumentException('non-nullable display_name cannot be null');
}
$this->container['display_name'] = $display_name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateDomainOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateDomainOptions Class Doc Comment
*
* @category Class
* @description Options for creating a domain to use with MailSlurp. You must have ownership access to this domain in order to verify it. Domains will not function correctly until the domain has been verified. See https://www.mailslurp.com/guides/custom-domains for help. Domains can be either `HTTP` or `SMTP` type. The type of domain determines which inboxes can be used with it. `SMTP` inboxes use a mail server running `mxslurp.click` while `HTTP` inboxes are handled by AWS SES.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateDomainOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateDomainOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'domain' => 'string',
'description' => 'string',
'created_catch_all_inbox' => 'bool',
'domain_type' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'domain' => null,
'description' => null,
'created_catch_all_inbox' => null,
'domain_type' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'domain' => false,
'description' => true,
'created_catch_all_inbox' => true,
'domain_type' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'domain' => 'domain',
'description' => 'description',
'created_catch_all_inbox' => 'createdCatchAllInbox',
'domain_type' => 'domainType'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'domain' => 'setDomain',
'description' => 'setDescription',
'created_catch_all_inbox' => 'setCreatedCatchAllInbox',
'domain_type' => 'setDomainType'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'domain' => 'getDomain',
'description' => 'getDescription',
'created_catch_all_inbox' => 'getCreatedCatchAllInbox',
'domain_type' => 'getDomainType'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const DOMAIN_TYPE_HTTP_INBOX = 'HTTP_INBOX';
public const DOMAIN_TYPE_SMTP_DOMAIN = 'SMTP_DOMAIN';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getDomainTypeAllowableValues()
{
return [
self::DOMAIN_TYPE_HTTP_INBOX,
self::DOMAIN_TYPE_SMTP_DOMAIN,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('domain', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('created_catch_all_inbox', $data ?? [], null);
$this->setIfExists('domain_type', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['domain'] === null) {
$invalidProperties[] = "'domain' can't be null";
}
$allowedValues = $this->getDomainTypeAllowableValues();
if (!is_null($this->container['domain_type']) && !in_array($this->container['domain_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'domain_type', must be one of '%s'",
$this->container['domain_type'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets domain
*
* @return string
*/
public function getDomain()
{
return $this->container['domain'];
}
/**
* Sets domain
*
* @param string $domain The top level domain you wish to use with MailSlurp. Do not specify subdomain just the top level. So `test.com` covers all subdomains such as `mail.test.com`. Don't include a protocol such as `http://`. Once added you must complete the verification steps by adding the returned records to your domain.
*
* @return self
*/
public function setDomain($domain)
{
if (is_null($domain)) {
throw new \InvalidArgumentException('non-nullable domain cannot be null');
}
$this->container['domain'] = $domain;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description Optional description of the domain.
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
array_push($this->openAPINullablesSetToNull, 'description');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('description', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['description'] = $description;
return $this;
}
/**
* Gets created_catch_all_inbox
*
* @return bool|null
*/
public function getCreatedCatchAllInbox()
{
return $this->container['created_catch_all_inbox'];
}
/**
* Sets created_catch_all_inbox
*
* @param bool|null $created_catch_all_inbox Whether to create a catch all inbox for the domain. Any email sent to an address using your domain that cannot be matched to an existing inbox you created with the domain will be routed to the created catch all inbox. You can access emails using the regular methods on this inbox ID.
*
* @return self
*/
public function setCreatedCatchAllInbox($created_catch_all_inbox)
{
if (is_null($created_catch_all_inbox)) {
array_push($this->openAPINullablesSetToNull, 'created_catch_all_inbox');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('created_catch_all_inbox', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['created_catch_all_inbox'] = $created_catch_all_inbox;
return $this;
}
/**
* Gets domain_type
*
* @return string|null
*/
public function getDomainType()
{
return $this->container['domain_type'];
}
/**
* Sets domain_type
*
* @param string|null $domain_type Type of domain. Dictates type of inbox that can be created with domain. HTTP means inboxes are processed using SES while SMTP inboxes use a custom SMTP mail server. SMTP does not support sending so use HTTP for sending emails.
*
* @return self
*/
public function setDomainType($domain_type)
{
$allowedValues = $this->getDomainTypeAllowableValues();
if (!is_null($domain_type) && !in_array($domain_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'domain_type', must be one of '%s'",
$domain_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($domain_type)) {
array_push($this->openAPINullablesSetToNull, 'domain_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_type'] = $domain_type;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateContactOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateContactOptions Class Doc Comment
*
* @category Class
* @description Options for creating an email contact in address book
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateContactOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateContactOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'first_name' => 'string',
'last_name' => 'string',
'company' => 'string',
'email_addresses' => 'string[]',
'tags' => 'string[]',
'meta_data' => 'object',
'opt_out' => 'bool',
'group_id' => 'string',
'verify_email_addresses' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'first_name' => null,
'last_name' => null,
'company' => null,
'email_addresses' => null,
'tags' => null,
'meta_data' => null,
'opt_out' => null,
'group_id' => 'uuid',
'verify_email_addresses' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'first_name' => true,
'last_name' => true,
'company' => true,
'email_addresses' => true,
'tags' => true,
'meta_data' => true,
'opt_out' => true,
'group_id' => true,
'verify_email_addresses' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'first_name' => 'firstName',
'last_name' => 'lastName',
'company' => 'company',
'email_addresses' => 'emailAddresses',
'tags' => 'tags',
'meta_data' => 'metaData',
'opt_out' => 'optOut',
'group_id' => 'groupId',
'verify_email_addresses' => 'verifyEmailAddresses'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'first_name' => 'setFirstName',
'last_name' => 'setLastName',
'company' => 'setCompany',
'email_addresses' => 'setEmailAddresses',
'tags' => 'setTags',
'meta_data' => 'setMetaData',
'opt_out' => 'setOptOut',
'group_id' => 'setGroupId',
'verify_email_addresses' => 'setVerifyEmailAddresses'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'first_name' => 'getFirstName',
'last_name' => 'getLastName',
'company' => 'getCompany',
'email_addresses' => 'getEmailAddresses',
'tags' => 'getTags',
'meta_data' => 'getMetaData',
'opt_out' => 'getOptOut',
'group_id' => 'getGroupId',
'verify_email_addresses' => 'getVerifyEmailAddresses'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('first_name', $data ?? [], null);
$this->setIfExists('last_name', $data ?? [], null);
$this->setIfExists('company', $data ?? [], null);
$this->setIfExists('email_addresses', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('meta_data', $data ?? [], null);
$this->setIfExists('opt_out', $data ?? [], null);
$this->setIfExists('group_id', $data ?? [], null);
$this->setIfExists('verify_email_addresses', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (!is_null($this->container['email_addresses']) && (count($this->container['email_addresses']) > 1)) {
$invalidProperties[] = "invalid value for 'email_addresses', number of items must be less than or equal to 1.";
}
if (!is_null($this->container['email_addresses']) && (count($this->container['email_addresses']) < 0)) {
$invalidProperties[] = "invalid value for 'email_addresses', number of items must be greater than or equal to 0.";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets first_name
*
* @return string|null
*/
public function getFirstName()
{
return $this->container['first_name'];
}
/**
* Sets first_name
*
* @param string|null $first_name first_name
*
* @return self
*/
public function setFirstName($first_name)
{
if (is_null($first_name)) {
array_push($this->openAPINullablesSetToNull, 'first_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('first_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['first_name'] = $first_name;
return $this;
}
/**
* Gets last_name
*
* @return string|null
*/
public function getLastName()
{
return $this->container['last_name'];
}
/**
* Sets last_name
*
* @param string|null $last_name last_name
*
* @return self
*/
public function setLastName($last_name)
{
if (is_null($last_name)) {
array_push($this->openAPINullablesSetToNull, 'last_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('last_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['last_name'] = $last_name;
return $this;
}
/**
* Gets company
*
* @return string|null
*/
public function getCompany()
{
return $this->container['company'];
}
/**
* Sets company
*
* @param string|null $company company
*
* @return self
*/
public function setCompany($company)
{
if (is_null($company)) {
array_push($this->openAPINullablesSetToNull, 'company');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('company', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['company'] = $company;
return $this;
}
/**
* Gets email_addresses
*
* @return string[]|null
*/
public function getEmailAddresses()
{
return $this->container['email_addresses'];
}
/**
* Sets email_addresses
*
* @param string[]|null $email_addresses Set of email addresses belonging to the contact
*
* @return self
*/
public function setEmailAddresses($email_addresses)
{
if (!is_null($email_addresses) && (count($email_addresses) > 1)) {
throw new \InvalidArgumentException('invalid value for $email_addresses when calling CreateContactOptions., number of items must be less than or equal to 1.');
}
if (!is_null($email_addresses) && (count($email_addresses) < 0)) {
throw new \InvalidArgumentException('invalid length for $email_addresses when calling CreateContactOptions., number of items must be greater than or equal to 0.');
}
if (is_null($email_addresses)) {
array_push($this->openAPINullablesSetToNull, 'email_addresses');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_addresses', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_addresses'] = $email_addresses;
return $this;
}
/**
* Gets tags
*
* @return string[]|null
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[]|null $tags Tags that can be used to search and group contacts
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
array_push($this->openAPINullablesSetToNull, 'tags');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('tags', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets meta_data
*
* @return object|null
*/
public function getMetaData()
{
return $this->container['meta_data'];
}
/**
* Sets meta_data
*
* @param object|null $meta_data meta_data
*
* @return self
*/
public function setMetaData($meta_data)
{
if (is_null($meta_data)) {
array_push($this->openAPINullablesSetToNull, 'meta_data');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('meta_data', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['meta_data'] = $meta_data;
return $this;
}
/**
* Gets opt_out
*
* @return bool|null
*/
public function getOptOut()
{
return $this->container['opt_out'];
}
/**
* Sets opt_out
*
* @param bool|null $opt_out Has the user explicitly or implicitly opted out of being contacted? If so MailSlurp will ignore them in all actions.
*
* @return self
*/
public function setOptOut($opt_out)
{
if (is_null($opt_out)) {
array_push($this->openAPINullablesSetToNull, 'opt_out');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('opt_out', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['opt_out'] = $opt_out;
return $this;
}
/**
* Gets group_id
*
* @return string|null
*/
public function getGroupId()
{
return $this->container['group_id'];
}
/**
* Sets group_id
*
* @param string|null $group_id Group IDs that contact belongs to
*
* @return self
*/
public function setGroupId($group_id)
{
if (is_null($group_id)) {
array_push($this->openAPINullablesSetToNull, 'group_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('group_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['group_id'] = $group_id;
return $this;
}
/**
* Gets verify_email_addresses
*
* @return bool|null
*/
public function getVerifyEmailAddresses()
{
return $this->container['verify_email_addresses'];
}
/**
* Sets verify_email_addresses
*
* @param bool|null $verify_email_addresses Whether to validate contact email address exists
*
* @return self
*/
public function setVerifyEmailAddresses($verify_email_addresses)
{
if (is_null($verify_email_addresses)) {
array_push($this->openAPINullablesSetToNull, 'verify_email_addresses');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('verify_email_addresses', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['verify_email_addresses'] = $verify_email_addresses;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateConnectorSmtpConnectionOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateConnectorSmtpConnectionOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateConnectorSmtpConnectionOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateConnectorSmtpConnectionOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'enabled' => 'bool',
'smtp_host' => 'string',
'smtp_port' => 'int',
'smtp_ssl' => 'bool',
'smtp_username' => 'string',
'smtp_password' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'enabled' => null,
'smtp_host' => null,
'smtp_port' => 'int32',
'smtp_ssl' => null,
'smtp_username' => null,
'smtp_password' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'enabled' => false,
'smtp_host' => false,
'smtp_port' => false,
'smtp_ssl' => false,
'smtp_username' => false,
'smtp_password' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'enabled' => 'enabled',
'smtp_host' => 'smtpHost',
'smtp_port' => 'smtpPort',
'smtp_ssl' => 'smtpSsl',
'smtp_username' => 'smtpUsername',
'smtp_password' => 'smtpPassword'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'enabled' => 'setEnabled',
'smtp_host' => 'setSmtpHost',
'smtp_port' => 'setSmtpPort',
'smtp_ssl' => 'setSmtpSsl',
'smtp_username' => 'setSmtpUsername',
'smtp_password' => 'setSmtpPassword'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'enabled' => 'getEnabled',
'smtp_host' => 'getSmtpHost',
'smtp_port' => 'getSmtpPort',
'smtp_ssl' => 'getSmtpSsl',
'smtp_username' => 'getSmtpUsername',
'smtp_password' => 'getSmtpPassword'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('enabled', $data ?? [], null);
$this->setIfExists('smtp_host', $data ?? [], null);
$this->setIfExists('smtp_port', $data ?? [], null);
$this->setIfExists('smtp_ssl', $data ?? [], null);
$this->setIfExists('smtp_username', $data ?? [], null);
$this->setIfExists('smtp_password', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['smtp_host'] === null) {
$invalidProperties[] = "'smtp_host' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets enabled
*
* @return bool|null
*/
public function getEnabled()
{
return $this->container['enabled'];
}
/**
* Sets enabled
*
* @param bool|null $enabled enabled
*
* @return self
*/
public function setEnabled($enabled)
{
if (is_null($enabled)) {
throw new \InvalidArgumentException('non-nullable enabled cannot be null');
}
$this->container['enabled'] = $enabled;
return $this;
}
/**
* Gets smtp_host
*
* @return string
*/
public function getSmtpHost()
{
return $this->container['smtp_host'];
}
/**
* Sets smtp_host
*
* @param string $smtp_host smtp_host
*
* @return self
*/
public function setSmtpHost($smtp_host)
{
if (is_null($smtp_host)) {
throw new \InvalidArgumentException('non-nullable smtp_host cannot be null');
}
$this->container['smtp_host'] = $smtp_host;
return $this;
}
/**
* Gets smtp_port
*
* @return int|null
*/
public function getSmtpPort()
{
return $this->container['smtp_port'];
}
/**
* Sets smtp_port
*
* @param int|null $smtp_port smtp_port
*
* @return self
*/
public function setSmtpPort($smtp_port)
{
if (is_null($smtp_port)) {
throw new \InvalidArgumentException('non-nullable smtp_port cannot be null');
}
$this->container['smtp_port'] = $smtp_port;
return $this;
}
/**
* Gets smtp_ssl
*
* @return bool|null
*/
public function getSmtpSsl()
{
return $this->container['smtp_ssl'];
}
/**
* Sets smtp_ssl
*
* @param bool|null $smtp_ssl smtp_ssl
*
* @return self
*/
public function setSmtpSsl($smtp_ssl)
{
if (is_null($smtp_ssl)) {
throw new \InvalidArgumentException('non-nullable smtp_ssl cannot be null');
}
$this->container['smtp_ssl'] = $smtp_ssl;
return $this;
}
/**
* Gets smtp_username
*
* @return string|null
*/
public function getSmtpUsername()
{
return $this->container['smtp_username'];
}
/**
* Sets smtp_username
*
* @param string|null $smtp_username smtp_username
*
* @return self
*/
public function setSmtpUsername($smtp_username)
{
if (is_null($smtp_username)) {
throw new \InvalidArgumentException('non-nullable smtp_username cannot be null');
}
$this->container['smtp_username'] = $smtp_username;
return $this;
}
/**
* Gets smtp_password
*
* @return string|null
*/
public function getSmtpPassword()
{
return $this->container['smtp_password'];
}
/**
* Sets smtp_password
*
* @param string|null $smtp_password smtp_password
*
* @return self
*/
public function setSmtpPassword($smtp_password)
{
if (is_null($smtp_password)) {
throw new \InvalidArgumentException('non-nullable smtp_password cannot be null');
}
$this->container['smtp_password'] = $smtp_password;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateConnectorOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateConnectorOptions Class Doc Comment
*
* @category Class
* @description Options for creating an inbox connection with an external mail provider
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateConnectorOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateConnectorOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'sync_enabled' => 'bool',
'sync_schedule_type' => 'string',
'sync_interval' => 'int',
'name' => 'string',
'email_address' => 'string',
'enabled' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'sync_enabled' => null,
'sync_schedule_type' => null,
'sync_interval' => 'int32',
'name' => null,
'email_address' => null,
'enabled' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'sync_enabled' => true,
'sync_schedule_type' => true,
'sync_interval' => true,
'name' => true,
'email_address' => true,
'enabled' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'sync_enabled' => 'syncEnabled',
'sync_schedule_type' => 'syncScheduleType',
'sync_interval' => 'syncInterval',
'name' => 'name',
'email_address' => 'emailAddress',
'enabled' => 'enabled'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'sync_enabled' => 'setSyncEnabled',
'sync_schedule_type' => 'setSyncScheduleType',
'sync_interval' => 'setSyncInterval',
'name' => 'setName',
'email_address' => 'setEmailAddress',
'enabled' => 'setEnabled'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'sync_enabled' => 'getSyncEnabled',
'sync_schedule_type' => 'getSyncScheduleType',
'sync_interval' => 'getSyncInterval',
'name' => 'getName',
'email_address' => 'getEmailAddress',
'enabled' => 'getEnabled'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SYNC_SCHEDULE_TYPE_INTERVAL = 'INTERVAL';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSyncScheduleTypeAllowableValues()
{
return [
self::SYNC_SCHEDULE_TYPE_INTERVAL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('sync_enabled', $data ?? [], null);
$this->setIfExists('sync_schedule_type', $data ?? [], null);
$this->setIfExists('sync_interval', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('enabled', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
$allowedValues = $this->getSyncScheduleTypeAllowableValues();
if (!is_null($this->container['sync_schedule_type']) && !in_array($this->container['sync_schedule_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sync_schedule_type', must be one of '%s'",
$this->container['sync_schedule_type'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets sync_enabled
*
* @return bool|null
*/
public function getSyncEnabled()
{
return $this->container['sync_enabled'];
}
/**
* Sets sync_enabled
*
* @param bool|null $sync_enabled Enable automatic background sync
*
* @return self
*/
public function setSyncEnabled($sync_enabled)
{
if (is_null($sync_enabled)) {
array_push($this->openAPINullablesSetToNull, 'sync_enabled');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sync_enabled', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sync_enabled'] = $sync_enabled;
return $this;
}
/**
* Gets sync_schedule_type
*
* @return string|null
*/
public function getSyncScheduleType()
{
return $this->container['sync_schedule_type'];
}
/**
* Sets sync_schedule_type
*
* @param string|null $sync_schedule_type Sync schedule type
*
* @return self
*/
public function setSyncScheduleType($sync_schedule_type)
{
$allowedValues = $this->getSyncScheduleTypeAllowableValues();
if (!is_null($sync_schedule_type) && !in_array($sync_schedule_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sync_schedule_type', must be one of '%s'",
$sync_schedule_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($sync_schedule_type)) {
array_push($this->openAPINullablesSetToNull, 'sync_schedule_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sync_schedule_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sync_schedule_type'] = $sync_schedule_type;
return $this;
}
/**
* Gets sync_interval
*
* @return int|null
*/
public function getSyncInterval()
{
return $this->container['sync_interval'];
}
/**
* Sets sync_interval
*
* @param int|null $sync_interval Sync interval in minutes
*
* @return self
*/
public function setSyncInterval($sync_interval)
{
if (is_null($sync_interval)) {
array_push($this->openAPINullablesSetToNull, 'sync_interval');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sync_interval', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sync_interval'] = $sync_interval;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Name of connector
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets email_address
*
* @return string|null
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string|null $email_address Email address of external inbox
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
array_push($this->openAPINullablesSetToNull, 'email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets enabled
*
* @return bool|null
*/
public function getEnabled()
{
return $this->container['enabled'];
}
/**
* Sets enabled
*
* @param bool|null $enabled Is connector enabled
*
* @return self
*/
public function setEnabled($enabled)
{
if (is_null($enabled)) {
array_push($this->openAPINullablesSetToNull, 'enabled');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('enabled', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['enabled'] = $enabled;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateConnectorImapConnectionOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateConnectorImapConnectionOptions Class Doc Comment
*
* @category Class
* @description Options for IMAP connection to external email inbox. Allows syncing emails iva IMAP.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateConnectorImapConnectionOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateConnectorImapConnectionOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'imap_ssl' => 'bool',
'imap_username' => 'string',
'imap_password' => 'string',
'select_folder' => 'string',
'search_terms' => 'string',
'imap_port' => 'int',
'imap_host' => 'string',
'enabled' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'imap_ssl' => null,
'imap_username' => null,
'imap_password' => null,
'select_folder' => null,
'search_terms' => null,
'imap_port' => 'int32',
'imap_host' => null,
'enabled' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'imap_ssl' => true,
'imap_username' => true,
'imap_password' => true,
'select_folder' => true,
'search_terms' => true,
'imap_port' => true,
'imap_host' => false,
'enabled' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'imap_ssl' => 'imapSsl',
'imap_username' => 'imapUsername',
'imap_password' => 'imapPassword',
'select_folder' => 'selectFolder',
'search_terms' => 'searchTerms',
'imap_port' => 'imapPort',
'imap_host' => 'imapHost',
'enabled' => 'enabled'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'imap_ssl' => 'setImapSsl',
'imap_username' => 'setImapUsername',
'imap_password' => 'setImapPassword',
'select_folder' => 'setSelectFolder',
'search_terms' => 'setSearchTerms',
'imap_port' => 'setImapPort',
'imap_host' => 'setImapHost',
'enabled' => 'setEnabled'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'imap_ssl' => 'getImapSsl',
'imap_username' => 'getImapUsername',
'imap_password' => 'getImapPassword',
'select_folder' => 'getSelectFolder',
'search_terms' => 'getSearchTerms',
'imap_port' => 'getImapPort',
'imap_host' => 'getImapHost',
'enabled' => 'getEnabled'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('imap_ssl', $data ?? [], null);
$this->setIfExists('imap_username', $data ?? [], null);
$this->setIfExists('imap_password', $data ?? [], null);
$this->setIfExists('select_folder', $data ?? [], null);
$this->setIfExists('search_terms', $data ?? [], null);
$this->setIfExists('imap_port', $data ?? [], null);
$this->setIfExists('imap_host', $data ?? [], null);
$this->setIfExists('enabled', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['imap_host'] === null) {
$invalidProperties[] = "'imap_host' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets imap_ssl
*
* @return bool|null
*/
public function getImapSsl()
{
return $this->container['imap_ssl'];
}
/**
* Sets imap_ssl
*
* @param bool|null $imap_ssl imap_ssl
*
* @return self
*/
public function setImapSsl($imap_ssl)
{
if (is_null($imap_ssl)) {
array_push($this->openAPINullablesSetToNull, 'imap_ssl');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('imap_ssl', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['imap_ssl'] = $imap_ssl;
return $this;
}
/**
* Gets imap_username
*
* @return string|null
*/
public function getImapUsername()
{
return $this->container['imap_username'];
}
/**
* Sets imap_username
*
* @param string|null $imap_username imap_username
*
* @return self
*/
public function setImapUsername($imap_username)
{
if (is_null($imap_username)) {
array_push($this->openAPINullablesSetToNull, 'imap_username');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('imap_username', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['imap_username'] = $imap_username;
return $this;
}
/**
* Gets imap_password
*
* @return string|null
*/
public function getImapPassword()
{
return $this->container['imap_password'];
}
/**
* Sets imap_password
*
* @param string|null $imap_password imap_password
*
* @return self
*/
public function setImapPassword($imap_password)
{
if (is_null($imap_password)) {
array_push($this->openAPINullablesSetToNull, 'imap_password');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('imap_password', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['imap_password'] = $imap_password;
return $this;
}
/**
* Gets select_folder
*
* @return string|null
*/
public function getSelectFolder()
{
return $this->container['select_folder'];
}
/**
* Sets select_folder
*
* @param string|null $select_folder Optional folder to select during IMAP connection
*
* @return self
*/
public function setSelectFolder($select_folder)
{
if (is_null($select_folder)) {
array_push($this->openAPINullablesSetToNull, 'select_folder');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('select_folder', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['select_folder'] = $select_folder;
return $this;
}
/**
* Gets search_terms
*
* @return string|null
*/
public function getSearchTerms()
{
return $this->container['search_terms'];
}
/**
* Sets search_terms
*
* @param string|null $search_terms search_terms
*
* @return self
*/
public function setSearchTerms($search_terms)
{
if (is_null($search_terms)) {
array_push($this->openAPINullablesSetToNull, 'search_terms');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('search_terms', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['search_terms'] = $search_terms;
return $this;
}
/**
* Gets imap_port
*
* @return int|null
*/
public function getImapPort()
{
return $this->container['imap_port'];
}
/**
* Sets imap_port
*
* @param int|null $imap_port IMAP server port
*
* @return self
*/
public function setImapPort($imap_port)
{
if (is_null($imap_port)) {
array_push($this->openAPINullablesSetToNull, 'imap_port');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('imap_port', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['imap_port'] = $imap_port;
return $this;
}
/**
* Gets imap_host
*
* @return string
*/
public function getImapHost()
{
return $this->container['imap_host'];
}
/**
* Sets imap_host
*
* @param string $imap_host IMAP server host
*
* @return self
*/
public function setImapHost($imap_host)
{
if (is_null($imap_host)) {
throw new \InvalidArgumentException('non-nullable imap_host cannot be null');
}
$this->container['imap_host'] = $imap_host;
return $this;
}
/**
* Gets enabled
*
* @return bool|null
*/
public function getEnabled()
{
return $this->container['enabled'];
}
/**
* Sets enabled
*
* @param bool|null $enabled IMAP server enabled
*
* @return self
*/
public function setEnabled($enabled)
{
if (is_null($enabled)) {
array_push($this->openAPINullablesSetToNull, 'enabled');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('enabled', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['enabled'] = $enabled;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CreateAliasOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CreateAliasOptions Class Doc Comment
*
* @category Class
* @description Create email alias options. Email aliases can be used to mask real email addresses behind an ID. You can also attach an inbox to an alias so that any email received by the inbox email address if forwarded to the alias email address.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CreateAliasOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CreateAliasOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_address' => 'string',
'inbox_id' => 'string',
'name' => 'string',
'use_threads' => 'bool',
'domain_id' => 'string',
'verify_email_address' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_address' => null,
'inbox_id' => 'uuid',
'name' => null,
'use_threads' => null,
'domain_id' => 'uuid',
'verify_email_address' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_address' => false,
'inbox_id' => true,
'name' => true,
'use_threads' => false,
'domain_id' => true,
'verify_email_address' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_address' => 'emailAddress',
'inbox_id' => 'inboxId',
'name' => 'name',
'use_threads' => 'useThreads',
'domain_id' => 'domainId',
'verify_email_address' => 'verifyEmailAddress'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_address' => 'setEmailAddress',
'inbox_id' => 'setInboxId',
'name' => 'setName',
'use_threads' => 'setUseThreads',
'domain_id' => 'setDomainId',
'verify_email_address' => 'setVerifyEmailAddress'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_address' => 'getEmailAddress',
'inbox_id' => 'getInboxId',
'name' => 'getName',
'use_threads' => 'getUseThreads',
'domain_id' => 'getDomainId',
'verify_email_address' => 'getVerifyEmailAddress'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('use_threads', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('verify_email_address', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['use_threads'] === null) {
$invalidProperties[] = "'use_threads' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address Email address to be hidden behind alias. Emails sent to the alias email address will be forwarded to this address. If you want to enable replies set useThreads true and the reply-to for the email will allow outbound communication via a thread. Some email addresses may require verification if they are not added as a contact first.
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id Optional inbox ID to attach to alias. Null by default means an a new inbox will be created for the alias. Use a custom inbox to control what email address the alias uses. To use custom email addresses create a domain and an inbox, the use the inbox ID with this call. Emails received by this inbox will be forwarded to the alias email address
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
array_push($this->openAPINullablesSetToNull, 'inbox_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('inbox_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name Optional name for alias
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets use_threads
*
* @return bool
*/
public function getUseThreads()
{
return $this->container['use_threads'];
}
/**
* Sets use_threads
*
* @param bool $use_threads Enable threads options. If true emails will be sent with a unique reply-to thread address. This means you can reply to the forwarded email and it will be sent to the recipients via your alias address. That way a thread conversation is preserved.
*
* @return self
*/
public function setUseThreads($use_threads)
{
if (is_null($use_threads)) {
throw new \InvalidArgumentException('non-nullable use_threads cannot be null');
}
$this->container['use_threads'] = $use_threads;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id Custom domain ID to use when generating alias email addresses
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets verify_email_address
*
* @return bool|null
*/
public function getVerifyEmailAddress()
{
return $this->container['verify_email_address'];
}
/**
* Sets verify_email_address
*
* @param bool|null $verify_email_address Whether to verify the masked email address exists before sending an email to it
*
* @return self
*/
public function setVerifyEmailAddress($verify_email_address)
{
if (is_null($verify_email_address)) {
array_push($this->openAPINullablesSetToNull, 'verify_email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('verify_email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['verify_email_address'] = $verify_email_address;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CountDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CountDto Class Doc Comment
*
* @category Class
* @description Number of elements
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CountDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CountDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'total_elements' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'total_elements' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'total_elements' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'total_elements' => 'totalElements'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'total_elements' => 'setTotalElements'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'total_elements' => 'getTotalElements'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('total_elements', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['total_elements'] === null) {
$invalidProperties[] = "'total_elements' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets total_elements
*
* @return int
*/
public function getTotalElements()
{
return $this->container['total_elements'];
}
/**
* Sets total_elements
*
* @param int $total_elements total_elements
*
* @return self
*/
public function setTotalElements($total_elements)
{
if (is_null($total_elements)) {
throw new \InvalidArgumentException('non-nullable total_elements cannot be null');
}
$this->container['total_elements'] = $total_elements;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ContentMatchOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ContentMatchOptions Class Doc Comment
*
* @category Class
* @description Options for matching content using regex patterns based on Java Pattern syntax
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ContentMatchOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ContentMatchOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'pattern' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'pattern' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'pattern' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'pattern' => 'pattern'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'pattern' => 'setPattern'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'pattern' => 'getPattern'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('pattern', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['pattern'] === null) {
$invalidProperties[] = "'pattern' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets pattern
*
* @return string
*/
public function getPattern()
{
return $this->container['pattern'];
}
/**
* Sets pattern
*
* @param string $pattern Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns.
*
* @return self
*/
public function setPattern($pattern)
{
if (is_null($pattern)) {
throw new \InvalidArgumentException('non-nullable pattern cannot be null');
}
$this->container['pattern'] = $pattern;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ContactProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ContactProjection Class Doc Comment
*
* @category Class
* @description Email contact for address book
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ContactProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ContactProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'email_address' => 'string',
'email_addresses' => 'string[]',
'first_name' => 'string',
'last_name' => 'string',
'company' => 'string',
'opt_out' => 'bool',
'id' => 'string',
'group_id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'email_address' => null,
'email_addresses' => null,
'first_name' => null,
'last_name' => null,
'company' => null,
'opt_out' => null,
'id' => 'uuid',
'group_id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'email_address' => true,
'email_addresses' => true,
'first_name' => true,
'last_name' => true,
'company' => true,
'opt_out' => true,
'id' => false,
'group_id' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'email_address' => 'emailAddress',
'email_addresses' => 'emailAddresses',
'first_name' => 'firstName',
'last_name' => 'lastName',
'company' => 'company',
'opt_out' => 'optOut',
'id' => 'id',
'group_id' => 'groupId'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'email_address' => 'setEmailAddress',
'email_addresses' => 'setEmailAddresses',
'first_name' => 'setFirstName',
'last_name' => 'setLastName',
'company' => 'setCompany',
'opt_out' => 'setOptOut',
'id' => 'setId',
'group_id' => 'setGroupId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'email_address' => 'getEmailAddress',
'email_addresses' => 'getEmailAddresses',
'first_name' => 'getFirstName',
'last_name' => 'getLastName',
'company' => 'getCompany',
'opt_out' => 'getOptOut',
'id' => 'getId',
'group_id' => 'getGroupId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('email_addresses', $data ?? [], null);
$this->setIfExists('first_name', $data ?? [], null);
$this->setIfExists('last_name', $data ?? [], null);
$this->setIfExists('company', $data ?? [], null);
$this->setIfExists('opt_out', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('group_id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets email_address
*
* @return string|null
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string|null $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
array_push($this->openAPINullablesSetToNull, 'email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets email_addresses
*
* @return string[]|null
*/
public function getEmailAddresses()
{
return $this->container['email_addresses'];
}
/**
* Sets email_addresses
*
* @param string[]|null $email_addresses email_addresses
*
* @return self
*/
public function setEmailAddresses($email_addresses)
{
if (is_null($email_addresses)) {
array_push($this->openAPINullablesSetToNull, 'email_addresses');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('email_addresses', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['email_addresses'] = $email_addresses;
return $this;
}
/**
* Gets first_name
*
* @return string|null
*/
public function getFirstName()
{
return $this->container['first_name'];
}
/**
* Sets first_name
*
* @param string|null $first_name first_name
*
* @return self
*/
public function setFirstName($first_name)
{
if (is_null($first_name)) {
array_push($this->openAPINullablesSetToNull, 'first_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('first_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['first_name'] = $first_name;
return $this;
}
/**
* Gets last_name
*
* @return string|null
*/
public function getLastName()
{
return $this->container['last_name'];
}
/**
* Sets last_name
*
* @param string|null $last_name last_name
*
* @return self
*/
public function setLastName($last_name)
{
if (is_null($last_name)) {
array_push($this->openAPINullablesSetToNull, 'last_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('last_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['last_name'] = $last_name;
return $this;
}
/**
* Gets company
*
* @return string|null
*/
public function getCompany()
{
return $this->container['company'];
}
/**
* Sets company
*
* @param string|null $company company
*
* @return self
*/
public function setCompany($company)
{
if (is_null($company)) {
array_push($this->openAPINullablesSetToNull, 'company');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('company', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['company'] = $company;
return $this;
}
/**
* Gets opt_out
*
* @return bool|null
*/
public function getOptOut()
{
return $this->container['opt_out'];
}
/**
* Sets opt_out
*
* @param bool|null $opt_out opt_out
*
* @return self
*/
public function setOptOut($opt_out)
{
if (is_null($opt_out)) {
array_push($this->openAPINullablesSetToNull, 'opt_out');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('opt_out', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['opt_out'] = $opt_out;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets group_id
*
* @return string|null
*/
public function getGroupId()
{
return $this->container['group_id'];
}
/**
* Sets group_id
*
* @param string|null $group_id group_id
*
* @return self
*/
public function setGroupId($group_id)
{
if (is_null($group_id)) {
array_push($this->openAPINullablesSetToNull, 'group_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('group_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['group_id'] = $group_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ContactDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ContactDto Class Doc Comment
*
* @category Class
* @description Contact object. For saving a user in contact book.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ContactDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ContactDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'group_id' => 'string',
'first_name' => 'string',
'last_name' => 'string',
'company' => 'string',
'email_addresses' => 'string[]',
'primary_email_address' => 'string',
'tags' => 'string[]',
'meta_data' => 'object',
'opt_out' => 'bool',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'group_id' => 'uuid',
'first_name' => null,
'last_name' => null,
'company' => null,
'email_addresses' => null,
'primary_email_address' => null,
'tags' => null,
'meta_data' => null,
'opt_out' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'group_id' => true,
'first_name' => true,
'last_name' => true,
'company' => true,
'email_addresses' => false,
'primary_email_address' => true,
'tags' => false,
'meta_data' => true,
'opt_out' => true,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'group_id' => 'groupId',
'first_name' => 'firstName',
'last_name' => 'lastName',
'company' => 'company',
'email_addresses' => 'emailAddresses',
'primary_email_address' => 'primaryEmailAddress',
'tags' => 'tags',
'meta_data' => 'metaData',
'opt_out' => 'optOut',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'group_id' => 'setGroupId',
'first_name' => 'setFirstName',
'last_name' => 'setLastName',
'company' => 'setCompany',
'email_addresses' => 'setEmailAddresses',
'primary_email_address' => 'setPrimaryEmailAddress',
'tags' => 'setTags',
'meta_data' => 'setMetaData',
'opt_out' => 'setOptOut',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'group_id' => 'getGroupId',
'first_name' => 'getFirstName',
'last_name' => 'getLastName',
'company' => 'getCompany',
'email_addresses' => 'getEmailAddresses',
'primary_email_address' => 'getPrimaryEmailAddress',
'tags' => 'getTags',
'meta_data' => 'getMetaData',
'opt_out' => 'getOptOut',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('group_id', $data ?? [], null);
$this->setIfExists('first_name', $data ?? [], null);
$this->setIfExists('last_name', $data ?? [], null);
$this->setIfExists('company', $data ?? [], null);
$this->setIfExists('email_addresses', $data ?? [], null);
$this->setIfExists('primary_email_address', $data ?? [], null);
$this->setIfExists('tags', $data ?? [], null);
$this->setIfExists('meta_data', $data ?? [], null);
$this->setIfExists('opt_out', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['email_addresses'] === null) {
$invalidProperties[] = "'email_addresses' can't be null";
}
if ($this->container['tags'] === null) {
$invalidProperties[] = "'tags' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets group_id
*
* @return string|null
*/
public function getGroupId()
{
return $this->container['group_id'];
}
/**
* Sets group_id
*
* @param string|null $group_id group_id
*
* @return self
*/
public function setGroupId($group_id)
{
if (is_null($group_id)) {
array_push($this->openAPINullablesSetToNull, 'group_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('group_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['group_id'] = $group_id;
return $this;
}
/**
* Gets first_name
*
* @return string|null
*/
public function getFirstName()
{
return $this->container['first_name'];
}
/**
* Sets first_name
*
* @param string|null $first_name first_name
*
* @return self
*/
public function setFirstName($first_name)
{
if (is_null($first_name)) {
array_push($this->openAPINullablesSetToNull, 'first_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('first_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['first_name'] = $first_name;
return $this;
}
/**
* Gets last_name
*
* @return string|null
*/
public function getLastName()
{
return $this->container['last_name'];
}
/**
* Sets last_name
*
* @param string|null $last_name last_name
*
* @return self
*/
public function setLastName($last_name)
{
if (is_null($last_name)) {
array_push($this->openAPINullablesSetToNull, 'last_name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('last_name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['last_name'] = $last_name;
return $this;
}
/**
* Gets company
*
* @return string|null
*/
public function getCompany()
{
return $this->container['company'];
}
/**
* Sets company
*
* @param string|null $company company
*
* @return self
*/
public function setCompany($company)
{
if (is_null($company)) {
array_push($this->openAPINullablesSetToNull, 'company');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('company', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['company'] = $company;
return $this;
}
/**
* Gets email_addresses
*
* @return string[]
*/
public function getEmailAddresses()
{
return $this->container['email_addresses'];
}
/**
* Sets email_addresses
*
* @param string[] $email_addresses email_addresses
*
* @return self
*/
public function setEmailAddresses($email_addresses)
{
if (is_null($email_addresses)) {
throw new \InvalidArgumentException('non-nullable email_addresses cannot be null');
}
$this->container['email_addresses'] = $email_addresses;
return $this;
}
/**
* Gets primary_email_address
*
* @return string|null
*/
public function getPrimaryEmailAddress()
{
return $this->container['primary_email_address'];
}
/**
* Sets primary_email_address
*
* @param string|null $primary_email_address primary_email_address
*
* @return self
*/
public function setPrimaryEmailAddress($primary_email_address)
{
if (is_null($primary_email_address)) {
array_push($this->openAPINullablesSetToNull, 'primary_email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('primary_email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['primary_email_address'] = $primary_email_address;
return $this;
}
/**
* Gets tags
*
* @return string[]
*/
public function getTags()
{
return $this->container['tags'];
}
/**
* Sets tags
*
* @param string[] $tags tags
*
* @return self
*/
public function setTags($tags)
{
if (is_null($tags)) {
throw new \InvalidArgumentException('non-nullable tags cannot be null');
}
$this->container['tags'] = $tags;
return $this;
}
/**
* Gets meta_data
*
* @return object|null
*/
public function getMetaData()
{
return $this->container['meta_data'];
}
/**
* Sets meta_data
*
* @param object|null $meta_data meta_data
*
* @return self
*/
public function setMetaData($meta_data)
{
if (is_null($meta_data)) {
array_push($this->openAPINullablesSetToNull, 'meta_data');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('meta_data', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['meta_data'] = $meta_data;
return $this;
}
/**
* Gets opt_out
*
* @return bool|null
*/
public function getOptOut()
{
return $this->container['opt_out'];
}
/**
* Sets opt_out
*
* @param bool|null $opt_out opt_out
*
* @return self
*/
public function setOptOut($opt_out)
{
if (is_null($opt_out)) {
array_push($this->openAPINullablesSetToNull, 'opt_out');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('opt_out', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['opt_out'] = $opt_out;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSyncResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSyncResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSyncResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSyncResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_sync_count' => 'int',
'log_lines' => 'string[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_sync_count' => 'int32',
'log_lines' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_sync_count' => false,
'log_lines' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_sync_count' => 'emailSyncCount',
'log_lines' => 'logLines'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_sync_count' => 'setEmailSyncCount',
'log_lines' => 'setLogLines'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_sync_count' => 'getEmailSyncCount',
'log_lines' => 'getLogLines'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_sync_count', $data ?? [], null);
$this->setIfExists('log_lines', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_sync_count'] === null) {
$invalidProperties[] = "'email_sync_count' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_sync_count
*
* @return int
*/
public function getEmailSyncCount()
{
return $this->container['email_sync_count'];
}
/**
* Sets email_sync_count
*
* @param int $email_sync_count email_sync_count
*
* @return self
*/
public function setEmailSyncCount($email_sync_count)
{
if (is_null($email_sync_count)) {
throw new \InvalidArgumentException('non-nullable email_sync_count cannot be null');
}
$this->container['email_sync_count'] = $email_sync_count;
return $this;
}
/**
* Gets log_lines
*
* @return string[]|null
*/
public function getLogLines()
{
return $this->container['log_lines'];
}
/**
* Sets log_lines
*
* @param string[]|null $log_lines log_lines
*
* @return self
*/
public function setLogLines($log_lines)
{
if (is_null($log_lines)) {
throw new \InvalidArgumentException('non-nullable log_lines cannot be null');
}
$this->container['log_lines'] = $log_lines;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSyncRequestResultExceptionCauseStackTraceInner
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSyncRequestResultExceptionCauseStackTraceInner Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSyncRequestResultExceptionCauseStackTraceInner implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSyncRequestResult_exception_cause_stackTrace_inner';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'class_loader_name' => 'string',
'module_name' => 'string',
'module_version' => 'string',
'method_name' => 'string',
'file_name' => 'string',
'line_number' => 'int',
'class_name' => 'string',
'native_method' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'class_loader_name' => null,
'module_name' => null,
'module_version' => null,
'method_name' => null,
'file_name' => null,
'line_number' => 'int32',
'class_name' => null,
'native_method' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'class_loader_name' => false,
'module_name' => false,
'module_version' => false,
'method_name' => false,
'file_name' => false,
'line_number' => false,
'class_name' => false,
'native_method' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'class_loader_name' => 'classLoaderName',
'module_name' => 'moduleName',
'module_version' => 'moduleVersion',
'method_name' => 'methodName',
'file_name' => 'fileName',
'line_number' => 'lineNumber',
'class_name' => 'className',
'native_method' => 'nativeMethod'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'class_loader_name' => 'setClassLoaderName',
'module_name' => 'setModuleName',
'module_version' => 'setModuleVersion',
'method_name' => 'setMethodName',
'file_name' => 'setFileName',
'line_number' => 'setLineNumber',
'class_name' => 'setClassName',
'native_method' => 'setNativeMethod'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'class_loader_name' => 'getClassLoaderName',
'module_name' => 'getModuleName',
'module_version' => 'getModuleVersion',
'method_name' => 'getMethodName',
'file_name' => 'getFileName',
'line_number' => 'getLineNumber',
'class_name' => 'getClassName',
'native_method' => 'getNativeMethod'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('class_loader_name', $data ?? [], null);
$this->setIfExists('module_name', $data ?? [], null);
$this->setIfExists('module_version', $data ?? [], null);
$this->setIfExists('method_name', $data ?? [], null);
$this->setIfExists('file_name', $data ?? [], null);
$this->setIfExists('line_number', $data ?? [], null);
$this->setIfExists('class_name', $data ?? [], null);
$this->setIfExists('native_method', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets class_loader_name
*
* @return string|null
*/
public function getClassLoaderName()
{
return $this->container['class_loader_name'];
}
/**
* Sets class_loader_name
*
* @param string|null $class_loader_name class_loader_name
*
* @return self
*/
public function setClassLoaderName($class_loader_name)
{
if (is_null($class_loader_name)) {
throw new \InvalidArgumentException('non-nullable class_loader_name cannot be null');
}
$this->container['class_loader_name'] = $class_loader_name;
return $this;
}
/**
* Gets module_name
*
* @return string|null
*/
public function getModuleName()
{
return $this->container['module_name'];
}
/**
* Sets module_name
*
* @param string|null $module_name module_name
*
* @return self
*/
public function setModuleName($module_name)
{
if (is_null($module_name)) {
throw new \InvalidArgumentException('non-nullable module_name cannot be null');
}
$this->container['module_name'] = $module_name;
return $this;
}
/**
* Gets module_version
*
* @return string|null
*/
public function getModuleVersion()
{
return $this->container['module_version'];
}
/**
* Sets module_version
*
* @param string|null $module_version module_version
*
* @return self
*/
public function setModuleVersion($module_version)
{
if (is_null($module_version)) {
throw new \InvalidArgumentException('non-nullable module_version cannot be null');
}
$this->container['module_version'] = $module_version;
return $this;
}
/**
* Gets method_name
*
* @return string|null
*/
public function getMethodName()
{
return $this->container['method_name'];
}
/**
* Sets method_name
*
* @param string|null $method_name method_name
*
* @return self
*/
public function setMethodName($method_name)
{
if (is_null($method_name)) {
throw new \InvalidArgumentException('non-nullable method_name cannot be null');
}
$this->container['method_name'] = $method_name;
return $this;
}
/**
* Gets file_name
*
* @return string|null
*/
public function getFileName()
{
return $this->container['file_name'];
}
/**
* Sets file_name
*
* @param string|null $file_name file_name
*
* @return self
*/
public function setFileName($file_name)
{
if (is_null($file_name)) {
throw new \InvalidArgumentException('non-nullable file_name cannot be null');
}
$this->container['file_name'] = $file_name;
return $this;
}
/**
* Gets line_number
*
* @return int|null
*/
public function getLineNumber()
{
return $this->container['line_number'];
}
/**
* Sets line_number
*
* @param int|null $line_number line_number
*
* @return self
*/
public function setLineNumber($line_number)
{
if (is_null($line_number)) {
throw new \InvalidArgumentException('non-nullable line_number cannot be null');
}
$this->container['line_number'] = $line_number;
return $this;
}
/**
* Gets class_name
*
* @return string|null
*/
public function getClassName()
{
return $this->container['class_name'];
}
/**
* Sets class_name
*
* @param string|null $class_name class_name
*
* @return self
*/
public function setClassName($class_name)
{
if (is_null($class_name)) {
throw new \InvalidArgumentException('non-nullable class_name cannot be null');
}
$this->container['class_name'] = $class_name;
return $this;
}
/**
* Gets native_method
*
* @return bool|null
*/
public function getNativeMethod()
{
return $this->container['native_method'];
}
/**
* Sets native_method
*
* @param bool|null $native_method native_method
*
* @return self
*/
public function setNativeMethod($native_method)
{
if (is_null($native_method)) {
throw new \InvalidArgumentException('non-nullable native_method cannot be null');
}
$this->container['native_method'] = $native_method;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSyncRequestResultExceptionCause
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSyncRequestResultExceptionCause Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSyncRequestResultExceptionCause implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSyncRequestResult_exception_cause';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'stack_trace' => '\MailSlurp\Models\ConnectorSyncRequestResultExceptionCauseStackTraceInner[]',
'message' => 'string',
'localized_message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'stack_trace' => null,
'message' => null,
'localized_message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'stack_trace' => false,
'message' => false,
'localized_message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'stack_trace' => 'stackTrace',
'message' => 'message',
'localized_message' => 'localizedMessage'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'stack_trace' => 'setStackTrace',
'message' => 'setMessage',
'localized_message' => 'setLocalizedMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'stack_trace' => 'getStackTrace',
'message' => 'getMessage',
'localized_message' => 'getLocalizedMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('stack_trace', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('localized_message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets stack_trace
*
* @return \MailSlurp\Models\ConnectorSyncRequestResultExceptionCauseStackTraceInner[]|null
*/
public function getStackTrace()
{
return $this->container['stack_trace'];
}
/**
* Sets stack_trace
*
* @param \MailSlurp\Models\ConnectorSyncRequestResultExceptionCauseStackTraceInner[]|null $stack_trace stack_trace
*
* @return self
*/
public function setStackTrace($stack_trace)
{
if (is_null($stack_trace)) {
throw new \InvalidArgumentException('non-nullable stack_trace cannot be null');
}
$this->container['stack_trace'] = $stack_trace;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets localized_message
*
* @return string|null
*/
public function getLocalizedMessage()
{
return $this->container['localized_message'];
}
/**
* Sets localized_message
*
* @param string|null $localized_message localized_message
*
* @return self
*/
public function setLocalizedMessage($localized_message)
{
if (is_null($localized_message)) {
throw new \InvalidArgumentException('non-nullable localized_message cannot be null');
}
$this->container['localized_message'] = $localized_message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSyncRequestResultException
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSyncRequestResultException Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSyncRequestResultException implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSyncRequestResult_exception';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'cause' => '\MailSlurp\Models\ConnectorSyncRequestResultExceptionCause',
'stack_trace' => '\MailSlurp\Models\ConnectorSyncRequestResultExceptionCauseStackTraceInner[]',
'message' => 'string',
'suppressed' => '\MailSlurp\Models\ConnectorSyncRequestResultExceptionCause[]',
'localized_message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'cause' => null,
'stack_trace' => null,
'message' => null,
'suppressed' => null,
'localized_message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'cause' => false,
'stack_trace' => false,
'message' => false,
'suppressed' => false,
'localized_message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'cause' => 'cause',
'stack_trace' => 'stackTrace',
'message' => 'message',
'suppressed' => 'suppressed',
'localized_message' => 'localizedMessage'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'cause' => 'setCause',
'stack_trace' => 'setStackTrace',
'message' => 'setMessage',
'suppressed' => 'setSuppressed',
'localized_message' => 'setLocalizedMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'cause' => 'getCause',
'stack_trace' => 'getStackTrace',
'message' => 'getMessage',
'suppressed' => 'getSuppressed',
'localized_message' => 'getLocalizedMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('cause', $data ?? [], null);
$this->setIfExists('stack_trace', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('suppressed', $data ?? [], null);
$this->setIfExists('localized_message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets cause
*
* @return \MailSlurp\Models\ConnectorSyncRequestResultExceptionCause|null
*/
public function getCause()
{
return $this->container['cause'];
}
/**
* Sets cause
*
* @param \MailSlurp\Models\ConnectorSyncRequestResultExceptionCause|null $cause cause
*
* @return self
*/
public function setCause($cause)
{
if (is_null($cause)) {
throw new \InvalidArgumentException('non-nullable cause cannot be null');
}
$this->container['cause'] = $cause;
return $this;
}
/**
* Gets stack_trace
*
* @return \MailSlurp\Models\ConnectorSyncRequestResultExceptionCauseStackTraceInner[]|null
*/
public function getStackTrace()
{
return $this->container['stack_trace'];
}
/**
* Sets stack_trace
*
* @param \MailSlurp\Models\ConnectorSyncRequestResultExceptionCauseStackTraceInner[]|null $stack_trace stack_trace
*
* @return self
*/
public function setStackTrace($stack_trace)
{
if (is_null($stack_trace)) {
throw new \InvalidArgumentException('non-nullable stack_trace cannot be null');
}
$this->container['stack_trace'] = $stack_trace;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets suppressed
*
* @return \MailSlurp\Models\ConnectorSyncRequestResultExceptionCause[]|null
*/
public function getSuppressed()
{
return $this->container['suppressed'];
}
/**
* Sets suppressed
*
* @param \MailSlurp\Models\ConnectorSyncRequestResultExceptionCause[]|null $suppressed suppressed
*
* @return self
*/
public function setSuppressed($suppressed)
{
if (is_null($suppressed)) {
throw new \InvalidArgumentException('non-nullable suppressed cannot be null');
}
$this->container['suppressed'] = $suppressed;
return $this;
}
/**
* Gets localized_message
*
* @return string|null
*/
public function getLocalizedMessage()
{
return $this->container['localized_message'];
}
/**
* Sets localized_message
*
* @param string|null $localized_message localized_message
*
* @return self
*/
public function setLocalizedMessage($localized_message)
{
if (is_null($localized_message)) {
throw new \InvalidArgumentException('non-nullable localized_message cannot be null');
}
$this->container['localized_message'] = $localized_message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSyncRequestResult
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSyncRequestResult Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSyncRequestResult implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSyncRequestResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'sync_result' => '\MailSlurp\Models\ConnectorSyncResult',
'exception' => '\MailSlurp\Models\ConnectorSyncRequestResultException',
'event_id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'sync_result' => null,
'exception' => null,
'event_id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'sync_result' => false,
'exception' => false,
'event_id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'sync_result' => 'syncResult',
'exception' => 'exception',
'event_id' => 'eventId'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'sync_result' => 'setSyncResult',
'exception' => 'setException',
'event_id' => 'setEventId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'sync_result' => 'getSyncResult',
'exception' => 'getException',
'event_id' => 'getEventId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('sync_result', $data ?? [], null);
$this->setIfExists('exception', $data ?? [], null);
$this->setIfExists('event_id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets sync_result
*
* @return \MailSlurp\Models\ConnectorSyncResult|null
*/
public function getSyncResult()
{
return $this->container['sync_result'];
}
/**
* Sets sync_result
*
* @param \MailSlurp\Models\ConnectorSyncResult|null $sync_result sync_result
*
* @return self
*/
public function setSyncResult($sync_result)
{
if (is_null($sync_result)) {
throw new \InvalidArgumentException('non-nullable sync_result cannot be null');
}
$this->container['sync_result'] = $sync_result;
return $this;
}
/**
* Gets exception
*
* @return \MailSlurp\Models\ConnectorSyncRequestResultException|null
*/
public function getException()
{
return $this->container['exception'];
}
/**
* Sets exception
*
* @param \MailSlurp\Models\ConnectorSyncRequestResultException|null $exception exception
*
* @return self
*/
public function setException($exception)
{
if (is_null($exception)) {
throw new \InvalidArgumentException('non-nullable exception cannot be null');
}
$this->container['exception'] = $exception;
return $this;
}
/**
* Gets event_id
*
* @return string|null
*/
public function getEventId()
{
return $this->container['event_id'];
}
/**
* Sets event_id
*
* @param string|null $event_id event_id
*
* @return self
*/
public function setEventId($event_id)
{
if (is_null($event_id)) {
throw new \InvalidArgumentException('non-nullable event_id cannot be null');
}
$this->container['event_id'] = $event_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSyncEventProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSyncEventProjection Class Doc Comment
*
* @category Class
* @description ConnectorSyncEventProjection
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSyncEventProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSyncEventProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'connector_id' => 'string',
'sync_count' => 'int',
'sync_status' => 'string',
'message' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'connector_id' => 'uuid',
'sync_count' => 'int64',
'sync_status' => null,
'message' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'connector_id' => false,
'sync_count' => false,
'sync_status' => false,
'message' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'connector_id' => 'connectorId',
'sync_count' => 'syncCount',
'sync_status' => 'syncStatus',
'message' => 'message',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'connector_id' => 'setConnectorId',
'sync_count' => 'setSyncCount',
'sync_status' => 'setSyncStatus',
'message' => 'setMessage',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'connector_id' => 'getConnectorId',
'sync_count' => 'getSyncCount',
'sync_status' => 'getSyncStatus',
'message' => 'getMessage',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SYNC_STATUS_SUCCESS = 'SUCCESS';
public const SYNC_STATUS_INTERNAL_ERROR = 'INTERNAL_ERROR';
public const SYNC_STATUS_SUBSCRIPTION_ERROR = 'SUBSCRIPTION_ERROR';
public const SYNC_STATUS_CONNECTION_ERROR = 'CONNECTION_ERROR';
public const SYNC_STATUS_NOT_FOUND = 'NOT_FOUND';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSyncStatusAllowableValues()
{
return [
self::SYNC_STATUS_SUCCESS,
self::SYNC_STATUS_INTERNAL_ERROR,
self::SYNC_STATUS_SUBSCRIPTION_ERROR,
self::SYNC_STATUS_CONNECTION_ERROR,
self::SYNC_STATUS_NOT_FOUND,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('connector_id', $data ?? [], null);
$this->setIfExists('sync_count', $data ?? [], null);
$this->setIfExists('sync_status', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['connector_id'] === null) {
$invalidProperties[] = "'connector_id' can't be null";
}
if ($this->container['sync_count'] === null) {
$invalidProperties[] = "'sync_count' can't be null";
}
if ($this->container['sync_status'] === null) {
$invalidProperties[] = "'sync_status' can't be null";
}
$allowedValues = $this->getSyncStatusAllowableValues();
if (!is_null($this->container['sync_status']) && !in_array($this->container['sync_status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sync_status', must be one of '%s'",
$this->container['sync_status'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets connector_id
*
* @return string
*/
public function getConnectorId()
{
return $this->container['connector_id'];
}
/**
* Sets connector_id
*
* @param string $connector_id connector_id
*
* @return self
*/
public function setConnectorId($connector_id)
{
if (is_null($connector_id)) {
throw new \InvalidArgumentException('non-nullable connector_id cannot be null');
}
$this->container['connector_id'] = $connector_id;
return $this;
}
/**
* Gets sync_count
*
* @return int
*/
public function getSyncCount()
{
return $this->container['sync_count'];
}
/**
* Sets sync_count
*
* @param int $sync_count sync_count
*
* @return self
*/
public function setSyncCount($sync_count)
{
if (is_null($sync_count)) {
throw new \InvalidArgumentException('non-nullable sync_count cannot be null');
}
$this->container['sync_count'] = $sync_count;
return $this;
}
/**
* Gets sync_status
*
* @return string
*/
public function getSyncStatus()
{
return $this->container['sync_status'];
}
/**
* Sets sync_status
*
* @param string $sync_status sync_status
*
* @return self
*/
public function setSyncStatus($sync_status)
{
$allowedValues = $this->getSyncStatusAllowableValues();
if (!in_array($sync_status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sync_status', must be one of '%s'",
$sync_status,
implode("', '", $allowedValues)
)
);
}
if (is_null($sync_status)) {
throw new \InvalidArgumentException('non-nullable sync_status cannot be null');
}
$this->container['sync_status'] = $sync_status;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSyncEventDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSyncEventDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSyncEventDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSyncEventDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'connector_id' => 'string',
'sync_status' => 'string',
'sync_count' => 'int',
'message' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'connector_id' => 'uuid',
'sync_status' => null,
'sync_count' => 'int64',
'message' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'connector_id' => false,
'sync_status' => false,
'sync_count' => false,
'message' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'connector_id' => 'connectorId',
'sync_status' => 'syncStatus',
'sync_count' => 'syncCount',
'message' => 'message',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'connector_id' => 'setConnectorId',
'sync_status' => 'setSyncStatus',
'sync_count' => 'setSyncCount',
'message' => 'setMessage',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'connector_id' => 'getConnectorId',
'sync_status' => 'getSyncStatus',
'sync_count' => 'getSyncCount',
'message' => 'getMessage',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SYNC_STATUS_SUCCESS = 'SUCCESS';
public const SYNC_STATUS_INTERNAL_ERROR = 'INTERNAL_ERROR';
public const SYNC_STATUS_SUBSCRIPTION_ERROR = 'SUBSCRIPTION_ERROR';
public const SYNC_STATUS_CONNECTION_ERROR = 'CONNECTION_ERROR';
public const SYNC_STATUS_NOT_FOUND = 'NOT_FOUND';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSyncStatusAllowableValues()
{
return [
self::SYNC_STATUS_SUCCESS,
self::SYNC_STATUS_INTERNAL_ERROR,
self::SYNC_STATUS_SUBSCRIPTION_ERROR,
self::SYNC_STATUS_CONNECTION_ERROR,
self::SYNC_STATUS_NOT_FOUND,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('connector_id', $data ?? [], null);
$this->setIfExists('sync_status', $data ?? [], null);
$this->setIfExists('sync_count', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['connector_id'] === null) {
$invalidProperties[] = "'connector_id' can't be null";
}
if ($this->container['sync_status'] === null) {
$invalidProperties[] = "'sync_status' can't be null";
}
$allowedValues = $this->getSyncStatusAllowableValues();
if (!is_null($this->container['sync_status']) && !in_array($this->container['sync_status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sync_status', must be one of '%s'",
$this->container['sync_status'],
implode("', '", $allowedValues)
);
}
if ($this->container['sync_count'] === null) {
$invalidProperties[] = "'sync_count' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets connector_id
*
* @return string
*/
public function getConnectorId()
{
return $this->container['connector_id'];
}
/**
* Sets connector_id
*
* @param string $connector_id connector_id
*
* @return self
*/
public function setConnectorId($connector_id)
{
if (is_null($connector_id)) {
throw new \InvalidArgumentException('non-nullable connector_id cannot be null');
}
$this->container['connector_id'] = $connector_id;
return $this;
}
/**
* Gets sync_status
*
* @return string
*/
public function getSyncStatus()
{
return $this->container['sync_status'];
}
/**
* Sets sync_status
*
* @param string $sync_status sync_status
*
* @return self
*/
public function setSyncStatus($sync_status)
{
$allowedValues = $this->getSyncStatusAllowableValues();
if (!in_array($sync_status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sync_status', must be one of '%s'",
$sync_status,
implode("', '", $allowedValues)
)
);
}
if (is_null($sync_status)) {
throw new \InvalidArgumentException('non-nullable sync_status cannot be null');
}
$this->container['sync_status'] = $sync_status;
return $this;
}
/**
* Gets sync_count
*
* @return int
*/
public function getSyncCount()
{
return $this->container['sync_count'];
}
/**
* Sets sync_count
*
* @param int $sync_count sync_count
*
* @return self
*/
public function setSyncCount($sync_count)
{
if (is_null($sync_count)) {
throw new \InvalidArgumentException('non-nullable sync_count cannot be null');
}
$this->container['sync_count'] = $sync_count;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorSmtpConnectionDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorSmtpConnectionDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorSmtpConnectionDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorSmtpConnectionDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'connector_id' => 'string',
'smtp_host' => 'string',
'smtp_port' => 'int',
'smtp_username' => 'string',
'smtp_password' => 'string',
'smtp_ssl' => 'bool',
'enabled' => 'bool',
'created_at' => '\DateTime',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'connector_id' => 'uuid',
'smtp_host' => null,
'smtp_port' => 'int32',
'smtp_username' => null,
'smtp_password' => null,
'smtp_ssl' => null,
'enabled' => null,
'created_at' => 'date-time',
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'connector_id' => false,
'smtp_host' => false,
'smtp_port' => false,
'smtp_username' => false,
'smtp_password' => false,
'smtp_ssl' => false,
'enabled' => false,
'created_at' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'connector_id' => 'connectorId',
'smtp_host' => 'smtpHost',
'smtp_port' => 'smtpPort',
'smtp_username' => 'smtpUsername',
'smtp_password' => 'smtpPassword',
'smtp_ssl' => 'smtpSsl',
'enabled' => 'enabled',
'created_at' => 'createdAt',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'connector_id' => 'setConnectorId',
'smtp_host' => 'setSmtpHost',
'smtp_port' => 'setSmtpPort',
'smtp_username' => 'setSmtpUsername',
'smtp_password' => 'setSmtpPassword',
'smtp_ssl' => 'setSmtpSsl',
'enabled' => 'setEnabled',
'created_at' => 'setCreatedAt',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'connector_id' => 'getConnectorId',
'smtp_host' => 'getSmtpHost',
'smtp_port' => 'getSmtpPort',
'smtp_username' => 'getSmtpUsername',
'smtp_password' => 'getSmtpPassword',
'smtp_ssl' => 'getSmtpSsl',
'enabled' => 'getEnabled',
'created_at' => 'getCreatedAt',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('connector_id', $data ?? [], null);
$this->setIfExists('smtp_host', $data ?? [], null);
$this->setIfExists('smtp_port', $data ?? [], null);
$this->setIfExists('smtp_username', $data ?? [], null);
$this->setIfExists('smtp_password', $data ?? [], null);
$this->setIfExists('smtp_ssl', $data ?? [], null);
$this->setIfExists('enabled', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['connector_id'] === null) {
$invalidProperties[] = "'connector_id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets connector_id
*
* @return string
*/
public function getConnectorId()
{
return $this->container['connector_id'];
}
/**
* Sets connector_id
*
* @param string $connector_id connector_id
*
* @return self
*/
public function setConnectorId($connector_id)
{
if (is_null($connector_id)) {
throw new \InvalidArgumentException('non-nullable connector_id cannot be null');
}
$this->container['connector_id'] = $connector_id;
return $this;
}
/**
* Gets smtp_host
*
* @return string|null
*/
public function getSmtpHost()
{
return $this->container['smtp_host'];
}
/**
* Sets smtp_host
*
* @param string|null $smtp_host smtp_host
*
* @return self
*/
public function setSmtpHost($smtp_host)
{
if (is_null($smtp_host)) {
throw new \InvalidArgumentException('non-nullable smtp_host cannot be null');
}
$this->container['smtp_host'] = $smtp_host;
return $this;
}
/**
* Gets smtp_port
*
* @return int|null
*/
public function getSmtpPort()
{
return $this->container['smtp_port'];
}
/**
* Sets smtp_port
*
* @param int|null $smtp_port smtp_port
*
* @return self
*/
public function setSmtpPort($smtp_port)
{
if (is_null($smtp_port)) {
throw new \InvalidArgumentException('non-nullable smtp_port cannot be null');
}
$this->container['smtp_port'] = $smtp_port;
return $this;
}
/**
* Gets smtp_username
*
* @return string|null
*/
public function getSmtpUsername()
{
return $this->container['smtp_username'];
}
/**
* Sets smtp_username
*
* @param string|null $smtp_username smtp_username
*
* @return self
*/
public function setSmtpUsername($smtp_username)
{
if (is_null($smtp_username)) {
throw new \InvalidArgumentException('non-nullable smtp_username cannot be null');
}
$this->container['smtp_username'] = $smtp_username;
return $this;
}
/**
* Gets smtp_password
*
* @return string|null
*/
public function getSmtpPassword()
{
return $this->container['smtp_password'];
}
/**
* Sets smtp_password
*
* @param string|null $smtp_password smtp_password
*
* @return self
*/
public function setSmtpPassword($smtp_password)
{
if (is_null($smtp_password)) {
throw new \InvalidArgumentException('non-nullable smtp_password cannot be null');
}
$this->container['smtp_password'] = $smtp_password;
return $this;
}
/**
* Gets smtp_ssl
*
* @return bool|null
*/
public function getSmtpSsl()
{
return $this->container['smtp_ssl'];
}
/**
* Sets smtp_ssl
*
* @param bool|null $smtp_ssl smtp_ssl
*
* @return self
*/
public function setSmtpSsl($smtp_ssl)
{
if (is_null($smtp_ssl)) {
throw new \InvalidArgumentException('non-nullable smtp_ssl cannot be null');
}
$this->container['smtp_ssl'] = $smtp_ssl;
return $this;
}
/**
* Gets enabled
*
* @return bool|null
*/
public function getEnabled()
{
return $this->container['enabled'];
}
/**
* Sets enabled
*
* @param bool|null $enabled enabled
*
* @return self
*/
public function setEnabled($enabled)
{
if (is_null($enabled)) {
throw new \InvalidArgumentException('non-nullable enabled cannot be null');
}
$this->container['enabled'] = $enabled;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorProjection Class Doc Comment
*
* @category Class
* @description Connector
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'enabled' => 'bool',
'inbox_id' => 'string',
'email_address' => 'string',
'user_id' => 'string',
'sync_enabled' => 'bool',
'sync_schedule_type' => 'string',
'sync_interval' => 'int',
'name' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'enabled' => null,
'inbox_id' => 'uuid',
'email_address' => null,
'user_id' => 'uuid',
'sync_enabled' => null,
'sync_schedule_type' => null,
'sync_interval' => 'int32',
'name' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'enabled' => false,
'inbox_id' => false,
'email_address' => false,
'user_id' => false,
'sync_enabled' => false,
'sync_schedule_type' => false,
'sync_interval' => false,
'name' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'enabled' => 'enabled',
'inbox_id' => 'inboxId',
'email_address' => 'emailAddress',
'user_id' => 'userId',
'sync_enabled' => 'syncEnabled',
'sync_schedule_type' => 'syncScheduleType',
'sync_interval' => 'syncInterval',
'name' => 'name',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'enabled' => 'setEnabled',
'inbox_id' => 'setInboxId',
'email_address' => 'setEmailAddress',
'user_id' => 'setUserId',
'sync_enabled' => 'setSyncEnabled',
'sync_schedule_type' => 'setSyncScheduleType',
'sync_interval' => 'setSyncInterval',
'name' => 'setName',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'enabled' => 'getEnabled',
'inbox_id' => 'getInboxId',
'email_address' => 'getEmailAddress',
'user_id' => 'getUserId',
'sync_enabled' => 'getSyncEnabled',
'sync_schedule_type' => 'getSyncScheduleType',
'sync_interval' => 'getSyncInterval',
'name' => 'getName',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SYNC_SCHEDULE_TYPE_INTERVAL = 'INTERVAL';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSyncScheduleTypeAllowableValues()
{
return [
self::SYNC_SCHEDULE_TYPE_INTERVAL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('enabled', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('sync_enabled', $data ?? [], null);
$this->setIfExists('sync_schedule_type', $data ?? [], null);
$this->setIfExists('sync_interval', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['sync_schedule_type'] === null) {
$invalidProperties[] = "'sync_schedule_type' can't be null";
}
$allowedValues = $this->getSyncScheduleTypeAllowableValues();
if (!is_null($this->container['sync_schedule_type']) && !in_array($this->container['sync_schedule_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sync_schedule_type', must be one of '%s'",
$this->container['sync_schedule_type'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets enabled
*
* @return bool|null
*/
public function getEnabled()
{
return $this->container['enabled'];
}
/**
* Sets enabled
*
* @param bool|null $enabled enabled
*
* @return self
*/
public function setEnabled($enabled)
{
if (is_null($enabled)) {
throw new \InvalidArgumentException('non-nullable enabled cannot be null');
}
$this->container['enabled'] = $enabled;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets email_address
*
* @return string|null
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string|null $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets sync_enabled
*
* @return bool|null
*/
public function getSyncEnabled()
{
return $this->container['sync_enabled'];
}
/**
* Sets sync_enabled
*
* @param bool|null $sync_enabled sync_enabled
*
* @return self
*/
public function setSyncEnabled($sync_enabled)
{
if (is_null($sync_enabled)) {
throw new \InvalidArgumentException('non-nullable sync_enabled cannot be null');
}
$this->container['sync_enabled'] = $sync_enabled;
return $this;
}
/**
* Gets sync_schedule_type
*
* @return string
*/
public function getSyncScheduleType()
{
return $this->container['sync_schedule_type'];
}
/**
* Sets sync_schedule_type
*
* @param string $sync_schedule_type sync_schedule_type
*
* @return self
*/
public function setSyncScheduleType($sync_schedule_type)
{
$allowedValues = $this->getSyncScheduleTypeAllowableValues();
if (!in_array($sync_schedule_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sync_schedule_type', must be one of '%s'",
$sync_schedule_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($sync_schedule_type)) {
throw new \InvalidArgumentException('non-nullable sync_schedule_type cannot be null');
}
$this->container['sync_schedule_type'] = $sync_schedule_type;
return $this;
}
/**
* Gets sync_interval
*
* @return int|null
*/
public function getSyncInterval()
{
return $this->container['sync_interval'];
}
/**
* Sets sync_interval
*
* @param int|null $sync_interval sync_interval
*
* @return self
*/
public function setSyncInterval($sync_interval)
{
if (is_null($sync_interval)) {
throw new \InvalidArgumentException('non-nullable sync_interval cannot be null');
}
$this->container['sync_interval'] = $sync_interval;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorImapConnectionDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorImapConnectionDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorImapConnectionDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorImapConnectionDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'connector_id' => 'string',
'imap_host' => 'string',
'imap_port' => 'int',
'imap_username' => 'string',
'imap_password' => 'string',
'imap_ssl' => 'bool',
'select_folder' => 'string',
'search_terms' => 'string',
'enabled' => 'bool',
'created_at' => '\DateTime',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'connector_id' => 'uuid',
'imap_host' => null,
'imap_port' => 'int32',
'imap_username' => null,
'imap_password' => null,
'imap_ssl' => null,
'select_folder' => null,
'search_terms' => null,
'enabled' => null,
'created_at' => 'date-time',
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'connector_id' => false,
'imap_host' => false,
'imap_port' => false,
'imap_username' => false,
'imap_password' => false,
'imap_ssl' => false,
'select_folder' => false,
'search_terms' => false,
'enabled' => false,
'created_at' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'connector_id' => 'connectorId',
'imap_host' => 'imapHost',
'imap_port' => 'imapPort',
'imap_username' => 'imapUsername',
'imap_password' => 'imapPassword',
'imap_ssl' => 'imapSsl',
'select_folder' => 'selectFolder',
'search_terms' => 'searchTerms',
'enabled' => 'enabled',
'created_at' => 'createdAt',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'connector_id' => 'setConnectorId',
'imap_host' => 'setImapHost',
'imap_port' => 'setImapPort',
'imap_username' => 'setImapUsername',
'imap_password' => 'setImapPassword',
'imap_ssl' => 'setImapSsl',
'select_folder' => 'setSelectFolder',
'search_terms' => 'setSearchTerms',
'enabled' => 'setEnabled',
'created_at' => 'setCreatedAt',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'connector_id' => 'getConnectorId',
'imap_host' => 'getImapHost',
'imap_port' => 'getImapPort',
'imap_username' => 'getImapUsername',
'imap_password' => 'getImapPassword',
'imap_ssl' => 'getImapSsl',
'select_folder' => 'getSelectFolder',
'search_terms' => 'getSearchTerms',
'enabled' => 'getEnabled',
'created_at' => 'getCreatedAt',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('connector_id', $data ?? [], null);
$this->setIfExists('imap_host', $data ?? [], null);
$this->setIfExists('imap_port', $data ?? [], null);
$this->setIfExists('imap_username', $data ?? [], null);
$this->setIfExists('imap_password', $data ?? [], null);
$this->setIfExists('imap_ssl', $data ?? [], null);
$this->setIfExists('select_folder', $data ?? [], null);
$this->setIfExists('search_terms', $data ?? [], null);
$this->setIfExists('enabled', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['connector_id'] === null) {
$invalidProperties[] = "'connector_id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets connector_id
*
* @return string
*/
public function getConnectorId()
{
return $this->container['connector_id'];
}
/**
* Sets connector_id
*
* @param string $connector_id connector_id
*
* @return self
*/
public function setConnectorId($connector_id)
{
if (is_null($connector_id)) {
throw new \InvalidArgumentException('non-nullable connector_id cannot be null');
}
$this->container['connector_id'] = $connector_id;
return $this;
}
/**
* Gets imap_host
*
* @return string|null
*/
public function getImapHost()
{
return $this->container['imap_host'];
}
/**
* Sets imap_host
*
* @param string|null $imap_host imap_host
*
* @return self
*/
public function setImapHost($imap_host)
{
if (is_null($imap_host)) {
throw new \InvalidArgumentException('non-nullable imap_host cannot be null');
}
$this->container['imap_host'] = $imap_host;
return $this;
}
/**
* Gets imap_port
*
* @return int|null
*/
public function getImapPort()
{
return $this->container['imap_port'];
}
/**
* Sets imap_port
*
* @param int|null $imap_port imap_port
*
* @return self
*/
public function setImapPort($imap_port)
{
if (is_null($imap_port)) {
throw new \InvalidArgumentException('non-nullable imap_port cannot be null');
}
$this->container['imap_port'] = $imap_port;
return $this;
}
/**
* Gets imap_username
*
* @return string|null
*/
public function getImapUsername()
{
return $this->container['imap_username'];
}
/**
* Sets imap_username
*
* @param string|null $imap_username imap_username
*
* @return self
*/
public function setImapUsername($imap_username)
{
if (is_null($imap_username)) {
throw new \InvalidArgumentException('non-nullable imap_username cannot be null');
}
$this->container['imap_username'] = $imap_username;
return $this;
}
/**
* Gets imap_password
*
* @return string|null
*/
public function getImapPassword()
{
return $this->container['imap_password'];
}
/**
* Sets imap_password
*
* @param string|null $imap_password imap_password
*
* @return self
*/
public function setImapPassword($imap_password)
{
if (is_null($imap_password)) {
throw new \InvalidArgumentException('non-nullable imap_password cannot be null');
}
$this->container['imap_password'] = $imap_password;
return $this;
}
/**
* Gets imap_ssl
*
* @return bool|null
*/
public function getImapSsl()
{
return $this->container['imap_ssl'];
}
/**
* Sets imap_ssl
*
* @param bool|null $imap_ssl imap_ssl
*
* @return self
*/
public function setImapSsl($imap_ssl)
{
if (is_null($imap_ssl)) {
throw new \InvalidArgumentException('non-nullable imap_ssl cannot be null');
}
$this->container['imap_ssl'] = $imap_ssl;
return $this;
}
/**
* Gets select_folder
*
* @return string|null
*/
public function getSelectFolder()
{
return $this->container['select_folder'];
}
/**
* Sets select_folder
*
* @param string|null $select_folder select_folder
*
* @return self
*/
public function setSelectFolder($select_folder)
{
if (is_null($select_folder)) {
throw new \InvalidArgumentException('non-nullable select_folder cannot be null');
}
$this->container['select_folder'] = $select_folder;
return $this;
}
/**
* Gets search_terms
*
* @return string|null
*/
public function getSearchTerms()
{
return $this->container['search_terms'];
}
/**
* Sets search_terms
*
* @param string|null $search_terms search_terms
*
* @return self
*/
public function setSearchTerms($search_terms)
{
if (is_null($search_terms)) {
throw new \InvalidArgumentException('non-nullable search_terms cannot be null');
}
$this->container['search_terms'] = $search_terms;
return $this;
}
/**
* Gets enabled
*
* @return bool|null
*/
public function getEnabled()
{
return $this->container['enabled'];
}
/**
* Sets enabled
*
* @param bool|null $enabled enabled
*
* @return self
*/
public function setEnabled($enabled)
{
if (is_null($enabled)) {
throw new \InvalidArgumentException('non-nullable enabled cannot be null');
}
$this->container['enabled'] = $enabled;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConnectorDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConnectorDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConnectorDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConnectorDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'name' => 'string',
'enabled' => 'bool',
'user_id' => 'string',
'inbox_id' => 'string',
'sync_enabled' => 'bool',
'sync_schedule_type' => 'string',
'sync_interval' => 'int',
'has_imap_connection' => 'bool',
'has_smtp_connection' => 'bool',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'name' => null,
'enabled' => null,
'user_id' => 'uuid',
'inbox_id' => 'uuid',
'sync_enabled' => null,
'sync_schedule_type' => null,
'sync_interval' => 'int32',
'has_imap_connection' => null,
'has_smtp_connection' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'name' => true,
'enabled' => false,
'user_id' => false,
'inbox_id' => false,
'sync_enabled' => false,
'sync_schedule_type' => true,
'sync_interval' => true,
'has_imap_connection' => false,
'has_smtp_connection' => false,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'name' => 'name',
'enabled' => 'enabled',
'user_id' => 'userId',
'inbox_id' => 'inboxId',
'sync_enabled' => 'syncEnabled',
'sync_schedule_type' => 'syncScheduleType',
'sync_interval' => 'syncInterval',
'has_imap_connection' => 'hasImapConnection',
'has_smtp_connection' => 'hasSmtpConnection',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'name' => 'setName',
'enabled' => 'setEnabled',
'user_id' => 'setUserId',
'inbox_id' => 'setInboxId',
'sync_enabled' => 'setSyncEnabled',
'sync_schedule_type' => 'setSyncScheduleType',
'sync_interval' => 'setSyncInterval',
'has_imap_connection' => 'setHasImapConnection',
'has_smtp_connection' => 'setHasSmtpConnection',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'name' => 'getName',
'enabled' => 'getEnabled',
'user_id' => 'getUserId',
'inbox_id' => 'getInboxId',
'sync_enabled' => 'getSyncEnabled',
'sync_schedule_type' => 'getSyncScheduleType',
'sync_interval' => 'getSyncInterval',
'has_imap_connection' => 'getHasImapConnection',
'has_smtp_connection' => 'getHasSmtpConnection',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const SYNC_SCHEDULE_TYPE_INTERVAL = 'INTERVAL';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getSyncScheduleTypeAllowableValues()
{
return [
self::SYNC_SCHEDULE_TYPE_INTERVAL,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('enabled', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('sync_enabled', $data ?? [], null);
$this->setIfExists('sync_schedule_type', $data ?? [], null);
$this->setIfExists('sync_interval', $data ?? [], null);
$this->setIfExists('has_imap_connection', $data ?? [], null);
$this->setIfExists('has_smtp_connection', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['enabled'] === null) {
$invalidProperties[] = "'enabled' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['sync_enabled'] === null) {
$invalidProperties[] = "'sync_enabled' can't be null";
}
$allowedValues = $this->getSyncScheduleTypeAllowableValues();
if (!is_null($this->container['sync_schedule_type']) && !in_array($this->container['sync_schedule_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'sync_schedule_type', must be one of '%s'",
$this->container['sync_schedule_type'],
implode("', '", $allowedValues)
);
}
if ($this->container['has_imap_connection'] === null) {
$invalidProperties[] = "'has_imap_connection' can't be null";
}
if ($this->container['has_smtp_connection'] === null) {
$invalidProperties[] = "'has_smtp_connection' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets enabled
*
* @return bool
*/
public function getEnabled()
{
return $this->container['enabled'];
}
/**
* Sets enabled
*
* @param bool $enabled enabled
*
* @return self
*/
public function setEnabled($enabled)
{
if (is_null($enabled)) {
throw new \InvalidArgumentException('non-nullable enabled cannot be null');
}
$this->container['enabled'] = $enabled;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets sync_enabled
*
* @return bool
*/
public function getSyncEnabled()
{
return $this->container['sync_enabled'];
}
/**
* Sets sync_enabled
*
* @param bool $sync_enabled sync_enabled
*
* @return self
*/
public function setSyncEnabled($sync_enabled)
{
if (is_null($sync_enabled)) {
throw new \InvalidArgumentException('non-nullable sync_enabled cannot be null');
}
$this->container['sync_enabled'] = $sync_enabled;
return $this;
}
/**
* Gets sync_schedule_type
*
* @return string|null
*/
public function getSyncScheduleType()
{
return $this->container['sync_schedule_type'];
}
/**
* Sets sync_schedule_type
*
* @param string|null $sync_schedule_type sync_schedule_type
*
* @return self
*/
public function setSyncScheduleType($sync_schedule_type)
{
$allowedValues = $this->getSyncScheduleTypeAllowableValues();
if (!is_null($sync_schedule_type) && !in_array($sync_schedule_type, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'sync_schedule_type', must be one of '%s'",
$sync_schedule_type,
implode("', '", $allowedValues)
)
);
}
if (is_null($sync_schedule_type)) {
array_push($this->openAPINullablesSetToNull, 'sync_schedule_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sync_schedule_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sync_schedule_type'] = $sync_schedule_type;
return $this;
}
/**
* Gets sync_interval
*
* @return int|null
*/
public function getSyncInterval()
{
return $this->container['sync_interval'];
}
/**
* Sets sync_interval
*
* @param int|null $sync_interval sync_interval
*
* @return self
*/
public function setSyncInterval($sync_interval)
{
if (is_null($sync_interval)) {
array_push($this->openAPINullablesSetToNull, 'sync_interval');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sync_interval', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sync_interval'] = $sync_interval;
return $this;
}
/**
* Gets has_imap_connection
*
* @return bool
*/
public function getHasImapConnection()
{
return $this->container['has_imap_connection'];
}
/**
* Sets has_imap_connection
*
* @param bool $has_imap_connection has_imap_connection
*
* @return self
*/
public function setHasImapConnection($has_imap_connection)
{
if (is_null($has_imap_connection)) {
throw new \InvalidArgumentException('non-nullable has_imap_connection cannot be null');
}
$this->container['has_imap_connection'] = $has_imap_connection;
return $this;
}
/**
* Gets has_smtp_connection
*
* @return bool
*/
public function getHasSmtpConnection()
{
return $this->container['has_smtp_connection'];
}
/**
* Sets has_smtp_connection
*
* @param bool $has_smtp_connection has_smtp_connection
*
* @return self
*/
public function setHasSmtpConnection($has_smtp_connection)
{
if (is_null($has_smtp_connection)) {
throw new \InvalidArgumentException('non-nullable has_smtp_connection cannot be null');
}
$this->container['has_smtp_connection'] = $has_smtp_connection;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* ConditionOption
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* ConditionOption Class Doc Comment
*
* @category Class
* @description Options for matching emails in an inbox based on a condition such as `HAS_ATTACHMENTS=TRUE`
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class ConditionOption implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ConditionOption';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'condition' => 'string',
'value' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'condition' => null,
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'condition' => false,
'value' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'condition' => 'condition',
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'condition' => 'setCondition',
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'condition' => 'getCondition',
'value' => 'getValue'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const CONDITION_HAS_ATTACHMENTS = 'HAS_ATTACHMENTS';
public const VALUE_TRUE = 'TRUE';
public const VALUE_FALSE = 'FALSE';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getConditionAllowableValues()
{
return [
self::CONDITION_HAS_ATTACHMENTS,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getValueAllowableValues()
{
return [
self::VALUE_TRUE,
self::VALUE_FALSE,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('condition', $data ?? [], null);
$this->setIfExists('value', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['condition'] === null) {
$invalidProperties[] = "'condition' can't be null";
}
$allowedValues = $this->getConditionAllowableValues();
if (!is_null($this->container['condition']) && !in_array($this->container['condition'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'condition', must be one of '%s'",
$this->container['condition'],
implode("', '", $allowedValues)
);
}
if ($this->container['value'] === null) {
$invalidProperties[] = "'value' can't be null";
}
$allowedValues = $this->getValueAllowableValues();
if (!is_null($this->container['value']) && !in_array($this->container['value'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'value', must be one of '%s'",
$this->container['value'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets condition
*
* @return string
*/
public function getCondition()
{
return $this->container['condition'];
}
/**
* Sets condition
*
* @param string $condition Condition of an email object that can be used to filter results
*
* @return self
*/
public function setCondition($condition)
{
$allowedValues = $this->getConditionAllowableValues();
if (!in_array($condition, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'condition', must be one of '%s'",
$condition,
implode("', '", $allowedValues)
)
);
}
if (is_null($condition)) {
throw new \InvalidArgumentException('non-nullable condition cannot be null');
}
$this->container['condition'] = $condition;
return $this;
}
/**
* Gets value
*
* @return string
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value
*
* @param string $value Expected condition value
*
* @return self
*/
public function setValue($value)
{
$allowedValues = $this->getValueAllowableValues();
if (!in_array($value, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'value', must be one of '%s'",
$value,
implode("', '", $allowedValues)
)
);
}
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* Complaint
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* Complaint Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class Complaint implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'Complaint';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'event_type' => 'string',
'mail_source' => 'string',
'mail_message_id' => 'string',
'complaint_recipient' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'event_type' => null,
'mail_source' => null,
'mail_message_id' => null,
'complaint_recipient' => null,
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'event_type' => false,
'mail_source' => false,
'mail_message_id' => false,
'complaint_recipient' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'event_type' => 'eventType',
'mail_source' => 'mailSource',
'mail_message_id' => 'mailMessageId',
'complaint_recipient' => 'complaintRecipient',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'event_type' => 'setEventType',
'mail_source' => 'setMailSource',
'mail_message_id' => 'setMailMessageId',
'complaint_recipient' => 'setComplaintRecipient',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'event_type' => 'getEventType',
'mail_source' => 'getMailSource',
'mail_message_id' => 'getMailMessageId',
'complaint_recipient' => 'getComplaintRecipient',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('event_type', $data ?? [], null);
$this->setIfExists('mail_source', $data ?? [], null);
$this->setIfExists('mail_message_id', $data ?? [], null);
$this->setIfExists('complaint_recipient', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['complaint_recipient'] === null) {
$invalidProperties[] = "'complaint_recipient' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets event_type
*
* @return string|null
*/
public function getEventType()
{
return $this->container['event_type'];
}
/**
* Sets event_type
*
* @param string|null $event_type event_type
*
* @return self
*/
public function setEventType($event_type)
{
if (is_null($event_type)) {
throw new \InvalidArgumentException('non-nullable event_type cannot be null');
}
$this->container['event_type'] = $event_type;
return $this;
}
/**
* Gets mail_source
*
* @return string|null
*/
public function getMailSource()
{
return $this->container['mail_source'];
}
/**
* Sets mail_source
*
* @param string|null $mail_source mail_source
*
* @return self
*/
public function setMailSource($mail_source)
{
if (is_null($mail_source)) {
throw new \InvalidArgumentException('non-nullable mail_source cannot be null');
}
$this->container['mail_source'] = $mail_source;
return $this;
}
/**
* Gets mail_message_id
*
* @return string|null
*/
public function getMailMessageId()
{
return $this->container['mail_message_id'];
}
/**
* Sets mail_message_id
*
* @param string|null $mail_message_id mail_message_id
*
* @return self
*/
public function setMailMessageId($mail_message_id)
{
if (is_null($mail_message_id)) {
throw new \InvalidArgumentException('non-nullable mail_message_id cannot be null');
}
$this->container['mail_message_id'] = $mail_message_id;
return $this;
}
/**
* Gets complaint_recipient
*
* @return string
*/
public function getComplaintRecipient()
{
return $this->container['complaint_recipient'];
}
/**
* Sets complaint_recipient
*
* @param string $complaint_recipient complaint_recipient
*
* @return self
*/
public function setComplaintRecipient($complaint_recipient)
{
if (is_null($complaint_recipient)) {
throw new \InvalidArgumentException('non-nullable complaint_recipient cannot be null');
}
$this->container['complaint_recipient'] = $complaint_recipient;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CheckEmailFeaturesClientSupportResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CheckEmailFeaturesClientSupportResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CheckEmailFeaturesClientSupportResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CheckEmailFeaturesClientSupportResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'result' => '\MailSlurp\Models\EmailFeatureSupportResult'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'result' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'result' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'result' => 'result'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'result' => 'setResult'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'result' => 'getResult'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('result', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['result'] === null) {
$invalidProperties[] = "'result' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets result
*
* @return \MailSlurp\Models\EmailFeatureSupportResult
*/
public function getResult()
{
return $this->container['result'];
}
/**
* Sets result
*
* @param \MailSlurp\Models\EmailFeatureSupportResult $result result
*
* @return self
*/
public function setResult($result)
{
if (is_null($result)) {
throw new \InvalidArgumentException('non-nullable result cannot be null');
}
$this->container['result'] = $result;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CheckEmailFeaturesClientSupportOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CheckEmailFeaturesClientSupportOptions Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CheckEmailFeaturesClientSupportOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CheckEmailFeaturesClientSupportOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_body' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_body' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_body' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_body' => 'emailBody'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_body' => 'setEmailBody'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_body' => 'getEmailBody'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_body', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_body'] === null) {
$invalidProperties[] = "'email_body' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_body
*
* @return string
*/
public function getEmailBody()
{
return $this->container['email_body'];
}
/**
* Sets email_body
*
* @param string $email_body email_body
*
* @return self
*/
public function setEmailBody($email_body)
{
if (is_null($email_body)) {
throw new \InvalidArgumentException('non-nullable email_body cannot be null');
}
$this->container['email_body'] = $email_body;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CheckEmailClientSupportResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CheckEmailClientSupportResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CheckEmailClientSupportResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CheckEmailClientSupportResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'result' => '\MailSlurp\Models\EmailFeatureSupportResult'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'result' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'result' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'result' => 'result'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'result' => 'setResult'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'result' => 'getResult'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('result', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['result'] === null) {
$invalidProperties[] = "'result' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets result
*
* @return \MailSlurp\Models\EmailFeatureSupportResult
*/
public function getResult()
{
return $this->container['result'];
}
/**
* Sets result
*
* @param \MailSlurp\Models\EmailFeatureSupportResult $result result
*
* @return self
*/
public function setResult($result)
{
if (is_null($result)) {
throw new \InvalidArgumentException('non-nullable result cannot be null');
}
$this->container['result'] = $result;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CheckEmailClientSupportOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CheckEmailClientSupportOptions Class Doc Comment
*
* @category Class
* @description Options for the email to be validated
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CheckEmailClientSupportOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CheckEmailClientSupportOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'email_body' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'email_body' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'email_body' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'email_body' => 'emailBody'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'email_body' => 'setEmailBody'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'email_body' => 'getEmailBody'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('email_body', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['email_body'] === null) {
$invalidProperties[] = "'email_body' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets email_body
*
* @return string
*/
public function getEmailBody()
{
return $this->container['email_body'];
}
/**
* Sets email_body
*
* @param string $email_body email_body
*
* @return self
*/
public function setEmailBody($email_body)
{
if (is_null($email_body)) {
throw new \InvalidArgumentException('non-nullable email_body cannot be null');
}
$this->container['email_body'] = $email_body;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CheckEmailBodyResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CheckEmailBodyResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CheckEmailBodyResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CheckEmailBodyResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'has_issues' => 'bool',
'link_issues' => '\MailSlurp\Models\LinkIssue[]',
'image_issues' => '\MailSlurp\Models\ImageIssue[]',
'spelling_issues' => '\MailSlurp\Models\SpellingIssue[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'has_issues' => null,
'link_issues' => null,
'image_issues' => null,
'spelling_issues' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'has_issues' => false,
'link_issues' => false,
'image_issues' => false,
'spelling_issues' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'has_issues' => 'hasIssues',
'link_issues' => 'linkIssues',
'image_issues' => 'imageIssues',
'spelling_issues' => 'spellingIssues'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'has_issues' => 'setHasIssues',
'link_issues' => 'setLinkIssues',
'image_issues' => 'setImageIssues',
'spelling_issues' => 'setSpellingIssues'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'has_issues' => 'getHasIssues',
'link_issues' => 'getLinkIssues',
'image_issues' => 'getImageIssues',
'spelling_issues' => 'getSpellingIssues'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('has_issues', $data ?? [], null);
$this->setIfExists('link_issues', $data ?? [], null);
$this->setIfExists('image_issues', $data ?? [], null);
$this->setIfExists('spelling_issues', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['has_issues'] === null) {
$invalidProperties[] = "'has_issues' can't be null";
}
if ($this->container['link_issues'] === null) {
$invalidProperties[] = "'link_issues' can't be null";
}
if ($this->container['image_issues'] === null) {
$invalidProperties[] = "'image_issues' can't be null";
}
if ($this->container['spelling_issues'] === null) {
$invalidProperties[] = "'spelling_issues' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets has_issues
*
* @return bool
*/
public function getHasIssues()
{
return $this->container['has_issues'];
}
/**
* Sets has_issues
*
* @param bool $has_issues has_issues
*
* @return self
*/
public function setHasIssues($has_issues)
{
if (is_null($has_issues)) {
throw new \InvalidArgumentException('non-nullable has_issues cannot be null');
}
$this->container['has_issues'] = $has_issues;
return $this;
}
/**
* Gets link_issues
*
* @return \MailSlurp\Models\LinkIssue[]
*/
public function getLinkIssues()
{
return $this->container['link_issues'];
}
/**
* Sets link_issues
*
* @param \MailSlurp\Models\LinkIssue[] $link_issues link_issues
*
* @return self
*/
public function setLinkIssues($link_issues)
{
if (is_null($link_issues)) {
throw new \InvalidArgumentException('non-nullable link_issues cannot be null');
}
$this->container['link_issues'] = $link_issues;
return $this;
}
/**
* Gets image_issues
*
* @return \MailSlurp\Models\ImageIssue[]
*/
public function getImageIssues()
{
return $this->container['image_issues'];
}
/**
* Sets image_issues
*
* @param \MailSlurp\Models\ImageIssue[] $image_issues image_issues
*
* @return self
*/
public function setImageIssues($image_issues)
{
if (is_null($image_issues)) {
throw new \InvalidArgumentException('non-nullable image_issues cannot be null');
}
$this->container['image_issues'] = $image_issues;
return $this;
}
/**
* Gets spelling_issues
*
* @return \MailSlurp\Models\SpellingIssue[]
*/
public function getSpellingIssues()
{
return $this->container['spelling_issues'];
}
/**
* Sets spelling_issues
*
* @param \MailSlurp\Models\SpellingIssue[] $spelling_issues spelling_issues
*
* @return self
*/
public function setSpellingIssues($spelling_issues)
{
if (is_null($spelling_issues)) {
throw new \InvalidArgumentException('non-nullable spelling_issues cannot be null');
}
$this->container['spelling_issues'] = $spelling_issues;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CheckEmailBodyFeatureSupportResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CheckEmailBodyFeatureSupportResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CheckEmailBodyFeatureSupportResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CheckEmailBodyFeatureSupportResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'result' => '\MailSlurp\Models\EmailFeatureSupportResult'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'result' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'result' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'result' => 'result'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'result' => 'setResult'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'result' => 'getResult'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('result', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['result'] === null) {
$invalidProperties[] = "'result' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets result
*
* @return \MailSlurp\Models\EmailFeatureSupportResult
*/
public function getResult()
{
return $this->container['result'];
}
/**
* Sets result
*
* @param \MailSlurp\Models\EmailFeatureSupportResult $result result
*
* @return self
*/
public function setResult($result)
{
if (is_null($result)) {
throw new \InvalidArgumentException('non-nullable result cannot be null');
}
$this->container['result'] = $result;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* CanSendEmailResults
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* CanSendEmailResults Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class CanSendEmailResults implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'CanSendEmailResults';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'is_sending_permitted' => 'bool',
'message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'is_sending_permitted' => null,
'message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'is_sending_permitted' => false,
'message' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'is_sending_permitted' => 'isSendingPermitted',
'message' => 'message'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'is_sending_permitted' => 'setIsSendingPermitted',
'message' => 'setMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'is_sending_permitted' => 'getIsSendingPermitted',
'message' => 'getMessage'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('is_sending_permitted', $data ?? [], null);
$this->setIfExists('message', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['is_sending_permitted'] === null) {
$invalidProperties[] = "'is_sending_permitted' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets is_sending_permitted
*
* @return bool
*/
public function getIsSendingPermitted()
{
return $this->container['is_sending_permitted'];
}
/**
* Sets is_sending_permitted
*
* @param bool $is_sending_permitted is_sending_permitted
*
* @return self
*/
public function setIsSendingPermitted($is_sending_permitted)
{
if (is_null($is_sending_permitted)) {
throw new \InvalidArgumentException('non-nullable is_sending_permitted cannot be null');
}
$this->container['is_sending_permitted'] = $is_sending_permitted;
return $this;
}
/**
* Gets message
*
* @return string|null
*/
public function getMessage()
{
return $this->container['message'];
}
/**
* Sets message
*
* @param string|null $message message
*
* @return self
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* BulkSendEmailOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* BulkSendEmailOptions Class Doc Comment
*
* @category Class
* @description Options for bulk sending an email from multiple addresses. See regular `sendEmail` methods for more information.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class BulkSendEmailOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'BulkSendEmailOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'inbox_ids' => 'string[]',
'send_email_options' => '\MailSlurp\Models\SendEmailOptions'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'inbox_ids' => 'uuid',
'send_email_options' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'inbox_ids' => false,
'send_email_options' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'inbox_ids' => 'inboxIds',
'send_email_options' => 'sendEmailOptions'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'inbox_ids' => 'setInboxIds',
'send_email_options' => 'setSendEmailOptions'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'inbox_ids' => 'getInboxIds',
'send_email_options' => 'getSendEmailOptions'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('inbox_ids', $data ?? [], null);
$this->setIfExists('send_email_options', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['inbox_ids'] === null) {
$invalidProperties[] = "'inbox_ids' can't be null";
}
if ($this->container['send_email_options'] === null) {
$invalidProperties[] = "'send_email_options' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets inbox_ids
*
* @return string[]
*/
public function getInboxIds()
{
return $this->container['inbox_ids'];
}
/**
* Sets inbox_ids
*
* @param string[] $inbox_ids Inboxes to send the email from
*
* @return self
*/
public function setInboxIds($inbox_ids)
{
if (is_null($inbox_ids)) {
throw new \InvalidArgumentException('non-nullable inbox_ids cannot be null');
}
$this->container['inbox_ids'] = $inbox_ids;
return $this;
}
/**
* Gets send_email_options
*
* @return \MailSlurp\Models\SendEmailOptions
*/
public function getSendEmailOptions()
{
return $this->container['send_email_options'];
}
/**
* Sets send_email_options
*
* @param \MailSlurp\Models\SendEmailOptions $send_email_options send_email_options
*
* @return self
*/
public function setSendEmailOptions($send_email_options)
{
if (is_null($send_email_options)) {
throw new \InvalidArgumentException('non-nullable send_email_options cannot be null');
}
$this->container['send_email_options'] = $send_email_options;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* BouncedRecipientDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* BouncedRecipientDto Class Doc Comment
*
* @category Class
* @description Bounced recipient
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class BouncedRecipientDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'BouncedRecipientDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'sent_email_id' => 'string',
'recipient' => 'string',
'diagnostic_code' => 'string',
'action' => 'string',
'bounce_type' => 'string',
'status' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'sent_email_id' => 'uuid',
'recipient' => null,
'diagnostic_code' => null,
'action' => null,
'bounce_type' => null,
'status' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => true,
'sent_email_id' => true,
'recipient' => false,
'diagnostic_code' => true,
'action' => true,
'bounce_type' => true,
'status' => true,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'sent_email_id' => 'sentEmailId',
'recipient' => 'recipient',
'diagnostic_code' => 'diagnosticCode',
'action' => 'action',
'bounce_type' => 'bounceType',
'status' => 'status',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'sent_email_id' => 'setSentEmailId',
'recipient' => 'setRecipient',
'diagnostic_code' => 'setDiagnosticCode',
'action' => 'setAction',
'bounce_type' => 'setBounceType',
'status' => 'setStatus',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'sent_email_id' => 'getSentEmailId',
'recipient' => 'getRecipient',
'diagnostic_code' => 'getDiagnosticCode',
'action' => 'getAction',
'bounce_type' => 'getBounceType',
'status' => 'getStatus',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('sent_email_id', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
$this->setIfExists('diagnostic_code', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('bounce_type', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['recipient'] === null) {
$invalidProperties[] = "'recipient' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string|null
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string|null $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
array_push($this->openAPINullablesSetToNull, 'user_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('user_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets sent_email_id
*
* @return string|null
*/
public function getSentEmailId()
{
return $this->container['sent_email_id'];
}
/**
* Sets sent_email_id
*
* @param string|null $sent_email_id sent_email_id
*
* @return self
*/
public function setSentEmailId($sent_email_id)
{
if (is_null($sent_email_id)) {
array_push($this->openAPINullablesSetToNull, 'sent_email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_email_id'] = $sent_email_id;
return $this;
}
/**
* Gets recipient
*
* @return string
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string $recipient recipient
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
throw new \InvalidArgumentException('non-nullable recipient cannot be null');
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Gets diagnostic_code
*
* @return string|null
*/
public function getDiagnosticCode()
{
return $this->container['diagnostic_code'];
}
/**
* Sets diagnostic_code
*
* @param string|null $diagnostic_code diagnostic_code
*
* @return self
*/
public function setDiagnosticCode($diagnostic_code)
{
if (is_null($diagnostic_code)) {
array_push($this->openAPINullablesSetToNull, 'diagnostic_code');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('diagnostic_code', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['diagnostic_code'] = $diagnostic_code;
return $this;
}
/**
* Gets action
*
* @return string|null
*/
public function getAction()
{
return $this->container['action'];
}
/**
* Sets action
*
* @param string|null $action action
*
* @return self
*/
public function setAction($action)
{
if (is_null($action)) {
array_push($this->openAPINullablesSetToNull, 'action');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('action', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['action'] = $action;
return $this;
}
/**
* Gets bounce_type
*
* @return string|null
*/
public function getBounceType()
{
return $this->container['bounce_type'];
}
/**
* Sets bounce_type
*
* @param string|null $bounce_type bounce_type
*
* @return self
*/
public function setBounceType($bounce_type)
{
if (is_null($bounce_type)) {
array_push($this->openAPINullablesSetToNull, 'bounce_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_type'] = $bounce_type;
return $this;
}
/**
* Gets status
*
* @return string|null
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string|null $status status
*
* @return self
*/
public function setStatus($status)
{
if (is_null($status)) {
array_push($this->openAPINullablesSetToNull, 'status');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('status', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* BouncedEmailDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* BouncedEmailDto Class Doc Comment
*
* @category Class
* @description Bounced email
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class BouncedEmailDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'BouncedEmailDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'user_id' => 'string',
'notification_type' => 'string',
'sent_to_recipients' => 'string[]',
'sender' => 'string',
'bounce_mta' => 'string',
'bounce_type' => 'string',
'bounce_recipients' => 'string[]',
'bounce_sub_type' => 'string',
'sent_email_id' => 'string',
'subject' => 'string',
'created_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'user_id' => 'uuid',
'notification_type' => null,
'sent_to_recipients' => null,
'sender' => null,
'bounce_mta' => null,
'bounce_type' => null,
'bounce_recipients' => null,
'bounce_sub_type' => null,
'sent_email_id' => 'uuid',
'subject' => null,
'created_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'user_id' => false,
'notification_type' => false,
'sent_to_recipients' => true,
'sender' => false,
'bounce_mta' => true,
'bounce_type' => true,
'bounce_recipients' => true,
'bounce_sub_type' => true,
'sent_email_id' => true,
'subject' => true,
'created_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'user_id' => 'userId',
'notification_type' => 'notificationType',
'sent_to_recipients' => 'sentToRecipients',
'sender' => 'sender',
'bounce_mta' => 'bounceMta',
'bounce_type' => 'bounceType',
'bounce_recipients' => 'bounceRecipients',
'bounce_sub_type' => 'bounceSubType',
'sent_email_id' => 'sentEmailId',
'subject' => 'subject',
'created_at' => 'createdAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'user_id' => 'setUserId',
'notification_type' => 'setNotificationType',
'sent_to_recipients' => 'setSentToRecipients',
'sender' => 'setSender',
'bounce_mta' => 'setBounceMta',
'bounce_type' => 'setBounceType',
'bounce_recipients' => 'setBounceRecipients',
'bounce_sub_type' => 'setBounceSubType',
'sent_email_id' => 'setSentEmailId',
'subject' => 'setSubject',
'created_at' => 'setCreatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'user_id' => 'getUserId',
'notification_type' => 'getNotificationType',
'sent_to_recipients' => 'getSentToRecipients',
'sender' => 'getSender',
'bounce_mta' => 'getBounceMta',
'bounce_type' => 'getBounceType',
'bounce_recipients' => 'getBounceRecipients',
'bounce_sub_type' => 'getBounceSubType',
'sent_email_id' => 'getSentEmailId',
'subject' => 'getSubject',
'created_at' => 'getCreatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('notification_type', $data ?? [], null);
$this->setIfExists('sent_to_recipients', $data ?? [], null);
$this->setIfExists('sender', $data ?? [], null);
$this->setIfExists('bounce_mta', $data ?? [], null);
$this->setIfExists('bounce_type', $data ?? [], null);
$this->setIfExists('bounce_recipients', $data ?? [], null);
$this->setIfExists('bounce_sub_type', $data ?? [], null);
$this->setIfExists('sent_email_id', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['notification_type'] === null) {
$invalidProperties[] = "'notification_type' can't be null";
}
if ($this->container['sender'] === null) {
$invalidProperties[] = "'sender' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets notification_type
*
* @return string
*/
public function getNotificationType()
{
return $this->container['notification_type'];
}
/**
* Sets notification_type
*
* @param string $notification_type notification_type
*
* @return self
*/
public function setNotificationType($notification_type)
{
if (is_null($notification_type)) {
throw new \InvalidArgumentException('non-nullable notification_type cannot be null');
}
$this->container['notification_type'] = $notification_type;
return $this;
}
/**
* Gets sent_to_recipients
*
* @return string[]|null
*/
public function getSentToRecipients()
{
return $this->container['sent_to_recipients'];
}
/**
* Sets sent_to_recipients
*
* @param string[]|null $sent_to_recipients sent_to_recipients
*
* @return self
*/
public function setSentToRecipients($sent_to_recipients)
{
if (is_null($sent_to_recipients)) {
array_push($this->openAPINullablesSetToNull, 'sent_to_recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_to_recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_to_recipients'] = $sent_to_recipients;
return $this;
}
/**
* Gets sender
*
* @return string
*/
public function getSender()
{
return $this->container['sender'];
}
/**
* Sets sender
*
* @param string $sender sender
*
* @return self
*/
public function setSender($sender)
{
if (is_null($sender)) {
throw new \InvalidArgumentException('non-nullable sender cannot be null');
}
$this->container['sender'] = $sender;
return $this;
}
/**
* Gets bounce_mta
*
* @return string|null
*/
public function getBounceMta()
{
return $this->container['bounce_mta'];
}
/**
* Sets bounce_mta
*
* @param string|null $bounce_mta bounce_mta
*
* @return self
*/
public function setBounceMta($bounce_mta)
{
if (is_null($bounce_mta)) {
array_push($this->openAPINullablesSetToNull, 'bounce_mta');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_mta', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_mta'] = $bounce_mta;
return $this;
}
/**
* Gets bounce_type
*
* @return string|null
*/
public function getBounceType()
{
return $this->container['bounce_type'];
}
/**
* Sets bounce_type
*
* @param string|null $bounce_type bounce_type
*
* @return self
*/
public function setBounceType($bounce_type)
{
if (is_null($bounce_type)) {
array_push($this->openAPINullablesSetToNull, 'bounce_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_type'] = $bounce_type;
return $this;
}
/**
* Gets bounce_recipients
*
* @return string[]|null
*/
public function getBounceRecipients()
{
return $this->container['bounce_recipients'];
}
/**
* Sets bounce_recipients
*
* @param string[]|null $bounce_recipients bounce_recipients
*
* @return self
*/
public function setBounceRecipients($bounce_recipients)
{
if (is_null($bounce_recipients)) {
array_push($this->openAPINullablesSetToNull, 'bounce_recipients');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_recipients', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_recipients'] = $bounce_recipients;
return $this;
}
/**
* Gets bounce_sub_type
*
* @return string|null
*/
public function getBounceSubType()
{
return $this->container['bounce_sub_type'];
}
/**
* Sets bounce_sub_type
*
* @param string|null $bounce_sub_type bounce_sub_type
*
* @return self
*/
public function setBounceSubType($bounce_sub_type)
{
if (is_null($bounce_sub_type)) {
array_push($this->openAPINullablesSetToNull, 'bounce_sub_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_sub_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_sub_type'] = $bounce_sub_type;
return $this;
}
/**
* Gets sent_email_id
*
* @return string|null
*/
public function getSentEmailId()
{
return $this->container['sent_email_id'];
}
/**
* Sets sent_email_id
*
* @param string|null $sent_email_id sent_email_id
*
* @return self
*/
public function setSentEmailId($sent_email_id)
{
if (is_null($sent_email_id)) {
array_push($this->openAPINullablesSetToNull, 'sent_email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_email_id'] = $sent_email_id;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* BounceRecipientProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* BounceRecipientProjection Class Doc Comment
*
* @category Class
* @description Bounced recipient
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class BounceRecipientProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'BounceRecipientProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'sent_email_id' => 'string',
'recipient' => 'string',
'bounce_type' => 'string',
'action' => 'string',
'id' => 'string',
'status' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'sent_email_id' => 'uuid',
'recipient' => null,
'bounce_type' => null,
'action' => null,
'id' => 'uuid',
'status' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'sent_email_id' => true,
'recipient' => false,
'bounce_type' => true,
'action' => true,
'id' => false,
'status' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'sent_email_id' => 'sentEmailId',
'recipient' => 'recipient',
'bounce_type' => 'bounceType',
'action' => 'action',
'id' => 'id',
'status' => 'status'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'sent_email_id' => 'setSentEmailId',
'recipient' => 'setRecipient',
'bounce_type' => 'setBounceType',
'action' => 'setAction',
'id' => 'setId',
'status' => 'setStatus'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'sent_email_id' => 'getSentEmailId',
'recipient' => 'getRecipient',
'bounce_type' => 'getBounceType',
'action' => 'getAction',
'id' => 'getId',
'status' => 'getStatus'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('sent_email_id', $data ?? [], null);
$this->setIfExists('recipient', $data ?? [], null);
$this->setIfExists('bounce_type', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['recipient'] === null) {
$invalidProperties[] = "'recipient' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets sent_email_id
*
* @return string|null
*/
public function getSentEmailId()
{
return $this->container['sent_email_id'];
}
/**
* Sets sent_email_id
*
* @param string|null $sent_email_id sent_email_id
*
* @return self
*/
public function setSentEmailId($sent_email_id)
{
if (is_null($sent_email_id)) {
array_push($this->openAPINullablesSetToNull, 'sent_email_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('sent_email_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['sent_email_id'] = $sent_email_id;
return $this;
}
/**
* Gets recipient
*
* @return string
*/
public function getRecipient()
{
return $this->container['recipient'];
}
/**
* Sets recipient
*
* @param string $recipient recipient
*
* @return self
*/
public function setRecipient($recipient)
{
if (is_null($recipient)) {
throw new \InvalidArgumentException('non-nullable recipient cannot be null');
}
$this->container['recipient'] = $recipient;
return $this;
}
/**
* Gets bounce_type
*
* @return string|null
*/
public function getBounceType()
{
return $this->container['bounce_type'];
}
/**
* Sets bounce_type
*
* @param string|null $bounce_type bounce_type
*
* @return self
*/
public function setBounceType($bounce_type)
{
if (is_null($bounce_type)) {
array_push($this->openAPINullablesSetToNull, 'bounce_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_type'] = $bounce_type;
return $this;
}
/**
* Gets action
*
* @return string|null
*/
public function getAction()
{
return $this->container['action'];
}
/**
* Sets action
*
* @param string|null $action action
*
* @return self
*/
public function setAction($action)
{
if (is_null($action)) {
array_push($this->openAPINullablesSetToNull, 'action');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('action', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['action'] = $action;
return $this;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets status
*
* @return string|null
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string|null $status status
*
* @return self
*/
public function setStatus($status)
{
if (is_null($status)) {
array_push($this->openAPINullablesSetToNull, 'status');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('status', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['status'] = $status;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* BounceProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* BounceProjection Class Doc Comment
*
* @category Class
* @description Bounced email event
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class BounceProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'BounceProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'sender' => 'string',
'bounce_type' => 'string',
'bounce_mta' => 'string',
'subject' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'sender' => null,
'bounce_type' => null,
'bounce_mta' => null,
'subject' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'sender' => false,
'bounce_type' => true,
'bounce_mta' => true,
'subject' => true,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'sender' => 'sender',
'bounce_type' => 'bounceType',
'bounce_mta' => 'bounceMta',
'subject' => 'subject',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'sender' => 'setSender',
'bounce_type' => 'setBounceType',
'bounce_mta' => 'setBounceMta',
'subject' => 'setSubject',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'sender' => 'getSender',
'bounce_type' => 'getBounceType',
'bounce_mta' => 'getBounceMta',
'subject' => 'getSubject',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('sender', $data ?? [], null);
$this->setIfExists('bounce_type', $data ?? [], null);
$this->setIfExists('bounce_mta', $data ?? [], null);
$this->setIfExists('subject', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['sender'] === null) {
$invalidProperties[] = "'sender' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets sender
*
* @return string
*/
public function getSender()
{
return $this->container['sender'];
}
/**
* Sets sender
*
* @param string $sender sender
*
* @return self
*/
public function setSender($sender)
{
if (is_null($sender)) {
throw new \InvalidArgumentException('non-nullable sender cannot be null');
}
$this->container['sender'] = $sender;
return $this;
}
/**
* Gets bounce_type
*
* @return string|null
*/
public function getBounceType()
{
return $this->container['bounce_type'];
}
/**
* Sets bounce_type
*
* @param string|null $bounce_type bounce_type
*
* @return self
*/
public function setBounceType($bounce_type)
{
if (is_null($bounce_type)) {
array_push($this->openAPINullablesSetToNull, 'bounce_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_type'] = $bounce_type;
return $this;
}
/**
* Gets bounce_mta
*
* @return string|null
*/
public function getBounceMta()
{
return $this->container['bounce_mta'];
}
/**
* Sets bounce_mta
*
* @param string|null $bounce_mta bounce_mta
*
* @return self
*/
public function setBounceMta($bounce_mta)
{
if (is_null($bounce_mta)) {
array_push($this->openAPINullablesSetToNull, 'bounce_mta');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('bounce_mta', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['bounce_mta'] = $bounce_mta;
return $this;
}
/**
* Gets subject
*
* @return string|null
*/
public function getSubject()
{
return $this->container['subject'];
}
/**
* Sets subject
*
* @param string|null $subject subject
*
* @return self
*/
public function setSubject($subject)
{
if (is_null($subject)) {
array_push($this->openAPINullablesSetToNull, 'subject');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('subject', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['subject'] = $subject;
return $this;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* BasicAuthOptions
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* BasicAuthOptions Class Doc Comment
*
* @category Class
* @description Basic Authentication options for webhooks. Will be used is present when calling webhook endpoints.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class BasicAuthOptions implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'BasicAuthOptions';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'username' => 'string',
'password' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'username' => null,
'password' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'username' => false,
'password' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'username' => 'username',
'password' => 'password'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'username' => 'setUsername',
'password' => 'setPassword'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'username' => 'getUsername',
'password' => 'getPassword'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('username', $data ?? [], null);
$this->setIfExists('password', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['username'] === null) {
$invalidProperties[] = "'username' can't be null";
}
if ($this->container['password'] === null) {
$invalidProperties[] = "'password' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets username
*
* @return string
*/
public function getUsername()
{
return $this->container['username'];
}
/**
* Sets username
*
* @param string $username username
*
* @return self
*/
public function setUsername($username)
{
if (is_null($username)) {
throw new \InvalidArgumentException('non-nullable username cannot be null');
}
$this->container['username'] = $username;
return $this;
}
/**
* Gets password
*
* @return string
*/
public function getPassword()
{
return $this->container['password'];
}
/**
* Sets password
*
* @param string $password password
*
* @return self
*/
public function setPassword($password)
{
if (is_null($password)) {
throw new \InvalidArgumentException('non-nullable password cannot be null');
}
$this->container['password'] = $password;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* AttachmentProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* AttachmentProjection Class Doc Comment
*
* @category Class
* @description Email attachment data
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AttachmentProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AttachmentProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'user_id' => 'string',
'content_id' => 'string',
'attachment_id' => 'string',
'name' => 'string',
'content_length' => 'int',
'content_type' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'updated_at' => 'date-time',
'user_id' => 'uuid',
'content_id' => null,
'attachment_id' => null,
'name' => null,
'content_length' => 'int64',
'content_type' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'updated_at' => false,
'user_id' => false,
'content_id' => true,
'attachment_id' => false,
'name' => true,
'content_length' => true,
'content_type' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'user_id' => 'userId',
'content_id' => 'contentId',
'attachment_id' => 'attachmentId',
'name' => 'name',
'content_length' => 'contentLength',
'content_type' => 'contentType'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'user_id' => 'setUserId',
'content_id' => 'setContentId',
'attachment_id' => 'setAttachmentId',
'name' => 'setName',
'content_length' => 'setContentLength',
'content_type' => 'setContentType'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'user_id' => 'getUserId',
'content_id' => 'getContentId',
'attachment_id' => 'getAttachmentId',
'name' => 'getName',
'content_length' => 'getContentLength',
'content_type' => 'getContentType'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('content_id', $data ?? [], null);
$this->setIfExists('attachment_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('content_length', $data ?? [], null);
$this->setIfExists('content_type', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['attachment_id'] === null) {
$invalidProperties[] = "'attachment_id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets content_id
*
* @return string|null
*/
public function getContentId()
{
return $this->container['content_id'];
}
/**
* Sets content_id
*
* @param string|null $content_id Content ID of attachment.
*
* @return self
*/
public function setContentId($content_id)
{
if (is_null($content_id)) {
array_push($this->openAPINullablesSetToNull, 'content_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('content_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['content_id'] = $content_id;
return $this;
}
/**
* Gets attachment_id
*
* @return string
*/
public function getAttachmentId()
{
return $this->container['attachment_id'];
}
/**
* Sets attachment_id
*
* @param string $attachment_id Attachment ID
*
* @return self
*/
public function setAttachmentId($attachment_id)
{
if (is_null($attachment_id)) {
throw new \InvalidArgumentException('non-nullable attachment_id cannot be null');
}
$this->container['attachment_id'] = $attachment_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets content_length
*
* @return int|null
*/
public function getContentLength()
{
return $this->container['content_length'];
}
/**
* Sets content_length
*
* @param int|null $content_length Content length of attachment in bytes
*
* @return self
*/
public function setContentLength($content_length)
{
if (is_null($content_length)) {
array_push($this->openAPINullablesSetToNull, 'content_length');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('content_length', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['content_length'] = $content_length;
return $this;
}
/**
* Gets content_type
*
* @return string|null
*/
public function getContentType()
{
return $this->container['content_type'];
}
/**
* Sets content_type
*
* @param string|null $content_type Content type of attachment.
*
* @return self
*/
public function setContentType($content_type)
{
if (is_null($content_type)) {
array_push($this->openAPINullablesSetToNull, 'content_type');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('content_type', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['content_type'] = $content_type;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* AttachmentMetaData
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* AttachmentMetaData Class Doc Comment
*
* @category Class
* @description Meta data associated with an attachment. Attachments are stored as byte blobs so the meta data is stored separately.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AttachmentMetaData implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AttachmentMetaData';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'name' => 'string',
'content_type' => 'string',
'content_length' => 'int',
'id' => 'string',
'content_id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'name' => null,
'content_type' => null,
'content_length' => 'int64',
'id' => null,
'content_id' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'name' => false,
'content_type' => false,
'content_length' => false,
'id' => false,
'content_id' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'content_type' => 'contentType',
'content_length' => 'contentLength',
'id' => 'id',
'content_id' => 'contentId'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'content_type' => 'setContentType',
'content_length' => 'setContentLength',
'id' => 'setId',
'content_id' => 'setContentId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'content_type' => 'getContentType',
'content_length' => 'getContentLength',
'id' => 'getId',
'content_id' => 'getContentId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('content_type', $data ?? [], null);
$this->setIfExists('content_length', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('content_id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['name'] === null) {
$invalidProperties[] = "'name' can't be null";
}
if ($this->container['content_type'] === null) {
$invalidProperties[] = "'content_type' can't be null";
}
if ($this->container['content_length'] === null) {
$invalidProperties[] = "'content_length' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets name
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string $name Name of attachment if given
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets content_type
*
* @return string
*/
public function getContentType()
{
return $this->container['content_type'];
}
/**
* Sets content_type
*
* @param string $content_type Content type of attachment such as `image/png`
*
* @return self
*/
public function setContentType($content_type)
{
if (is_null($content_type)) {
throw new \InvalidArgumentException('non-nullable content_type cannot be null');
}
$this->container['content_type'] = $content_type;
return $this;
}
/**
* Gets content_length
*
* @return int
*/
public function getContentLength()
{
return $this->container['content_length'];
}
/**
* Sets content_length
*
* @param int $content_length Size of attachment in bytes
*
* @return self
*/
public function setContentLength($content_length)
{
if (is_null($content_length)) {
throw new \InvalidArgumentException('non-nullable content_length cannot be null');
}
$this->container['content_length'] = $content_length;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id ID of attachment. Can be used to with attachment controller endpoints to download attachment or with sending methods to attach to an email.
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets content_id
*
* @return string|null
*/
public function getContentId()
{
return $this->container['content_id'];
}
/**
* Sets content_id
*
* @param string|null $content_id CID of attachment
*
* @return self
*/
public function setContentId($content_id)
{
if (is_null($content_id)) {
array_push($this->openAPINullablesSetToNull, 'content_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('content_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['content_id'] = $content_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* AttachmentEntity
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* AttachmentEntity Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AttachmentEntity implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AttachmentEntity';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'attachment_id' => 'string',
'bucket' => 'string',
'user_id' => 'string',
'content_type' => 'string',
'content_length' => 'int',
'content_id' => 'string',
'name' => 'string',
'inbox_id' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'attachment_id' => null,
'bucket' => null,
'user_id' => 'uuid',
'content_type' => null,
'content_length' => 'int64',
'content_id' => null,
'name' => null,
'inbox_id' => 'uuid',
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'attachment_id' => false,
'bucket' => false,
'user_id' => false,
'content_type' => false,
'content_length' => false,
'content_id' => false,
'name' => false,
'inbox_id' => false,
'created_at' => false,
'updated_at' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'attachment_id' => 'attachmentId',
'bucket' => 'bucket',
'user_id' => 'userId',
'content_type' => 'contentType',
'content_length' => 'contentLength',
'content_id' => 'contentId',
'name' => 'name',
'inbox_id' => 'inboxId',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'attachment_id' => 'setAttachmentId',
'bucket' => 'setBucket',
'user_id' => 'setUserId',
'content_type' => 'setContentType',
'content_length' => 'setContentLength',
'content_id' => 'setContentId',
'name' => 'setName',
'inbox_id' => 'setInboxId',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'attachment_id' => 'getAttachmentId',
'bucket' => 'getBucket',
'user_id' => 'getUserId',
'content_type' => 'getContentType',
'content_length' => 'getContentLength',
'content_id' => 'getContentId',
'name' => 'getName',
'inbox_id' => 'getInboxId',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('attachment_id', $data ?? [], null);
$this->setIfExists('bucket', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('content_type', $data ?? [], null);
$this->setIfExists('content_length', $data ?? [], null);
$this->setIfExists('content_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['attachment_id'] === null) {
$invalidProperties[] = "'attachment_id' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string|null
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string|null $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets attachment_id
*
* @return string
*/
public function getAttachmentId()
{
return $this->container['attachment_id'];
}
/**
* Sets attachment_id
*
* @param string $attachment_id attachment_id
*
* @return self
*/
public function setAttachmentId($attachment_id)
{
if (is_null($attachment_id)) {
throw new \InvalidArgumentException('non-nullable attachment_id cannot be null');
}
$this->container['attachment_id'] = $attachment_id;
return $this;
}
/**
* Gets bucket
*
* @return string|null
*/
public function getBucket()
{
return $this->container['bucket'];
}
/**
* Sets bucket
*
* @param string|null $bucket bucket
*
* @return self
*/
public function setBucket($bucket)
{
if (is_null($bucket)) {
throw new \InvalidArgumentException('non-nullable bucket cannot be null');
}
$this->container['bucket'] = $bucket;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets content_type
*
* @return string|null
*/
public function getContentType()
{
return $this->container['content_type'];
}
/**
* Sets content_type
*
* @param string|null $content_type content_type
*
* @return self
*/
public function setContentType($content_type)
{
if (is_null($content_type)) {
throw new \InvalidArgumentException('non-nullable content_type cannot be null');
}
$this->container['content_type'] = $content_type;
return $this;
}
/**
* Gets content_length
*
* @return int|null
*/
public function getContentLength()
{
return $this->container['content_length'];
}
/**
* Sets content_length
*
* @param int|null $content_length content_length
*
* @return self
*/
public function setContentLength($content_length)
{
if (is_null($content_length)) {
throw new \InvalidArgumentException('non-nullable content_length cannot be null');
}
$this->container['content_length'] = $content_length;
return $this;
}
/**
* Gets content_id
*
* @return string|null
*/
public function getContentId()
{
return $this->container['content_id'];
}
/**
* Sets content_id
*
* @param string|null $content_id content_id
*
* @return self
*/
public function setContentId($content_id)
{
if (is_null($content_id)) {
throw new \InvalidArgumentException('non-nullable content_id cannot be null');
}
$this->container['content_id'] = $content_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets inbox_id
*
* @return string|null
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string|null $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* AliasProjection
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* AliasProjection Class Doc Comment
*
* @category Class
* @description Representation of a alias
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AliasProjection implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AliasProjection';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'created_at' => '\DateTime',
'updated_at' => '\DateTime',
'inbox_id' => 'string',
'email_address' => 'string',
'user_id' => 'string',
'use_threads' => 'bool',
'name' => 'string',
'id' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'created_at' => 'date-time',
'updated_at' => 'date-time',
'inbox_id' => 'uuid',
'email_address' => null,
'user_id' => 'uuid',
'use_threads' => null,
'name' => null,
'id' => 'uuid'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'created_at' => false,
'updated_at' => false,
'inbox_id' => false,
'email_address' => false,
'user_id' => false,
'use_threads' => false,
'name' => false,
'id' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'created_at' => 'createdAt',
'updated_at' => 'updatedAt',
'inbox_id' => 'inboxId',
'email_address' => 'emailAddress',
'user_id' => 'userId',
'use_threads' => 'useThreads',
'name' => 'name',
'id' => 'id'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt',
'inbox_id' => 'setInboxId',
'email_address' => 'setEmailAddress',
'user_id' => 'setUserId',
'use_threads' => 'setUseThreads',
'name' => 'setName',
'id' => 'setId'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt',
'inbox_id' => 'getInboxId',
'email_address' => 'getEmailAddress',
'user_id' => 'getUserId',
'use_threads' => 'getUseThreads',
'name' => 'getName',
'id' => 'getId'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('use_threads', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['created_at'] === null) {
$invalidProperties[] = "'created_at' can't be null";
}
if ($this->container['updated_at'] === null) {
$invalidProperties[] = "'updated_at' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets created_at
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
throw new \InvalidArgumentException('non-nullable created_at cannot be null');
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id inbox_id
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address email_address
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets use_threads
*
* @return bool|null
*/
public function getUseThreads()
{
return $this->container['use_threads'];
}
/**
* Sets use_threads
*
* @param bool|null $use_threads use_threads
*
* @return self
*/
public function setUseThreads($use_threads)
{
if (is_null($use_threads)) {
throw new \InvalidArgumentException('non-nullable use_threads cannot be null');
}
$this->container['use_threads'] = $use_threads;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* AliasDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* AliasDto Class Doc Comment
*
* @category Class
* @description Email alias representation
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AliasDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AliasDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'id' => 'string',
'email_address' => 'string',
'masked_email_address' => 'string',
'user_id' => 'string',
'inbox_id' => 'string',
'name' => 'string',
'use_threads' => 'bool',
'is_verified' => 'bool',
'domain_id' => 'string',
'created_at' => '\DateTime',
'updated_at' => '\DateTime'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'id' => 'uuid',
'email_address' => null,
'masked_email_address' => null,
'user_id' => 'uuid',
'inbox_id' => 'uuid',
'name' => null,
'use_threads' => null,
'is_verified' => null,
'domain_id' => 'uuid',
'created_at' => 'date-time',
'updated_at' => 'date-time'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'id' => false,
'email_address' => false,
'masked_email_address' => true,
'user_id' => false,
'inbox_id' => false,
'name' => true,
'use_threads' => true,
'is_verified' => false,
'domain_id' => true,
'created_at' => true,
'updated_at' => true
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'email_address' => 'emailAddress',
'masked_email_address' => 'maskedEmailAddress',
'user_id' => 'userId',
'inbox_id' => 'inboxId',
'name' => 'name',
'use_threads' => 'useThreads',
'is_verified' => 'isVerified',
'domain_id' => 'domainId',
'created_at' => 'createdAt',
'updated_at' => 'updatedAt'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'email_address' => 'setEmailAddress',
'masked_email_address' => 'setMaskedEmailAddress',
'user_id' => 'setUserId',
'inbox_id' => 'setInboxId',
'name' => 'setName',
'use_threads' => 'setUseThreads',
'is_verified' => 'setIsVerified',
'domain_id' => 'setDomainId',
'created_at' => 'setCreatedAt',
'updated_at' => 'setUpdatedAt'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'email_address' => 'getEmailAddress',
'masked_email_address' => 'getMaskedEmailAddress',
'user_id' => 'getUserId',
'inbox_id' => 'getInboxId',
'name' => 'getName',
'use_threads' => 'getUseThreads',
'is_verified' => 'getIsVerified',
'domain_id' => 'getDomainId',
'created_at' => 'getCreatedAt',
'updated_at' => 'getUpdatedAt'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('email_address', $data ?? [], null);
$this->setIfExists('masked_email_address', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
$this->setIfExists('inbox_id', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('use_threads', $data ?? [], null);
$this->setIfExists('is_verified', $data ?? [], null);
$this->setIfExists('domain_id', $data ?? [], null);
$this->setIfExists('created_at', $data ?? [], null);
$this->setIfExists('updated_at', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['email_address'] === null) {
$invalidProperties[] = "'email_address' can't be null";
}
if ($this->container['user_id'] === null) {
$invalidProperties[] = "'user_id' can't be null";
}
if ($this->container['inbox_id'] === null) {
$invalidProperties[] = "'inbox_id' can't be null";
}
if ($this->container['is_verified'] === null) {
$invalidProperties[] = "'is_verified' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id id
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets email_address
*
* @return string
*/
public function getEmailAddress()
{
return $this->container['email_address'];
}
/**
* Sets email_address
*
* @param string $email_address The alias's email address for receiving email
*
* @return self
*/
public function setEmailAddress($email_address)
{
if (is_null($email_address)) {
throw new \InvalidArgumentException('non-nullable email_address cannot be null');
}
$this->container['email_address'] = $email_address;
return $this;
}
/**
* Gets masked_email_address
*
* @return string|null
*/
public function getMaskedEmailAddress()
{
return $this->container['masked_email_address'];
}
/**
* Sets masked_email_address
*
* @param string|null $masked_email_address The underlying email address that is hidden and will received forwarded email
*
* @return self
*/
public function setMaskedEmailAddress($masked_email_address)
{
if (is_null($masked_email_address)) {
array_push($this->openAPINullablesSetToNull, 'masked_email_address');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('masked_email_address', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['masked_email_address'] = $masked_email_address;
return $this;
}
/**
* Gets user_id
*
* @return string
*/
public function getUserId()
{
return $this->container['user_id'];
}
/**
* Sets user_id
*
* @param string $user_id user_id
*
* @return self
*/
public function setUserId($user_id)
{
if (is_null($user_id)) {
throw new \InvalidArgumentException('non-nullable user_id cannot be null');
}
$this->container['user_id'] = $user_id;
return $this;
}
/**
* Gets inbox_id
*
* @return string
*/
public function getInboxId()
{
return $this->container['inbox_id'];
}
/**
* Sets inbox_id
*
* @param string $inbox_id Inbox that is associated with the alias
*
* @return self
*/
public function setInboxId($inbox_id)
{
if (is_null($inbox_id)) {
throw new \InvalidArgumentException('non-nullable inbox_id cannot be null');
}
$this->container['inbox_id'] = $inbox_id;
return $this;
}
/**
* Gets name
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param string|null $name name
*
* @return self
*/
public function setName($name)
{
if (is_null($name)) {
array_push($this->openAPINullablesSetToNull, 'name');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('name', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['name'] = $name;
return $this;
}
/**
* Gets use_threads
*
* @return bool|null
*/
public function getUseThreads()
{
return $this->container['use_threads'];
}
/**
* Sets use_threads
*
* @param bool|null $use_threads If alias will generate response threads or not when email are received by it
*
* @return self
*/
public function setUseThreads($use_threads)
{
if (is_null($use_threads)) {
array_push($this->openAPINullablesSetToNull, 'use_threads');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('use_threads', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['use_threads'] = $use_threads;
return $this;
}
/**
* Gets is_verified
*
* @return bool
*/
public function getIsVerified()
{
return $this->container['is_verified'];
}
/**
* Sets is_verified
*
* @param bool $is_verified Has the alias been verified. You must verify an alias if the masked email address has not yet been verified by your account
*
* @return self
*/
public function setIsVerified($is_verified)
{
if (is_null($is_verified)) {
throw new \InvalidArgumentException('non-nullable is_verified cannot be null');
}
$this->container['is_verified'] = $is_verified;
return $this;
}
/**
* Gets domain_id
*
* @return string|null
*/
public function getDomainId()
{
return $this->container['domain_id'];
}
/**
* Sets domain_id
*
* @param string|null $domain_id Domain ID associated with the alias
*
* @return self
*/
public function setDomainId($domain_id)
{
if (is_null($domain_id)) {
array_push($this->openAPINullablesSetToNull, 'domain_id');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('domain_id', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['domain_id'] = $domain_id;
return $this;
}
/**
* Gets created_at
*
* @return \DateTime|null
*/
public function getCreatedAt()
{
return $this->container['created_at'];
}
/**
* Sets created_at
*
* @param \DateTime|null $created_at created_at
*
* @return self
*/
public function setCreatedAt($created_at)
{
if (is_null($created_at)) {
array_push($this->openAPINullablesSetToNull, 'created_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('created_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['created_at'] = $created_at;
return $this;
}
/**
* Gets updated_at
*
* @return \DateTime|null
*/
public function getUpdatedAt()
{
return $this->container['updated_at'];
}
/**
* Sets updated_at
*
* @param \DateTime|null $updated_at updated_at
*
* @return self
*/
public function setUpdatedAt($updated_at)
{
if (is_null($updated_at)) {
array_push($this->openAPINullablesSetToNull, 'updated_at');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
$index = array_search('updated_at', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['updated_at'] = $updated_at;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* AccountBounceBlockDto
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* AccountBounceBlockDto Class Doc Comment
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AccountBounceBlockDto implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AccountBounceBlockDto';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'is_sending_blocked' => 'bool',
'bounce_count' => 'int',
'bounce_count_today' => 'int',
'maximum_daily_bounces' => 'int',
'maximum_account_bounces' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'is_sending_blocked' => null,
'bounce_count' => 'int64',
'bounce_count_today' => 'int64',
'maximum_daily_bounces' => 'int64',
'maximum_account_bounces' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'is_sending_blocked' => false,
'bounce_count' => false,
'bounce_count_today' => false,
'maximum_daily_bounces' => false,
'maximum_account_bounces' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'is_sending_blocked' => 'isSendingBlocked',
'bounce_count' => 'bounceCount',
'bounce_count_today' => 'bounceCountToday',
'maximum_daily_bounces' => 'maximumDailyBounces',
'maximum_account_bounces' => 'maximumAccountBounces'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'is_sending_blocked' => 'setIsSendingBlocked',
'bounce_count' => 'setBounceCount',
'bounce_count_today' => 'setBounceCountToday',
'maximum_daily_bounces' => 'setMaximumDailyBounces',
'maximum_account_bounces' => 'setMaximumAccountBounces'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'is_sending_blocked' => 'getIsSendingBlocked',
'bounce_count' => 'getBounceCount',
'bounce_count_today' => 'getBounceCountToday',
'maximum_daily_bounces' => 'getMaximumDailyBounces',
'maximum_account_bounces' => 'getMaximumAccountBounces'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('is_sending_blocked', $data ?? [], null);
$this->setIfExists('bounce_count', $data ?? [], null);
$this->setIfExists('bounce_count_today', $data ?? [], null);
$this->setIfExists('maximum_daily_bounces', $data ?? [], null);
$this->setIfExists('maximum_account_bounces', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['is_sending_blocked'] === null) {
$invalidProperties[] = "'is_sending_blocked' can't be null";
}
if ($this->container['bounce_count'] === null) {
$invalidProperties[] = "'bounce_count' can't be null";
}
if ($this->container['bounce_count_today'] === null) {
$invalidProperties[] = "'bounce_count_today' can't be null";
}
if ($this->container['maximum_daily_bounces'] === null) {
$invalidProperties[] = "'maximum_daily_bounces' can't be null";
}
if ($this->container['maximum_account_bounces'] === null) {
$invalidProperties[] = "'maximum_account_bounces' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets is_sending_blocked
*
* @return bool
*/
public function getIsSendingBlocked()
{
return $this->container['is_sending_blocked'];
}
/**
* Sets is_sending_blocked
*
* @param bool $is_sending_blocked is_sending_blocked
*
* @return self
*/
public function setIsSendingBlocked($is_sending_blocked)
{
if (is_null($is_sending_blocked)) {
throw new \InvalidArgumentException('non-nullable is_sending_blocked cannot be null');
}
$this->container['is_sending_blocked'] = $is_sending_blocked;
return $this;
}
/**
* Gets bounce_count
*
* @return int
*/
public function getBounceCount()
{
return $this->container['bounce_count'];
}
/**
* Sets bounce_count
*
* @param int $bounce_count bounce_count
*
* @return self
*/
public function setBounceCount($bounce_count)
{
if (is_null($bounce_count)) {
throw new \InvalidArgumentException('non-nullable bounce_count cannot be null');
}
$this->container['bounce_count'] = $bounce_count;
return $this;
}
/**
* Gets bounce_count_today
*
* @return int
*/
public function getBounceCountToday()
{
return $this->container['bounce_count_today'];
}
/**
* Sets bounce_count_today
*
* @param int $bounce_count_today bounce_count_today
*
* @return self
*/
public function setBounceCountToday($bounce_count_today)
{
if (is_null($bounce_count_today)) {
throw new \InvalidArgumentException('non-nullable bounce_count_today cannot be null');
}
$this->container['bounce_count_today'] = $bounce_count_today;
return $this;
}
/**
* Gets maximum_daily_bounces
*
* @return int
*/
public function getMaximumDailyBounces()
{
return $this->container['maximum_daily_bounces'];
}
/**
* Sets maximum_daily_bounces
*
* @param int $maximum_daily_bounces maximum_daily_bounces
*
* @return self
*/
public function setMaximumDailyBounces($maximum_daily_bounces)
{
if (is_null($maximum_daily_bounces)) {
throw new \InvalidArgumentException('non-nullable maximum_daily_bounces cannot be null');
}
$this->container['maximum_daily_bounces'] = $maximum_daily_bounces;
return $this;
}
/**
* Gets maximum_account_bounces
*
* @return int
*/
public function getMaximumAccountBounces()
{
return $this->container['maximum_account_bounces'];
}
/**
* Sets maximum_account_bounces
*
* @param int $maximum_account_bounces maximum_account_bounces
*
* @return self
*/
public function setMaximumAccountBounces($maximum_account_bounces)
{
if (is_null($maximum_account_bounces)) {
throw new \InvalidArgumentException('non-nullable maximum_account_bounces cannot be null');
}
$this->container['maximum_account_bounces'] = $maximum_account_bounces;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* AbstractWebhookPayload
*
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp\Models;
use \ArrayAccess;
use \MailSlurp\ObjectSerializer;
/**
* AbstractWebhookPayload Class Doc Comment
*
* @category Class
* @description Abstract webhook payload. Use the correct payload type for your webhook event type in order to access all the specific properties for that event. See the `NEW_EMAIL`,`NEW_CONTACT`, `NEW_ATTACHMENT` and `EMAIL_OPENED` payloads for the properties available for those events.
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AbstractWebhookPayload implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AbstractWebhookPayload';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'event_name' => 'string',
'message_id' => 'string',
'webhook_id' => 'string',
'webhook_name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'event_name' => null,
'message_id' => null,
'webhook_id' => 'uuid',
'webhook_name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static array $openAPINullables = [
'event_name' => false,
'message_id' => false,
'webhook_id' => false,
'webhook_name' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'event_name' => 'eventName',
'message_id' => 'messageId',
'webhook_id' => 'webhookId',
'webhook_name' => 'webhookName'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'event_name' => 'setEventName',
'message_id' => 'setMessageId',
'webhook_id' => 'setWebhookId',
'webhook_name' => 'setWebhookName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'event_name' => 'getEventName',
'message_id' => 'getMessageId',
'webhook_id' => 'getWebhookId',
'webhook_name' => 'getWebhookName'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const EVENT_NAME_EMAIL_RECEIVED = 'EMAIL_RECEIVED';
public const EVENT_NAME_NEW_EMAIL = 'NEW_EMAIL';
public const EVENT_NAME_NEW_CONTACT = 'NEW_CONTACT';
public const EVENT_NAME_NEW_ATTACHMENT = 'NEW_ATTACHMENT';
public const EVENT_NAME_EMAIL_OPENED = 'EMAIL_OPENED';
public const EVENT_NAME_EMAIL_READ = 'EMAIL_READ';
public const EVENT_NAME_DELIVERY_STATUS = 'DELIVERY_STATUS';
public const EVENT_NAME_BOUNCE = 'BOUNCE';
public const EVENT_NAME_BOUNCE_RECIPIENT = 'BOUNCE_RECIPIENT';
public const EVENT_NAME_NEW_SMS = 'NEW_SMS';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getEventNameAllowableValues()
{
return [
self::EVENT_NAME_EMAIL_RECEIVED,
self::EVENT_NAME_NEW_EMAIL,
self::EVENT_NAME_NEW_CONTACT,
self::EVENT_NAME_NEW_ATTACHMENT,
self::EVENT_NAME_EMAIL_OPENED,
self::EVENT_NAME_EMAIL_READ,
self::EVENT_NAME_DELIVERY_STATUS,
self::EVENT_NAME_BOUNCE,
self::EVENT_NAME_BOUNCE_RECIPIENT,
self::EVENT_NAME_NEW_SMS,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('event_name', $data ?? [], null);
$this->setIfExists('message_id', $data ?? [], null);
$this->setIfExists('webhook_id', $data ?? [], null);
$this->setIfExists('webhook_name', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['event_name'] === null) {
$invalidProperties[] = "'event_name' can't be null";
}
$allowedValues = $this->getEventNameAllowableValues();
if (!is_null($this->container['event_name']) && !in_array($this->container['event_name'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'event_name', must be one of '%s'",
$this->container['event_name'],
implode("', '", $allowedValues)
);
}
if ($this->container['message_id'] === null) {
$invalidProperties[] = "'message_id' can't be null";
}
if ($this->container['webhook_id'] === null) {
$invalidProperties[] = "'webhook_id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets event_name
*
* @return string
*/
public function getEventName()
{
return $this->container['event_name'];
}
/**
* Sets event_name
*
* @param string $event_name event_name
*
* @return self
*/
public function setEventName($event_name)
{
$allowedValues = $this->getEventNameAllowableValues();
if (!in_array($event_name, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'event_name', must be one of '%s'",
$event_name,
implode("', '", $allowedValues)
)
);
}
if (is_null($event_name)) {
throw new \InvalidArgumentException('non-nullable event_name cannot be null');
}
$this->container['event_name'] = $event_name;
return $this;
}
/**
* Gets message_id
*
* @return string
*/
public function getMessageId()
{
return $this->container['message_id'];
}
/**
* Sets message_id
*
* @param string $message_id message_id
*
* @return self
*/
public function setMessageId($message_id)
{
if (is_null($message_id)) {
throw new \InvalidArgumentException('non-nullable message_id cannot be null');
}
$this->container['message_id'] = $message_id;
return $this;
}
/**
* Gets webhook_id
*
* @return string
*/
public function getWebhookId()
{
return $this->container['webhook_id'];
}
/**
* Sets webhook_id
*
* @param string $webhook_id webhook_id
*
* @return self
*/
public function setWebhookId($webhook_id)
{
if (is_null($webhook_id)) {
throw new \InvalidArgumentException('non-nullable webhook_id cannot be null');
}
$this->container['webhook_id'] = $webhook_id;
return $this;
}
/**
* Gets webhook_name
*
* @return string|null
*/
public function getWebhookName()
{
return $this->container['webhook_name'];
}
/**
* Sets webhook_name
*
* @param string|null $webhook_name webhook_name
*
* @return self
*/
public function setWebhookName($webhook_name)
{
if (is_null($webhook_name)) {
throw new \InvalidArgumentException('non-nullable webhook_name cannot be null');
}
$this->container['webhook_name'] = $webhook_name;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
<?php
/**
* Configuration
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
/**
* MailSlurp API
*
* MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
*
* The version of the OpenAPI document: 6.5.2
* Contact: contact@mailslurp.dev
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.2.1
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace MailSlurp;
/**
* Configuration Class Doc Comment
* PHP version 7.4
*
* @category Class
* @package MailSlurp
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
*/
class Configuration
{
public const BOOLEAN_FORMAT_INT = 'int';
public const BOOLEAN_FORMAT_STRING = 'string';
/**
* @var Configuration
*/
private static $defaultConfiguration;
/**
* Associate array to store API key(s)
*
* @var string[]
*/
protected $apiKeys = [];
/**
* Associate array to store API prefix (e.g. Bearer)
*
* @var string[]
*/
protected $apiKeyPrefixes = [];
/**
* Access token for OAuth/Bearer authentication
*
* @var string
*/
protected $accessToken = '';
/**
* Boolean format for query string
*
* @var string
*/
protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
/**
* Username for HTTP basic authentication
*
* @var string
*/
protected $username = '';
/**
* Password for HTTP basic authentication
*
* @var string
*/
protected $password = '';
/**
* The host
*
* @var string
*/
protected $host = 'https://php.api.mailslurp.com';
/**
* User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default
*
* @var string
*/
protected $userAgent = 'OpenAPI-Generator/15.19.22/PHP';
/**
* Debug switch (default set to false)
*
* @var bool
*/
protected $debug = false;
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $debugFile = 'php://output';
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $tempFolderPath;
/**
* Constructor
*/
public function __construct()
{
$this->tempFolderPath = sys_get_temp_dir();
}
/**
* Sets API key
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $key API key or token
*
* @return $this
*/
public function setApiKey($apiKeyIdentifier, $key)
{
$this->apiKeys[$apiKeyIdentifier] = $key;
return $this;
}
/**
* Gets API key
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return null|string API key or token
*/
public function getApiKey($apiKeyIdentifier)
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
}
/**
* Sets the prefix for API key (e.g. Bearer)
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $prefix API key prefix, e.g. Bearer
*
* @return $this
*/
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
{
$this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
return $this;
}
/**
* Gets API key prefix
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return null|string
*/
public function getApiKeyPrefix($apiKeyIdentifier)
{
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
}
/**
* Sets the access token for OAuth
*
* @param string $accessToken Token for OAuth
*
* @return $this
*/
public function setAccessToken($accessToken)
{
$this->accessToken = $accessToken;
return $this;
}
/**
* Gets the access token for OAuth
*
* @return string Access token for OAuth
*/
public function getAccessToken()
{
return $this->accessToken;
}
/**
* Sets boolean format for query string.
*
* @param string $booleanFormatForQueryString Boolean format for query string
*
* @return $this
*/
public function setBooleanFormatForQueryString(string $booleanFormat)
{
$this->booleanFormatForQueryString = $booleanFormat;
return $this;
}
/**
* Gets boolean format for query string.
*
* @return string Boolean format for query string
*/
public function getBooleanFormatForQueryString(): string
{
return $this->booleanFormatForQueryString;
}
/**
* Sets the username for HTTP basic authentication
*
* @param string $username Username for HTTP basic authentication
*
* @return $this
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Gets the username for HTTP basic authentication
*
* @return string Username for HTTP basic authentication
*/
public function getUsername()
{
return $this->username;
}
/**
* Sets the password for HTTP basic authentication
*
* @param string $password Password for HTTP basic authentication
*
* @return $this
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Gets the password for HTTP basic authentication
*
* @return string Password for HTTP basic authentication
*/
public function getPassword()
{
return $this->password;
}
/**
* Sets the host
*
* @param string $host Host
*
* @return $this
*/
public function setHost($host)
{
$this->host = $host;
return $this;
}
/**
* Gets the host
*
* @return string Host
*/
public function getHost()
{
return $this->host;
}
/**
* Sets the user agent of the api client
*
* @param string $userAgent the user agent of the api client
*
* @throws \InvalidArgumentException
* @return $this
*/
public function setUserAgent($userAgent)
{
if (!is_string($userAgent)) {
throw new \InvalidArgumentException('User-agent must be a string.');
}
$this->userAgent = $userAgent;
return $this;
}
/**
* Gets the user agent of the api client
*
* @return string user agent
*/
public function getUserAgent()
{
return $this->userAgent;
}
/**
* Sets debug flag
*
* @param bool $debug Debug flag
*
* @return $this
*/
public function setDebug($debug)
{
$this->debug = $debug;
return $this;
}
/**
* Gets the debug flag
*
* @return bool
*/
public function getDebug()
{
return $this->debug;
}
/**
* Sets the debug file
*
* @param string $debugFile Debug file
*
* @return $this
*/
public function setDebugFile($debugFile)
{
$this->debugFile = $debugFile;
return $this;
}
/**
* Gets the debug file
*
* @return string
*/
public function getDebugFile()
{
return $this->debugFile;
}
/**
* Sets the temp folder path
*
* @param string $tempFolderPath Temp folder path
*
* @return $this
*/
public function setTempFolderPath($tempFolderPath)
{
$this->tempFolderPath = $tempFolderPath;
return $this;
}
/**
* Gets the temp folder path
*
* @return string Temp folder path
*/
public function getTempFolderPath()
{
return $this->tempFolderPath;
}
/**
* Gets the default configuration instance
*
* @return Configuration
*/
public static function getDefaultConfiguration()
{
if (self::$defaultConfiguration === null) {
self::$defaultConfiguration = new Configuration();
}
return self::$defaultConfiguration;
}
/**
* Sets the default configuration instance
*
* @param Configuration $config An instance of the Configuration Object
*
* @return void
*/
public static function setDefaultConfiguration(Configuration $config)
{
self::$defaultConfiguration = $config;
}
/**
* Gets the essential information for debugging
*
* @return string The report for debugging
*/
public static function toDebugReport()
{
$report = 'PHP SDK (MailSlurp) Debug Report:' . PHP_EOL;
$report .= ' OS: ' . php_uname() . PHP_EOL;
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
$report .= ' The version of the OpenAPI document: 6.5.2' . PHP_EOL;
$report .= ' SDK Package Version: 15.19.22' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
return $report;
}
/**
* Get API key (with prefix if set)
*
* @param string $apiKeyIdentifier name of apikey
*
* @return null|string API key with the prefix
*/
public function getApiKeyWithPrefix($apiKeyIdentifier)
{
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->getApiKey($apiKeyIdentifier);
if ($apiKey === null) {
return null;
}
if ($prefix === null) {
$keyWithPrefix = $apiKey;
} else {
$keyWithPrefix = $prefix . ' ' . $apiKey;
}
return $keyWithPrefix;
}
/**
* Returns an array of host settings
*
* @return array an array of host settings
*/
public function getHostSettings()
{
return [
[
"url" => "https://php.api.mailslurp.com",
"description" => "MailSlurp API Server",
]
];
}
/**
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null)
{
if (null === $variables) {
$variables = [];
}
// check array index out of bound
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
}
$host = $hostsSettings[$hostIndex];
$url = $host["url"];
// go through variable and assign a value
foreach ($host["variables"] ?? [] as $name => $variable) {
if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
$url = str_replace("{".$name."}", $variables[$name], $url);
} else {
throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
}
} else {
// use default value
$url = str_replace("{".$name."}", $variable["default_value"], $url);
}
}
return $url;
}
/**
* Returns URL based on the index and variables
*
* @param int $index index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public function getHostFromSettings($index, $variables = null)
{
return self::getHostString($this->getHostSettings(), $index, $variables);
}
}