| Requires any of the roles: | Client, Admin, Partner |
| All Verbs | /sendmail/sendgrid/single |
|---|
<?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};
class EmailAddress implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Email=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Email'])) $this->Email = $o['Email'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Email)) $o['Email'] = $this->Email;
return empty($o) ? new class(){} : $o;
}
}
class SendGridSingleMailRequest implements JsonSerializable
{
public function __construct(
/** @var EmailAddress|null */
public ?EmailAddress $To=null,
/** @var string|null */
public ?string $Subject=null,
/** @var string|null */
public ?string $TemplateId=null,
/** @var EmailAddress|null */
public ?EmailAddress $ReplyToEmail=null,
/** @var EmailAddress|null */
public ?EmailAddress $FromEmail=null,
/** @var string|null */
public ?string $PlaintText=null,
/** @var string|null */
public ?string $HtmlText=null,
/** @var string|null */
public ?string $APIKey=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['To'])) $this->To = JsonConverters::from('EmailAddress', $o['To']);
if (isset($o['Subject'])) $this->Subject = $o['Subject'];
if (isset($o['TemplateId'])) $this->TemplateId = $o['TemplateId'];
if (isset($o['ReplyToEmail'])) $this->ReplyToEmail = JsonConverters::from('EmailAddress', $o['ReplyToEmail']);
if (isset($o['FromEmail'])) $this->FromEmail = JsonConverters::from('EmailAddress', $o['FromEmail']);
if (isset($o['PlaintText'])) $this->PlaintText = $o['PlaintText'];
if (isset($o['HtmlText'])) $this->HtmlText = $o['HtmlText'];
if (isset($o['APIKey'])) $this->APIKey = $o['APIKey'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->To)) $o['To'] = JsonConverters::to('EmailAddress', $this->To);
if (isset($this->Subject)) $o['Subject'] = $this->Subject;
if (isset($this->TemplateId)) $o['TemplateId'] = $this->TemplateId;
if (isset($this->ReplyToEmail)) $o['ReplyToEmail'] = JsonConverters::to('EmailAddress', $this->ReplyToEmail);
if (isset($this->FromEmail)) $o['FromEmail'] = JsonConverters::to('EmailAddress', $this->FromEmail);
if (isset($this->PlaintText)) $o['PlaintText'] = $this->PlaintText;
if (isset($this->HtmlText)) $o['HtmlText'] = $this->HtmlText;
if (isset($this->APIKey)) $o['APIKey'] = $this->APIKey;
return empty($o) ? new class(){} : $o;
}
}
PHP SendGridSingleMailRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /sendmail/sendgrid/single HTTP/1.1
Host: duengageapi.uat.scadsoftware.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"To":{"Name":"String","Email":"String"},"Subject":"String","TemplateId":"String","ReplyToEmail":{"Name":"String","Email":"String"},"FromEmail":{"Name":"String","Email":"String"},"PlaintText":"String","HtmlText":"String","APIKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{}