Server

<back to all web services

SmtpConfigSsl

Requires Authentication
The following routes are available for this service:
POST/files/Ssl
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


enum SecurityType : string
{
    case Ssl = 'Ssl';
    case Tls = 'Tls';
    case Certificate = 'Certificate';
}

// @DataContract
class SmtpConfig implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="Host")
        /** @var string|null */
        public ?string $Host=null,

        // @DataMember(Name="Port")
        /** @var string|null */
        public ?string $Port=null,

        // @DataMember(Name="SecurityType")
        /** @var SecurityType|null */
        public ?SecurityType $SecurityType=null,

        // @DataMember(Name="Username")
        /** @var string|null */
        public ?string $Username=null,

        // @DataMember(Name="Password")
        /** @var string|null */
        public ?string $Password=null,

        // @DataMember(Name="SmtpFromEmail")
        /** @var string|null */
        public ?string $SmtpFromEmail=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Host'])) $this->Host = $o['Host'];
        if (isset($o['Port'])) $this->Port = $o['Port'];
        if (isset($o['SecurityType'])) $this->SecurityType = JsonConverters::from('SecurityType', $o['SecurityType']);
        if (isset($o['Username'])) $this->Username = $o['Username'];
        if (isset($o['Password'])) $this->Password = $o['Password'];
        if (isset($o['SmtpFromEmail'])) $this->SmtpFromEmail = $o['SmtpFromEmail'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Host)) $o['Host'] = $this->Host;
        if (isset($this->Port)) $o['Port'] = $this->Port;
        if (isset($this->SecurityType)) $o['SecurityType'] = JsonConverters::to('SecurityType', $this->SecurityType);
        if (isset($this->Username)) $o['Username'] = $this->Username;
        if (isset($this->Password)) $o['Password'] = $this->Password;
        if (isset($this->SmtpFromEmail)) $o['SmtpFromEmail'] = $this->SmtpFromEmail;
        return empty($o) ? new class(){} : $o;
    }
}

class SmtpConfigResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class SmtpConfigSsl extends SmtpConfig implements JsonSerializable
{
    /**
     * @param string|null $Host
     * @param string|null $Port
     * @param SecurityType|null $SecurityType
     * @param string|null $Username
     * @param string|null $Password
     * @param string|null $SmtpFromEmail
     */
    public function __construct(
        ?string $Host=null,
        ?string $Port=null,
        ?SecurityType $SecurityType=null,
        ?string $Username=null,
        ?string $Password=null,
        ?string $SmtpFromEmail=null
    ) {
        parent::__construct($Host,$Port,$SecurityType,$Username,$Password,$SmtpFromEmail);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['SecurityType'])) $this->SecurityType = JsonConverters::from('SecurityType', $o['SecurityType']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->SecurityType)) $o['SecurityType'] = JsonConverters::to('SecurityType', $this->SecurityType);
        return empty($o) ? new class(){} : $o;
    }
}

PHP SmtpConfigSsl DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /files/Ssl HTTP/1.1 
Host: emg-servdesk.eras-online.de 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	SecurityType: Ssl,
	Host: String,
	Port: String,
	Username: String,
	Password: String,
	SmtpFromEmail: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}