Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"variables": {
"${LATEST}": "3.325.0"
"${LATEST}": "3.325.1"
},
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
"services": {
Expand Down
4 changes: 4 additions & 0 deletions src/Service/Ses/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Added

- AWS api-change: This release enables customers to provide the email template content in the SESv2 SendEmail and SendBulkEmail APIs instead of the name or the ARN of a stored email template.

## 1.8.2

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Ses/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
"dev-master": "1.9-dev"
}
}
}
90 changes: 90 additions & 0 deletions src/Service/Ses/src/ValueObject/EmailTemplateContent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace AsyncAws\Ses\ValueObject;

/**
* The content of the email, composed of a subject line, an HTML part, and a text-only part.
*/
final class EmailTemplateContent
{
/**
* The subject line of the email.
*
* @var string|null
*/
private $subject;

/**
* The email body that will be visible to recipients whose email clients do not display HTML.
*
* @var string|null
*/
private $text;

/**
* The HTML body of the email.
*
* @var string|null
*/
private $html;

/**
* @param array{
* Subject?: null|string,
* Text?: null|string,
* Html?: null|string,
* } $input
*/
public function __construct(array $input)
{
$this->subject = $input['Subject'] ?? null;
$this->text = $input['Text'] ?? null;
$this->html = $input['Html'] ?? null;
}

/**
* @param array{
* Subject?: null|string,
* Text?: null|string,
* Html?: null|string,
* }|EmailTemplateContent $input
*/
public static function create($input): self
{
return $input instanceof self ? $input : new self($input);
}

public function getHtml(): ?string
{
return $this->html;
}

public function getSubject(): ?string
{
return $this->subject;
}

public function getText(): ?string
{
return $this->text;
}

/**
* @internal
*/
public function requestBody(): array
{
$payload = [];
if (null !== $v = $this->subject) {
$payload['Subject'] = $v;
}
if (null !== $v = $this->text) {
$payload['Text'] = $v;
}
if (null !== $v = $this->html) {
$payload['Html'] = $v;
}

return $payload;
}
}
24 changes: 23 additions & 1 deletion src/Service/Ses/src/ValueObject/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
/**
* An object that defines the email template to use for an email message, and the values to use for any message
* variables in that template. An *email template* is a type of message template that contains content that you want to
* define, save, and reuse in email messages that you send.
* reuse in email messages that you send. You can specifiy the email template by providing the name or ARN of an *email
* template* previously saved in your Amazon SES account or by providing the full template content.
*/
final class Template
{
Expand All @@ -24,6 +25,16 @@ final class Template
*/
private $templateArn;

/**
* The content of the template.
*
* > Amazon SES supports only simple substitions when you send email using the `SendEmail` or `SendBulkEmail` operations
* > and you provide the full template content in the request.
*
* @var EmailTemplateContent|null
*/
private $templateContent;

/**
* An object that defines the values to use for message variables in the template. This object is a set of key-value
* pairs. Each key defines a message variable in the template. The corresponding value defines the value to use for that
Expand All @@ -44,6 +55,7 @@ final class Template
* @param array{
* TemplateName?: null|string,
* TemplateArn?: null|string,
* TemplateContent?: null|EmailTemplateContent|array,
* TemplateData?: null|string,
* Headers?: null|array<MessageHeader|array>,
* } $input
Expand All @@ -52,6 +64,7 @@ public function __construct(array $input)
{
$this->templateName = $input['TemplateName'] ?? null;
$this->templateArn = $input['TemplateArn'] ?? null;
$this->templateContent = isset($input['TemplateContent']) ? EmailTemplateContent::create($input['TemplateContent']) : null;
$this->templateData = $input['TemplateData'] ?? null;
$this->headers = isset($input['Headers']) ? array_map([MessageHeader::class, 'create'], $input['Headers']) : null;
}
Expand All @@ -60,6 +73,7 @@ public function __construct(array $input)
* @param array{
* TemplateName?: null|string,
* TemplateArn?: null|string,
* TemplateContent?: null|EmailTemplateContent|array,
* TemplateData?: null|string,
* Headers?: null|array<MessageHeader|array>,
* }|Template $input
Expand All @@ -82,6 +96,11 @@ public function getTemplateArn(): ?string
return $this->templateArn;
}

public function getTemplateContent(): ?EmailTemplateContent
{
return $this->templateContent;
}

public function getTemplateData(): ?string
{
return $this->templateData;
Expand All @@ -104,6 +123,9 @@ public function requestBody(): array
if (null !== $v = $this->templateArn) {
$payload['TemplateArn'] = $v;
}
if (null !== $v = $this->templateContent) {
$payload['TemplateContent'] = $v->requestBody();
}
if (null !== $v = $this->templateData) {
$payload['TemplateData'] = $v;
}
Expand Down
Loading