diff --git a/manifest.json b/manifest.json index b61f18f70..e72617e05 100644 --- a/manifest.json +++ b/manifest.json @@ -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": { diff --git a/src/Service/Ses/CHANGELOG.md b/src/Service/Ses/CHANGELOG.md index 1d2da0a07..5636bcdc7 100644 --- a/src/Service/Ses/CHANGELOG.md +++ b/src/Service/Ses/CHANGELOG.md @@ -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 diff --git a/src/Service/Ses/composer.json b/src/Service/Ses/composer.json index b3383df40..2defcc28d 100644 --- a/src/Service/Ses/composer.json +++ b/src/Service/Ses/composer.json @@ -27,7 +27,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/src/Service/Ses/src/ValueObject/EmailTemplateContent.php b/src/Service/Ses/src/ValueObject/EmailTemplateContent.php new file mode 100644 index 000000000..dc7b95cc2 --- /dev/null +++ b/src/Service/Ses/src/ValueObject/EmailTemplateContent.php @@ -0,0 +1,90 @@ +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; + } +} diff --git a/src/Service/Ses/src/ValueObject/Template.php b/src/Service/Ses/src/ValueObject/Template.php index 7fa35a6df..ba3c4001d 100644 --- a/src/Service/Ses/src/ValueObject/Template.php +++ b/src/Service/Ses/src/ValueObject/Template.php @@ -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 { @@ -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 @@ -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, * } $input @@ -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; } @@ -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, * }|Template $input @@ -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; @@ -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; }