Skip to content

Commit 4543e8d

Browse files
Update generated code (#1678)
update generated code
1 parent 881f40f commit 4543e8d

File tree

8 files changed

+149
-8
lines changed

8 files changed

+149
-8
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"variables": {
3-
"${LATEST}": "3.300.10"
3+
"${LATEST}": "3.300.11"
44
},
55
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
66
"services": {

src/Service/Ses/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: Adds support for providing custom headers within SendEmail and SendBulkEmail for SESv2.
8+
59
## 1.7.0
610

711
### Added

src/Service/Ses/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"extra": {
2929
"branch-alias": {
30-
"dev-master": "1.7-dev"
30+
"dev-master": "1.8-dev"
3131
}
3232
}
3333
}

src/Service/Ses/src/Input/SendEmailRequest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use AsyncAws\Ses\ValueObject\ListManagementOptions;
1414
use AsyncAws\Ses\ValueObject\Message;
1515
use AsyncAws\Ses\ValueObject\MessageTag;
16-
use AsyncAws\Ses\ValueObject\Template;
1716

1817
/**
1918
* Represents a request to send a single formatted email using Amazon SES. For more information, see the Amazon SES
@@ -91,8 +90,8 @@ final class SendEmailRequest extends Input
9190
private $feedbackForwardingEmailAddressIdentityArn;
9291

9392
/**
94-
* An object that contains the body of the message. You can send either a Simple message Raw message or a template
95-
* Message.
93+
* An object that contains the body of the message. You can send either a Simple message, Raw message, or a Templated
94+
* message.
9695
*
9796
* @required
9897
*

src/Service/Ses/src/Result/SendEmailResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class SendEmailResponse extends Result
1313
/**
1414
* A unique identifier for the message that is generated when the message is accepted.
1515
*
16-
* > It's possible for Amazon SES to accept a message without sending it. This can happen when the message that you're
17-
* > trying to send has an attachment contains a virus, or when you send a templated email that contains invalid
18-
* > personalization content, for example.
16+
* > It's possible for Amazon SES to accept a message without sending it. For example, this can happen when the message
17+
* > that you're trying to send has an attachment that contains a virus, or when you send a templated email that
18+
* > contains invalid personalization content.
1919
*
2020
* @var string|null
2121
*/

src/Service/Ses/src/ValueObject/Message.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,32 @@ final class Message
2626
*/
2727
private $body;
2828

29+
/**
30+
* The list of message headers that will be added to the email message.
31+
*
32+
* @var MessageHeader[]|null
33+
*/
34+
private $headers;
35+
2936
/**
3037
* @param array{
3138
* Subject: Content|array,
3239
* Body: Body|array,
40+
* Headers?: null|array<MessageHeader|array>,
3341
* } $input
3442
*/
3543
public function __construct(array $input)
3644
{
3745
$this->subject = isset($input['Subject']) ? Content::create($input['Subject']) : $this->throwException(new InvalidArgument('Missing required field "Subject".'));
3846
$this->body = isset($input['Body']) ? Body::create($input['Body']) : $this->throwException(new InvalidArgument('Missing required field "Body".'));
47+
$this->headers = isset($input['Headers']) ? array_map([MessageHeader::class, 'create'], $input['Headers']) : null;
3948
}
4049

4150
/**
4251
* @param array{
4352
* Subject: Content|array,
4453
* Body: Body|array,
54+
* Headers?: null|array<MessageHeader|array>,
4555
* }|Message $input
4656
*/
4757
public static function create($input): self
@@ -54,6 +64,14 @@ public function getBody(): Body
5464
return $this->body;
5565
}
5666

