Skip to content

Commit bf53e35

Browse files
Update generated code (#1599)
update generated code
1 parent da7ebb7 commit bf53e35

File tree

6 files changed

+71
-11
lines changed

6 files changed

+71
-11
lines changed

manifest.json

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

src/Service/Translate/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: Added support for Brevity translation settings feature.
8+
59
### Changed
610

711
- Allow passing explicit null values for optional fields of input objects
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace AsyncAws\Translate\Enum;
4+
5+
final class Brevity
6+
{
7+
public const ON = 'ON';
8+
9+
public static function exists(string $value): bool
10+
{
11+
return isset([
12+
self::ON => true,
13+
][$value]);
14+
}
15+
}

src/Service/Translate/src/Input/TranslateTextRequest.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
use AsyncAws\Core\Input;
77
use AsyncAws\Core\Request;
88
use AsyncAws\Core\Stream\StreamFactory;
9+
use AsyncAws\Translate\Enum\Brevity;
910
use AsyncAws\Translate\Enum\Formality;
11+
use AsyncAws\Translate\Enum\Profanity;
1012
use AsyncAws\Translate\ValueObject\TranslationSettings;
1113

1214
final class TranslateTextRequest extends Input
@@ -68,8 +70,11 @@ final class TranslateTextRequest extends Input
6870
private $targetLanguageCode;
6971

7072
/**
71-
* Settings to configure your translation output, including the option to set the formality level of the output text and
72-
* the option to mask profane words and phrases.
73+
* Settings to configure your translation output. You can configure the following options:.
74+
*
75+
* - Brevity: reduces the length of the translated output for most translations.
76+
* - Formality: sets the formality level of the output text.
77+
* - Profanity: masks profane words and phrases in your translation output.
7378
*
7479
* @var TranslationSettings|null
7580
*/

src/Service/Translate/src/Result/TranslateTextResponse.php

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ private function populateResultTranslationSettings(array $json): TranslationSett
141141
return new TranslationSettings([
142142
'Formality' => isset($json['Formality']) ? (string) $json['Formality'] : null,
143143
'Profanity' => isset($json['Profanity']) ? (string) $json['Profanity'] : null,
144+
'Brevity' => isset($json['Brevity']) ? (string) $json['Brevity'] : null,
144145
]);
145146
}
146147
}

src/Service/Translate/src/ValueObject/TranslationSettings.php

+43-8
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33
namespace AsyncAws\Translate\ValueObject;
44

55
use AsyncAws\Core\Exception\InvalidArgument;
6+
use AsyncAws\Translate\Enum\Brevity;
67
use AsyncAws\Translate\Enum\Formality;
78
use AsyncAws\Translate\Enum\Profanity;
89

910
/**
10-
* Settings to configure your translation output, including the option to set the formality level of the output text and
11-
* the option to mask profane words and phrases.
11+
* Settings to configure your translation output. You can configure the following options:.
12+
*
13+
* - Brevity: reduces the length of the translation output for most translations. Available for `TranslateText` only.
14+
* - Formality: sets the formality level of the translation output.
15+
* - Profanity: masks profane words and phrases in the translation output.
1216
*/
1317
final class TranslationSettings
1418
{
1519
/**
16-
* You can optionally specify the desired level of formality for translations to supported target languages. The
17-
* formality setting controls the level of formal language usage (also known as register [^1]) in the translation
18-
* output. You can set the value to informal or formal. If you don't specify a value for formality, or if the target
19-
* language doesn't support formality, the translation will ignore the formality setting.
20+
* You can specify the desired level of formality for translations to supported target languages. The formality setting
21+
* controls the level of formal language usage (also known as register [^1]) in the translation output. You can set the
22+
* value to informal or formal. If you don't specify a value for formality, or if the target language doesn't support
23+
* formality, the translation will ignore the formality setting.
2024
*
2125
* If you specify multiple target languages for the job, translate ignores the formality setting for any unsupported
2226
* target language.
@@ -32,8 +36,7 @@ final class TranslationSettings
3236
private $formality;
3337

3438
/**
35-
* Enable the profanity setting if you want Amazon Translate to mask profane words and phrases in your translation
36-
* output.
39+
* You can enable the profanity setting if you want to mask profane words and phrases in your translation output.
3740
*
3841
* To mask profane words and phrases, Amazon Translate replaces them with the grawlix string “?$#@$“. This
3942
* 5-character sequence is used for each profane word or phrase, regardless of the length or number of words.
@@ -51,29 +54,55 @@ final class TranslationSettings
5154
*/
5255
private $profanity;
5356

57+
/**
58+
* When you turn on brevity, Amazon Translate reduces the length of the translation output for most translations (when
59+
* compared with the same translation with brevity turned off). By default, brevity is turned off.
60+
*
61+
* If you turn on brevity for a translation request with an unsupported language pair, the translation proceeds with the
62+
* brevity setting turned off.
63+
*
64+
* For the language pairs that brevity supports, see Using brevity [^1] in the Amazon Translate Developer Guide.
65+
*
66+
* [^1]: https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-brevity
67+
*
68+
* @var Brevity::*|null
69+
*/
70+
private $brevity;
71+
5472
/**
5573
* @param array{
5674
* Formality?: null|Formality::*,
5775
* Profanity?: null|Profanity::*,
76+
* Brevity?: null|Brevity::*,
5877
* } $input
5978
*/
6079
public function __construct(array $input)
6180
{
6281
$this->formality = $input['Formality'] ?? null;
6382
$this->profanity = $input['Profanity'] ?? null;
83+
$this->brevity = $input['Brevity'] ?? null;
6484
}
6585

6686
/**
6787
* @param array{
6888
* Formality?: null|Formality::*,
6989
* Profanity?: null|Profanity::*,
90+
* Brevity?: null|Brevity::*,
7091
* }|TranslationSettings $input
7192
*/
7293
public static function create($input): self
7394
{
7495
return $input instanceof self ? $input : new self($input);
7596
}
7697

98+
/**
99+
* @return Brevity::*|null
100+
*/
101+
public function getBrevity(): ?string
102+
{
103+
return $this->brevity;
104+
}
105+
77106
/**
78107
* @return Formality::*|null
79108
*/
@@ -108,6 +137,12 @@ public function requestBody(): array
108137
}
109138
$payload['Profanity'] = $v;
110139
}
140+
if (null !== $v = $this->brevity) {
141+
if (!Brevity::exists($v)) {
142+
throw new InvalidArgument(sprintf('Invalid parameter "Brevity" for "%s". The value "%s" is not a valid "Brevity".', __CLASS__, $v));
143+
}
144+
$payload['Brevity'] = $v;
145+
}
111146

112147
return $payload;
113148
}

0 commit comments

Comments
 (0)