67+
/**
68+
* @return MessageHeader[]
69+
*/
70+
public function getHeaders(): array
71+
{
72+
return $this->headers ?? [];
73+
}
74+
5775
public function getSubject(): Content
5876
{
5977
return $this->subject;
@@ -69,6 +87,14 @@ public function requestBody(): array
6987
$payload['Subject'] = $v->requestBody();
7088
$v = $this->body;
7189
$payload['Body'] = $v->requestBody();
90+
if (null !== $v = $this->headers) {
91+
$index = -1;
92+
$payload['Headers'] = [];
93+
foreach ($v as $listValue) {
94+
++$index;
95+
$payload['Headers'][$index] = $listValue->requestBody();
96+
}
97+
}
7298

7399
return $payload;
74100
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
namespace AsyncAws\Ses\ValueObject;
4+
5+
use AsyncAws\Core\Exception\InvalidArgument;
6+
7+
/**
8+
* Contains the name and value of a message header that you add to an email.
9+
*/
10+
final class MessageHeader
11+
{
12+
/**
13+
* The name of the message header. The message header name has to meet the following criteria:.
14+
*
15+
* - Can contain any printable ASCII character (33 - 126) except for colon (:).
16+
* - Can contain no more than 126 characters.
17+
*
18+
* @var string
19+
*/
20+
private $name;
21+
22+
/**
23+
* The value of the message header. The message header value has to meet the following criteria:.
24+
*
25+
* - Can contain any printable ASCII character.
26+
* - Can contain no more than 870 characters.
27+
*
28+
* @var string
29+
*/
30+
private $value;
31+
32+
/**
33+
* @param array{
34+
* Name: string,
35+
* Value: string,
36+
* } $input
37+
*/
38+
public function __construct(array $input)
39+
{
40+
$this->name = $input['Name'] ?? $this->throwException(new InvalidArgument('Missing required field "Name".'));
41+
$this->value = $input['Value'] ?? $this->throwException(new InvalidArgument('Missing required field "Value".'));
42+
}
43+
44+
/**
45+
* @param array{
46+
* Name: string,
47+
* Value: string,
48+
* }|MessageHeader $input
49+
*/
50+
public static function create($input): self
51+
{
52+
return $input instanceof self ? $input : new self($input);
53+
}
54+
55+
public function getName(): string
56+
{
57+
return $this->name;
58+
}
59+
60+
public function getValue(): string
61+
{
62+
return $this->value;
63+
}
64+
65+
/**
66+
* @internal
67+
*/
68+
public function requestBody(): array
69+
{
70+
$payload = [];
71+
$v = $this->name;
72+
$payload['Name'] = $v;
73+
$v = $this->value;
74+
$payload['Value'] = $v;
75+
76+
return $payload;
77+
}
78+
79+
/**
80+
* @return never
81+
*/
82+
private function throwException(\Throwable $exception)
83+
{
84+
throw $exception;
85+
}
86+
}

src/Service/Ses/src/ValueObject/Template.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,50 @@ final class Template
3333
*/
3434
private $templateData;
3535

36+
/**
37+
* The list of message headers that will be added to the email message.
38+
*
39+
* @var MessageHeader[]|null
40+
*/
41+
private $headers;
42+
3643
/**
3744
* @param array{
3845
* TemplateName?: null|string,
3946
* TemplateArn?: null|string,
4047
* TemplateData?: null|string,
48+
* Headers?: null|array<MessageHeader|array>,
4149
* } $input
4250
*/
4351
public function __construct(array $input)
4452
{
4553
$this->templateName = $input['TemplateName'] ?? null;
4654
$this->templateArn = $input['TemplateArn'] ?? null;
4755
$this->templateData = $input['TemplateData'] ?? null;
56+
$this->headers = isset($input['Headers']) ? array_map([MessageHeader::class, 'create'], $input['Headers']) : null;
4857
}
4958

5059
/**
5160
* @param array{
5261
* TemplateName?: null|string,
5362
* TemplateArn?: null|string,
5463
* TemplateData?: null|string,
64+
* Headers?: null|array<MessageHeader|array>,
5565
* }|Template $input
5666
*/
5767
public static function create($input): self
5868
{
5969
return $input instanceof self ? $input : new self($input);
6070
}
6171

72+
/**
73+
* @return MessageHeader[]
74+
*/
75+
public function getHeaders(): array
76+
{
77+
return $this->headers ?? [];
78+
}
79+
6280
public function getTemplateArn(): ?string
6381
{
6482
return $this->templateArn;
@@ -89,6 +107,14 @@ public function requestBody(): array
89107
if (null !== $v = $this->templateData) {
90108
$payload['TemplateData'] = $v;
91109
}
110+
if (null !== $v = $this->headers) {
111+
$index = -1;
112+
$payload['Headers'] = [];
113+
foreach ($v as $listValue) {
114+
++$index;
115+
$payload['Headers'][$index] = $listValue->requestBody();
116+
}
117+
}
92118

93119
return $payload;
94120
}

0 commit comments

Comments
 (0)