diff --git a/Translate/metadata/V3/AdaptiveMt.php b/Translate/metadata/V3/AdaptiveMt.php
new file mode 100644
index 000000000000..a8e590af5ef9
Binary files /dev/null and b/Translate/metadata/V3/AdaptiveMt.php differ
diff --git a/Translate/metadata/V3/Common.php b/Translate/metadata/V3/Common.php
new file mode 100644
index 000000000000..a72b2b1e412f
--- /dev/null
+++ b/Translate/metadata/V3/Common.php
@@ -0,0 +1,36 @@
+internalAddGeneratedFile(
+ '
+Ó
+&google/cloud/translate/v3/common.protogoogle.cloud.translation.v3"(
+GcsInputSource
+ input_uri ( BàA"Z
+FileInputSource
+ mime_type ( BàA
+content (BàA
+display_name ( BàA"6
+GcsOutputDestination
+output_uri_prefix ( BàABÅ
+com.google.cloud.translate.v3BCommonProtoPZ;cloud.google.com/go/translate/apiv3/translatepb;translatepbøªGoogle.Cloud.Translate.V3ÊGoogle\\Cloud\\Translate\\V3êGoogle::Cloud::Translate::V3bproto3'
+ , true);
+
+ static::$is_initialized = true;
+ }
+}
+
diff --git a/Translate/metadata/V3/TranslationService.php b/Translate/metadata/V3/TranslationService.php
index d3b4a306a7d8..5dd3322fdc26 100644
Binary files a/Translate/metadata/V3/TranslationService.php and b/Translate/metadata/V3/TranslationService.php differ
diff --git a/Translate/samples/V3/TranslationServiceClient/adaptive_mt_translate.php b/Translate/samples/V3/TranslationServiceClient/adaptive_mt_translate.php
new file mode 100644
index 000000000000..3197e839e5d1
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/adaptive_mt_translate.php
@@ -0,0 +1,89 @@
+adaptiveMtTranslate(
+ $formattedParent,
+ $formattedDataset,
+ $content
+ );
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]');
+ $formattedDataset = TranslationServiceClient::adaptiveMtDatasetName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]'
+ );
+ $contentElement = '[CONTENT]';
+
+ adaptive_mt_translate_sample($formattedParent, $formattedDataset, $contentElement);
+}
+// [END translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/create_adaptive_mt_dataset.php b/Translate/samples/V3/TranslationServiceClient/create_adaptive_mt_dataset.php
new file mode 100644
index 000000000000..65a4e7538b3c
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/create_adaptive_mt_dataset.php
@@ -0,0 +1,84 @@
+setName($formattedAdaptiveMtDatasetName);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var AdaptiveMtDataset $response */
+ $response = $translationServiceClient->createAdaptiveMtDataset(
+ $formattedParent,
+ $adaptiveMtDataset
+ );
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]');
+ $formattedAdaptiveMtDatasetName = TranslationServiceClient::adaptiveMtDatasetName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]'
+ );
+
+ create_adaptive_mt_dataset_sample($formattedParent, $formattedAdaptiveMtDatasetName);
+}
+// [END translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/delete_adaptive_mt_dataset.php b/Translate/samples/V3/TranslationServiceClient/delete_adaptive_mt_dataset.php
new file mode 100644
index 000000000000..c00aeead2890
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/delete_adaptive_mt_dataset.php
@@ -0,0 +1,70 @@
+deleteAdaptiveMtDataset($formattedName);
+ printf('Call completed successfully.' . PHP_EOL);
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedName = TranslationServiceClient::adaptiveMtDatasetName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]'
+ );
+
+ delete_adaptive_mt_dataset_sample($formattedName);
+}
+// [END translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/delete_adaptive_mt_file.php b/Translate/samples/V3/TranslationServiceClient/delete_adaptive_mt_file.php
new file mode 100644
index 000000000000..91b542353cac
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/delete_adaptive_mt_file.php
@@ -0,0 +1,70 @@
+deleteAdaptiveMtFile($formattedName);
+ printf('Call completed successfully.' . PHP_EOL);
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedName = TranslationServiceClient::adaptiveMtFileName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]',
+ '[FILE]'
+ );
+
+ delete_adaptive_mt_file_sample($formattedName);
+}
+// [END translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/get_adaptive_mt_dataset.php b/Translate/samples/V3/TranslationServiceClient/get_adaptive_mt_dataset.php
new file mode 100644
index 000000000000..a8deb259109d
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/get_adaptive_mt_dataset.php
@@ -0,0 +1,71 @@
+getAdaptiveMtDataset($formattedName);
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedName = TranslationServiceClient::adaptiveMtDatasetName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]'
+ );
+
+ get_adaptive_mt_dataset_sample($formattedName);
+}
+// [END translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/get_adaptive_mt_file.php b/Translate/samples/V3/TranslationServiceClient/get_adaptive_mt_file.php
new file mode 100644
index 000000000000..8c377db01d52
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/get_adaptive_mt_file.php
@@ -0,0 +1,72 @@
+getAdaptiveMtFile($formattedName);
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedName = TranslationServiceClient::adaptiveMtFileName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]',
+ '[FILE]'
+ );
+
+ get_adaptive_mt_file_sample($formattedName);
+}
+// [END translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/import_adaptive_mt_file.php b/Translate/samples/V3/TranslationServiceClient/import_adaptive_mt_file.php
new file mode 100644
index 000000000000..bec3691d54ef
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/import_adaptive_mt_file.php
@@ -0,0 +1,72 @@
+importAdaptiveMtFile($formattedParent);
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedParent = TranslationServiceClient::adaptiveMtDatasetName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]'
+ );
+
+ import_adaptive_mt_file_sample($formattedParent);
+}
+// [END translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_datasets.php b/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_datasets.php
new file mode 100644
index 000000000000..db9c097b4534
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_datasets.php
@@ -0,0 +1,72 @@
+listAdaptiveMtDatasets($formattedParent);
+
+ /** @var AdaptiveMtDataset $element */
+ foreach ($response as $element) {
+ printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
+ }
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]');
+
+ list_adaptive_mt_datasets_sample($formattedParent);
+}
+// [END translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_files.php b/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_files.php
new file mode 100644
index 000000000000..2da0498ede7a
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_files.php
@@ -0,0 +1,77 @@
+listAdaptiveMtFiles($formattedParent);
+
+ /** @var AdaptiveMtFile $element */
+ foreach ($response as $element) {
+ printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
+ }
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedParent = TranslationServiceClient::adaptiveMtDatasetName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]'
+ );
+
+ list_adaptive_mt_files_sample($formattedParent);
+}
+// [END translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync]
diff --git a/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_sentences.php b/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_sentences.php
new file mode 100644
index 000000000000..61755ea33562
--- /dev/null
+++ b/Translate/samples/V3/TranslationServiceClient/list_adaptive_mt_sentences.php
@@ -0,0 +1,80 @@
+listAdaptiveMtSentences($formattedParent);
+
+ /** @var AdaptiveMtSentence $element */
+ foreach ($response as $element) {
+ printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
+ }
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $formattedParent = TranslationServiceClient::adaptiveMtFileName(
+ '[PROJECT]',
+ '[LOCATION]',
+ '[DATASET]',
+ '[FILE]'
+ );
+
+ list_adaptive_mt_sentences_sample($formattedParent);
+}
+// [END translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync]
diff --git a/Translate/src/V3/AdaptiveMtDataset.php b/Translate/src/V3/AdaptiveMtDataset.php
new file mode 100644
index 000000000000..6e032801a948
--- /dev/null
+++ b/Translate/src/V3/AdaptiveMtDataset.php
@@ -0,0 +1,303 @@
+google.cloud.translation.v3.AdaptiveMtDataset
+ */
+class AdaptiveMtDataset extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the dataset, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+ /**
+ * The name of the dataset to show in the interface. The name can be
+ * up to 32 characters long and can consist only of ASCII Latin letters A-Z
+ * and a-z, underscores (_), and ASCII digits 0-9.
+ *
+ * Generated from protobuf field string display_name = 2;
+ */
+ private $display_name = '';
+ /**
+ * The BCP-47 language code of the source language.
+ *
+ * Generated from protobuf field string source_language_code = 3;
+ */
+ private $source_language_code = '';
+ /**
+ * The BCP-47 language code of the target language.
+ *
+ * Generated from protobuf field string target_language_code = 4;
+ */
+ private $target_language_code = '';
+ /**
+ * The number of examples in the dataset.
+ *
+ * Generated from protobuf field int32 example_count = 5;
+ */
+ private $example_count = 0;
+ /**
+ * Output only. Timestamp when this dataset was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $create_time = null;
+ /**
+ * Output only. Timestamp when this dataset was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $update_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The resource name of the dataset, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}`
+ * @type string $display_name
+ * The name of the dataset to show in the interface. The name can be
+ * up to 32 characters long and can consist only of ASCII Latin letters A-Z
+ * and a-z, underscores (_), and ASCII digits 0-9.
+ * @type string $source_language_code
+ * The BCP-47 language code of the source language.
+ * @type string $target_language_code
+ * The BCP-47 language code of the target language.
+ * @type int $example_count
+ * The number of examples in the dataset.
+ * @type \Google\Protobuf\Timestamp $create_time
+ * Output only. Timestamp when this dataset was created.
+ * @type \Google\Protobuf\Timestamp $update_time
+ * Output only. Timestamp when this dataset was last updated.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the dataset, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The resource name of the dataset, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * The name of the dataset to show in the interface. The name can be
+ * up to 32 characters long and can consist only of ASCII Latin letters A-Z
+ * and a-z, underscores (_), and ASCII digits 0-9.
+ *
+ * Generated from protobuf field string display_name = 2;
+ * @return string
+ */
+ public function getDisplayName()
+ {
+ return $this->display_name;
+ }
+
+ /**
+ * The name of the dataset to show in the interface. The name can be
+ * up to 32 characters long and can consist only of ASCII Latin letters A-Z
+ * and a-z, underscores (_), and ASCII digits 0-9.
+ *
+ * Generated from protobuf field string display_name = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setDisplayName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->display_name = $var;
+
+ return $this;
+ }
+
+ /**
+ * The BCP-47 language code of the source language.
+ *
+ * Generated from protobuf field string source_language_code = 3;
+ * @return string
+ */
+ public function getSourceLanguageCode()
+ {
+ return $this->source_language_code;
+ }
+
+ /**
+ * The BCP-47 language code of the source language.
+ *
+ * Generated from protobuf field string source_language_code = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setSourceLanguageCode($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->source_language_code = $var;
+
+ return $this;
+ }
+
+ /**
+ * The BCP-47 language code of the target language.
+ *
+ * Generated from protobuf field string target_language_code = 4;
+ * @return string
+ */
+ public function getTargetLanguageCode()
+ {
+ return $this->target_language_code;
+ }
+
+ /**
+ * The BCP-47 language code of the target language.
+ *
+ * Generated from protobuf field string target_language_code = 4;
+ * @param string $var
+ * @return $this
+ */
+ public function setTargetLanguageCode($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->target_language_code = $var;
+
+ return $this;
+ }
+
+ /**
+ * The number of examples in the dataset.
+ *
+ * Generated from protobuf field int32 example_count = 5;
+ * @return int
+ */
+ public function getExampleCount()
+ {
+ return $this->example_count;
+ }
+
+ /**
+ * The number of examples in the dataset.
+ *
+ * Generated from protobuf field int32 example_count = 5;
+ * @param int $var
+ * @return $this
+ */
+ public function setExampleCount($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->example_count = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when this dataset was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getCreateTime()
+ {
+ return $this->create_time;
+ }
+
+ public function hasCreateTime()
+ {
+ return isset($this->create_time);
+ }
+
+ public function clearCreateTime()
+ {
+ unset($this->create_time);
+ }
+
+ /**
+ * Output only. Timestamp when this dataset was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setCreateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->create_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when this dataset was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getUpdateTime()
+ {
+ return $this->update_time;
+ }
+
+ public function hasUpdateTime()
+ {
+ return isset($this->update_time);
+ }
+
+ public function clearUpdateTime()
+ {
+ unset($this->update_time);
+ }
+
+ /**
+ * Output only. Timestamp when this dataset was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setUpdateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->update_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/AdaptiveMtFile.php b/Translate/src/V3/AdaptiveMtFile.php
new file mode 100644
index 000000000000..f14f4d6ea4b1
--- /dev/null
+++ b/Translate/src/V3/AdaptiveMtFile.php
@@ -0,0 +1,227 @@
+google.cloud.translation.v3.AdaptiveMtFile
+ */
+class AdaptiveMtFile extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+ /**
+ * The file's display name.
+ *
+ * Generated from protobuf field string display_name = 2;
+ */
+ private $display_name = '';
+ /**
+ * The number of entries that the file contains.
+ *
+ * Generated from protobuf field int32 entry_count = 3;
+ */
+ private $entry_count = 0;
+ /**
+ * Output only. Timestamp when this file was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $create_time = null;
+ /**
+ * Output only. Timestamp when this file was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $update_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * @type string $display_name
+ * The file's display name.
+ * @type int $entry_count
+ * The number of entries that the file contains.
+ * @type \Google\Protobuf\Timestamp $create_time
+ * Output only. Timestamp when this file was created.
+ * @type \Google\Protobuf\Timestamp $update_time
+ * Output only. Timestamp when this file was last updated.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * The file's display name.
+ *
+ * Generated from protobuf field string display_name = 2;
+ * @return string
+ */
+ public function getDisplayName()
+ {
+ return $this->display_name;
+ }
+
+ /**
+ * The file's display name.
+ *
+ * Generated from protobuf field string display_name = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setDisplayName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->display_name = $var;
+
+ return $this;
+ }
+
+ /**
+ * The number of entries that the file contains.
+ *
+ * Generated from protobuf field int32 entry_count = 3;
+ * @return int
+ */
+ public function getEntryCount()
+ {
+ return $this->entry_count;
+ }
+
+ /**
+ * The number of entries that the file contains.
+ *
+ * Generated from protobuf field int32 entry_count = 3;
+ * @param int $var
+ * @return $this
+ */
+ public function setEntryCount($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->entry_count = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when this file was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getCreateTime()
+ {
+ return $this->create_time;
+ }
+
+ public function hasCreateTime()
+ {
+ return isset($this->create_time);
+ }
+
+ public function clearCreateTime()
+ {
+ unset($this->create_time);
+ }
+
+ /**
+ * Output only. Timestamp when this file was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setCreateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->create_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when this file was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getUpdateTime()
+ {
+ return $this->update_time;
+ }
+
+ public function hasUpdateTime()
+ {
+ return isset($this->update_time);
+ }
+
+ public function clearUpdateTime()
+ {
+ unset($this->update_time);
+ }
+
+ /**
+ * Output only. Timestamp when this file was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setUpdateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->update_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/AdaptiveMtSentence.php b/Translate/src/V3/AdaptiveMtSentence.php
new file mode 100644
index 000000000000..d64dc87880f7
--- /dev/null
+++ b/Translate/src/V3/AdaptiveMtSentence.php
@@ -0,0 +1,227 @@
+google.cloud.translation.v3.AdaptiveMtSentence
+ */
+class AdaptiveMtSentence extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+ /**
+ * Required. The source sentence.
+ *
+ * Generated from protobuf field string source_sentence = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $source_sentence = '';
+ /**
+ * Required. The target sentence.
+ *
+ * Generated from protobuf field string target_sentence = 3 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $target_sentence = '';
+ /**
+ * Output only. Timestamp when this sentence was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $create_time = null;
+ /**
+ * Output only. Timestamp when this sentence was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $update_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}`
+ * @type string $source_sentence
+ * Required. The source sentence.
+ * @type string $target_sentence
+ * Required. The target sentence.
+ * @type \Google\Protobuf\Timestamp $create_time
+ * Output only. Timestamp when this sentence was created.
+ * @type \Google\Protobuf\Timestamp $update_time
+ * Output only. Timestamp when this sentence was last updated.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The source sentence.
+ *
+ * Generated from protobuf field string source_sentence = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getSourceSentence()
+ {
+ return $this->source_sentence;
+ }
+
+ /**
+ * Required. The source sentence.
+ *
+ * Generated from protobuf field string source_sentence = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setSourceSentence($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->source_sentence = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The target sentence.
+ *
+ * Generated from protobuf field string target_sentence = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getTargetSentence()
+ {
+ return $this->target_sentence;
+ }
+
+ /**
+ * Required. The target sentence.
+ *
+ * Generated from protobuf field string target_sentence = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setTargetSentence($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->target_sentence = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when this sentence was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getCreateTime()
+ {
+ return $this->create_time;
+ }
+
+ public function hasCreateTime()
+ {
+ return isset($this->create_time);
+ }
+
+ public function clearCreateTime()
+ {
+ unset($this->create_time);
+ }
+
+ /**
+ * Output only. Timestamp when this sentence was created.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setCreateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->create_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when this sentence was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getUpdateTime()
+ {
+ return $this->update_time;
+ }
+
+ public function hasUpdateTime()
+ {
+ return isset($this->update_time);
+ }
+
+ public function clearUpdateTime()
+ {
+ unset($this->update_time);
+ }
+
+ /**
+ * Output only. Timestamp when this sentence was last updated.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setUpdateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->update_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/AdaptiveMtTranslateRequest.php b/Translate/src/V3/AdaptiveMtTranslateRequest.php
new file mode 100644
index 000000000000..6041d7216c65
--- /dev/null
+++ b/Translate/src/V3/AdaptiveMtTranslateRequest.php
@@ -0,0 +1,166 @@
+google.cloud.translation.v3.AdaptiveMtTranslateRequest
+ */
+class AdaptiveMtTranslateRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Location to make a regional call.
+ * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ /**
+ * Required. The resource name for the dataset to use for adaptive MT.
+ * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string dataset = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $dataset = '';
+ /**
+ * Required. The content of the input in string format.
+ * For now only one sentence per request is supported.
+ *
+ * Generated from protobuf field repeated string content = 3 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $content;
+
+ /**
+ * @param string $parent Required. Location to make a regional call.
+ *
+ * Format: `projects/{project-number-or-id}/locations/{location-id}`. Please see
+ * {@see TranslationServiceClient::locationName()} for help formatting this field.
+ * @param string[] $content Required. The content of the input in string format.
+ * For now only one sentence per request is supported.
+ *
+ * @return \Google\Cloud\Translate\V3\AdaptiveMtTranslateRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent, array $content): self
+ {
+ return (new self())
+ ->setParent($parent)
+ ->setContent($content);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. Location to make a regional call.
+ * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+ * @type string $dataset
+ * Required. The resource name for the dataset to use for adaptive MT.
+ * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
+ * @type array|\Google\Protobuf\Internal\RepeatedField $content
+ * Required. The content of the input in string format.
+ * For now only one sentence per request is supported.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Location to make a regional call.
+ * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. Location to make a regional call.
+ * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The resource name for the dataset to use for adaptive MT.
+ * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string dataset = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getDataset()
+ {
+ return $this->dataset;
+ }
+
+ /**
+ * Required. The resource name for the dataset to use for adaptive MT.
+ * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string dataset = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setDataset($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->dataset = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The content of the input in string format.
+ * For now only one sentence per request is supported.
+ *
+ * Generated from protobuf field repeated string content = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getContent()
+ {
+ return $this->content;
+ }
+
+ /**
+ * Required. The content of the input in string format.
+ * For now only one sentence per request is supported.
+ *
+ * Generated from protobuf field repeated string content = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @param array|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setContent($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->content = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/AdaptiveMtTranslateResponse.php b/Translate/src/V3/AdaptiveMtTranslateResponse.php
new file mode 100644
index 000000000000..b8713f594422
--- /dev/null
+++ b/Translate/src/V3/AdaptiveMtTranslateResponse.php
@@ -0,0 +1,101 @@
+google.cloud.translation.v3.AdaptiveMtTranslateResponse
+ */
+class AdaptiveMtTranslateResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Output only. The translation.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtTranslation translations = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $translations;
+ /**
+ * Output only. The translation's language code.
+ *
+ * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $language_code = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array<\Google\Cloud\Translate\V3\AdaptiveMtTranslation>|\Google\Protobuf\Internal\RepeatedField $translations
+ * Output only. The translation.
+ * @type string $language_code
+ * Output only. The translation's language code.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Output only. The translation.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtTranslation translations = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getTranslations()
+ {
+ return $this->translations;
+ }
+
+ /**
+ * Output only. The translation.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtTranslation translations = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param array<\Google\Cloud\Translate\V3\AdaptiveMtTranslation>|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setTranslations($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtTranslation::class);
+ $this->translations = $arr;
+
+ return $this;
+ }
+
+ /**
+ * Output only. The translation's language code.
+ *
+ * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return string
+ */
+ public function getLanguageCode()
+ {
+ return $this->language_code;
+ }
+
+ /**
+ * Output only. The translation's language code.
+ *
+ * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param string $var
+ * @return $this
+ */
+ public function setLanguageCode($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->language_code = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/AdaptiveMtTranslation.php b/Translate/src/V3/AdaptiveMtTranslation.php
new file mode 100644
index 000000000000..c408c94b5c99
--- /dev/null
+++ b/Translate/src/V3/AdaptiveMtTranslation.php
@@ -0,0 +1,67 @@
+google.cloud.translation.v3.AdaptiveMtTranslation
+ */
+class AdaptiveMtTranslation extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Output only. The translated text.
+ *
+ * Generated from protobuf field string translated_text = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $translated_text = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $translated_text
+ * Output only. The translated text.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Output only. The translated text.
+ *
+ * Generated from protobuf field string translated_text = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return string
+ */
+ public function getTranslatedText()
+ {
+ return $this->translated_text;
+ }
+
+ /**
+ * Output only. The translated text.
+ *
+ * Generated from protobuf field string translated_text = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param string $var
+ * @return $this
+ */
+ public function setTranslatedText($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->translated_text = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/BatchTranslateDocumentRequest.php b/Translate/src/V3/BatchTranslateDocumentRequest.php
index 348662b7f4fa..b28972333c08 100644
--- a/Translate/src/V3/BatchTranslateDocumentRequest.php
+++ b/Translate/src/V3/BatchTranslateDocumentRequest.php
@@ -80,9 +80,9 @@ class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message
*/
private $glossaries;
/**
- * Optional. File format conversion map to be applied to all input files.
- * Map's key is the original mime_type. Map's value is the target mime_type of
- * translated documents.
+ * Optional. The file format conversion map that is applied to all input
+ * files. The map key is the original mime_type. The map value is the target
+ * mime_type of translated documents.
* Supported file format conversion includes:
* - `application/pdf` to
* `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
@@ -198,9 +198,9 @@ public static function build(string $parent, string $sourceLanguageCode, array $
* @type array|\Google\Protobuf\Internal\MapField $glossaries
* Optional. Glossaries to be applied. It's keyed by target language code.
* @type array|\Google\Protobuf\Internal\MapField $format_conversions
- * Optional. File format conversion map to be applied to all input files.
- * Map's key is the original mime_type. Map's value is the target mime_type of
- * translated documents.
+ * Optional. The file format conversion map that is applied to all input
+ * files. The map key is the original mime_type. The map value is the target
+ * mime_type of translated documents.
* Supported file format conversion includes:
* - `application/pdf` to
* `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
@@ -462,9 +462,9 @@ public function setGlossaries($var)
}
/**
- * Optional. File format conversion map to be applied to all input files.
- * Map's key is the original mime_type. Map's value is the target mime_type of
- * translated documents.
+ * Optional. The file format conversion map that is applied to all input
+ * files. The map key is the original mime_type. The map value is the target
+ * mime_type of translated documents.
* Supported file format conversion includes:
* - `application/pdf` to
* `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
@@ -480,9 +480,9 @@ public function getFormatConversions()
}
/**
- * Optional. File format conversion map to be applied to all input files.
- * Map's key is the original mime_type. Map's value is the target mime_type of
- * translated documents.
+ * Optional. The file format conversion map that is applied to all input
+ * files. The map key is the original mime_type. The map value is the target
+ * mime_type of translated documents.
* Supported file format conversion includes:
* - `application/pdf` to
* `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
diff --git a/Translate/src/V3/Client/TranslationServiceClient.php b/Translate/src/V3/Client/TranslationServiceClient.php
index 9e90e5e115b2..314479b8f483 100644
--- a/Translate/src/V3/Client/TranslationServiceClient.php
+++ b/Translate/src/V3/Client/TranslationServiceClient.php
@@ -35,15 +35,29 @@
use Google\ApiCore\Transport\TransportInterface;
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
+use Google\Cloud\Translate\V3\AdaptiveMtDataset;
+use Google\Cloud\Translate\V3\AdaptiveMtFile;
+use Google\Cloud\Translate\V3\AdaptiveMtTranslateRequest;
+use Google\Cloud\Translate\V3\AdaptiveMtTranslateResponse;
use Google\Cloud\Translate\V3\BatchTranslateDocumentRequest;
use Google\Cloud\Translate\V3\BatchTranslateTextRequest;
+use Google\Cloud\Translate\V3\CreateAdaptiveMtDatasetRequest;
use Google\Cloud\Translate\V3\CreateGlossaryRequest;
+use Google\Cloud\Translate\V3\DeleteAdaptiveMtDatasetRequest;
+use Google\Cloud\Translate\V3\DeleteAdaptiveMtFileRequest;
use Google\Cloud\Translate\V3\DeleteGlossaryRequest;
use Google\Cloud\Translate\V3\DetectLanguageRequest;
use Google\Cloud\Translate\V3\DetectLanguageResponse;
+use Google\Cloud\Translate\V3\GetAdaptiveMtDatasetRequest;
+use Google\Cloud\Translate\V3\GetAdaptiveMtFileRequest;
use Google\Cloud\Translate\V3\GetGlossaryRequest;
use Google\Cloud\Translate\V3\GetSupportedLanguagesRequest;
use Google\Cloud\Translate\V3\Glossary;
+use Google\Cloud\Translate\V3\ImportAdaptiveMtFileRequest;
+use Google\Cloud\Translate\V3\ImportAdaptiveMtFileResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtFilesRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtSentencesRequest;
use Google\Cloud\Translate\V3\ListGlossariesRequest;
use Google\Cloud\Translate\V3\SupportedLanguages;
use Google\Cloud\Translate\V3\TranslateDocumentRequest;
@@ -70,13 +84,23 @@
*
* @experimental
*
+ * @method PromiseInterface adaptiveMtTranslateAsync(AdaptiveMtTranslateRequest $request, array $optionalArgs = [])
* @method PromiseInterface batchTranslateDocumentAsync(BatchTranslateDocumentRequest $request, array $optionalArgs = [])
* @method PromiseInterface batchTranslateTextAsync(BatchTranslateTextRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface createAdaptiveMtDatasetAsync(CreateAdaptiveMtDatasetRequest $request, array $optionalArgs = [])
* @method PromiseInterface createGlossaryAsync(CreateGlossaryRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface deleteAdaptiveMtDatasetAsync(DeleteAdaptiveMtDatasetRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface deleteAdaptiveMtFileAsync(DeleteAdaptiveMtFileRequest $request, array $optionalArgs = [])
* @method PromiseInterface deleteGlossaryAsync(DeleteGlossaryRequest $request, array $optionalArgs = [])
* @method PromiseInterface detectLanguageAsync(DetectLanguageRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface getAdaptiveMtDatasetAsync(GetAdaptiveMtDatasetRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface getAdaptiveMtFileAsync(GetAdaptiveMtFileRequest $request, array $optionalArgs = [])
* @method PromiseInterface getGlossaryAsync(GetGlossaryRequest $request, array $optionalArgs = [])
* @method PromiseInterface getSupportedLanguagesAsync(GetSupportedLanguagesRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface importAdaptiveMtFileAsync(ImportAdaptiveMtFileRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface listAdaptiveMtDatasetsAsync(ListAdaptiveMtDatasetsRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface listAdaptiveMtFilesAsync(ListAdaptiveMtFilesRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface listAdaptiveMtSentencesAsync(ListAdaptiveMtSentencesRequest $request, array $optionalArgs = [])
* @method PromiseInterface listGlossariesAsync(ListGlossariesRequest $request, array $optionalArgs = [])
* @method PromiseInterface translateDocumentAsync(TranslateDocumentRequest $request, array $optionalArgs = [])
* @method PromiseInterface translateTextAsync(TranslateTextRequest $request, array $optionalArgs = [])
@@ -154,6 +178,46 @@ public function resumeOperation($operationName, $methodName = null)
return $operation;
}
+ /**
+ * Formats a string containing the fully-qualified path to represent a
+ * adaptive_mt_dataset resource.
+ *
+ * @param string $project
+ * @param string $location
+ * @param string $dataset
+ *
+ * @return string The formatted adaptive_mt_dataset resource.
+ */
+ public static function adaptiveMtDatasetName(string $project, string $location, string $dataset): string
+ {
+ return self::getPathTemplate('adaptiveMtDataset')->render([
+ 'project' => $project,
+ 'location' => $location,
+ 'dataset' => $dataset,
+ ]);
+ }
+
+ /**
+ * Formats a string containing the fully-qualified path to represent a
+ * adaptive_mt_file resource.
+ *
+ * @param string $project
+ * @param string $location
+ * @param string $dataset
+ * @param string $file
+ *
+ * @return string The formatted adaptive_mt_file resource.
+ */
+ public static function adaptiveMtFileName(string $project, string $location, string $dataset, string $file): string
+ {
+ return self::getPathTemplate('adaptiveMtFile')->render([
+ 'project' => $project,
+ 'location' => $location,
+ 'dataset' => $dataset,
+ 'file' => $file,
+ ]);
+ }
+
/**
* Formats a string containing the fully-qualified path to represent a glossary
* resource.
@@ -194,6 +258,8 @@ public static function locationName(string $project, string $location): string
* Parses a formatted name string and returns an associative array of the components in the name.
* The following name formats are supported:
* Template: Pattern
+ * - adaptiveMtDataset: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}
+ * - adaptiveMtFile: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}
* - glossary: projects/{project}/locations/{location}/glossaries/{glossary}
* - location: projects/{project}/locations/{location}
*
@@ -287,6 +353,31 @@ public function __call($method, $args)
return call_user_func_array([$this, 'startAsyncCall'], $args);
}
+ /**
+ * Translate text using Adaptive MT.
+ *
+ * The async variant is {@see TranslationServiceClient::adaptiveMtTranslateAsync()}
+ * .
+ *
+ * @param AdaptiveMtTranslateRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return AdaptiveMtTranslateResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function adaptiveMtTranslate(AdaptiveMtTranslateRequest $request, array $callOptions = []): AdaptiveMtTranslateResponse
+ {
+ return $this->startApiCall('AdaptiveMtTranslate', $request, $callOptions)->wait();
+ }
+
/**
* Translates a large volume of document in asynchronous batch mode.
* This function provides real-time output as the inputs are being processed.
@@ -349,6 +440,31 @@ public function batchTranslateText(BatchTranslateTextRequest $request, array $ca
return $this->startApiCall('BatchTranslateText', $request, $callOptions)->wait();
}
+ /**
+ * Creates an Adaptive MT dataset.
+ *
+ * The async variant is
+ * {@see TranslationServiceClient::createAdaptiveMtDatasetAsync()} .
+ *
+ * @param CreateAdaptiveMtDatasetRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return AdaptiveMtDataset
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest $request, array $callOptions = []): AdaptiveMtDataset
+ {
+ return $this->startApiCall('CreateAdaptiveMtDataset', $request, $callOptions)->wait();
+ }
+
/**
* Creates a glossary and returns the long-running operation. Returns
* NOT_FOUND, if the project doesn't exist.
@@ -374,6 +490,53 @@ public function createGlossary(CreateGlossaryRequest $request, array $callOption
return $this->startApiCall('CreateGlossary', $request, $callOptions)->wait();
}
+ /**
+ * Deletes an Adaptive MT dataset, including all its entries and associated
+ * metadata.
+ *
+ * The async variant is
+ * {@see TranslationServiceClient::deleteAdaptiveMtDatasetAsync()} .
+ *
+ * @param DeleteAdaptiveMtDatasetRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest $request, array $callOptions = []): void
+ {
+ $this->startApiCall('DeleteAdaptiveMtDataset', $request, $callOptions)->wait();
+ }
+
+ /**
+ * Deletes an AdaptiveMtFile along with its sentences.
+ *
+ * The async variant is
+ * {@see TranslationServiceClient::deleteAdaptiveMtFileAsync()} .
+ *
+ * @param DeleteAdaptiveMtFileRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest $request, array $callOptions = []): void
+ {
+ $this->startApiCall('DeleteAdaptiveMtFile', $request, $callOptions)->wait();
+ }
+
/**
* Deletes a glossary, or cancels glossary construction
* if the glossary isn't created yet.
@@ -424,6 +587,55 @@ public function detectLanguage(DetectLanguageRequest $request, array $callOption
return $this->startApiCall('DetectLanguage', $request, $callOptions)->wait();
}
+ /**
+ * Gets the Adaptive MT dataset.
+ *
+ * The async variant is
+ * {@see TranslationServiceClient::getAdaptiveMtDatasetAsync()} .
+ *
+ * @param GetAdaptiveMtDatasetRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return AdaptiveMtDataset
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest $request, array $callOptions = []): AdaptiveMtDataset
+ {
+ return $this->startApiCall('GetAdaptiveMtDataset', $request, $callOptions)->wait();
+ }
+
+ /**
+ * Gets and AdaptiveMtFile
+ *
+ * The async variant is {@see TranslationServiceClient::getAdaptiveMtFileAsync()} .
+ *
+ * @param GetAdaptiveMtFileRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return AdaptiveMtFile
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function getAdaptiveMtFile(GetAdaptiveMtFileRequest $request, array $callOptions = []): AdaptiveMtFile
+ {
+ return $this->startApiCall('GetAdaptiveMtFile', $request, $callOptions)->wait();
+ }
+
/**
* Gets a glossary. Returns NOT_FOUND, if the glossary doesn't
* exist.
@@ -474,6 +686,107 @@ public function getSupportedLanguages(GetSupportedLanguagesRequest $request, arr
return $this->startApiCall('GetSupportedLanguages', $request, $callOptions)->wait();
}
+ /**
+ * Imports an AdaptiveMtFile and adds all of its sentences into the
+ * AdaptiveMtDataset.
+ *
+ * The async variant is
+ * {@see TranslationServiceClient::importAdaptiveMtFileAsync()} .
+ *
+ * @param ImportAdaptiveMtFileRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return ImportAdaptiveMtFileResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function importAdaptiveMtFile(ImportAdaptiveMtFileRequest $request, array $callOptions = []): ImportAdaptiveMtFileResponse
+ {
+ return $this->startApiCall('ImportAdaptiveMtFile', $request, $callOptions)->wait();
+ }
+
+ /**
+ * Lists all Adaptive MT datasets for which the caller has read permission.
+ *
+ * The async variant is
+ * {@see TranslationServiceClient::listAdaptiveMtDatasetsAsync()} .
+ *
+ * @param ListAdaptiveMtDatasetsRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return PagedListResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function listAdaptiveMtDatasets(ListAdaptiveMtDatasetsRequest $request, array $callOptions = []): PagedListResponse
+ {
+ return $this->startApiCall('ListAdaptiveMtDatasets', $request, $callOptions);
+ }
+
+ /**
+ * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
+ *
+ * The async variant is {@see TranslationServiceClient::listAdaptiveMtFilesAsync()}
+ * .
+ *
+ * @param ListAdaptiveMtFilesRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return PagedListResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function listAdaptiveMtFiles(ListAdaptiveMtFilesRequest $request, array $callOptions = []): PagedListResponse
+ {
+ return $this->startApiCall('ListAdaptiveMtFiles', $request, $callOptions);
+ }
+
+ /**
+ * Lists all AdaptiveMtSentences under a given file/dataset.
+ *
+ * The async variant is
+ * {@see TranslationServiceClient::listAdaptiveMtSentencesAsync()} .
+ *
+ * @param ListAdaptiveMtSentencesRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return PagedListResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function listAdaptiveMtSentences(ListAdaptiveMtSentencesRequest $request, array $callOptions = []): PagedListResponse
+ {
+ return $this->startApiCall('ListAdaptiveMtSentences', $request, $callOptions);
+ }
+
/**
* Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
* exist.
diff --git a/Translate/src/V3/CreateAdaptiveMtDatasetRequest.php b/Translate/src/V3/CreateAdaptiveMtDatasetRequest.php
new file mode 100644
index 000000000000..bcb1996b2488
--- /dev/null
+++ b/Translate/src/V3/CreateAdaptiveMtDatasetRequest.php
@@ -0,0 +1,132 @@
+google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest
+ */
+class CreateAdaptiveMtDatasetRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Name of the parent project. In form of
+ * `projects/{project-number-or-id}/locations/{location-id}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ /**
+ * Required. The AdaptiveMtDataset to be created.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_dataset = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $adaptive_mt_dataset = null;
+
+ /**
+ * @param string $parent Required. Name of the parent project. In form of
+ * `projects/{project-number-or-id}/locations/{location-id}`
+ * Please see {@see TranslationServiceClient::locationName()} for help formatting this field.
+ * @param \Google\Cloud\Translate\V3\AdaptiveMtDataset $adaptiveMtDataset Required. The AdaptiveMtDataset to be created.
+ *
+ * @return \Google\Cloud\Translate\V3\CreateAdaptiveMtDatasetRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent, \Google\Cloud\Translate\V3\AdaptiveMtDataset $adaptiveMtDataset): self
+ {
+ return (new self())
+ ->setParent($parent)
+ ->setAdaptiveMtDataset($adaptiveMtDataset);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. Name of the parent project. In form of
+ * `projects/{project-number-or-id}/locations/{location-id}`
+ * @type \Google\Cloud\Translate\V3\AdaptiveMtDataset $adaptive_mt_dataset
+ * Required. The AdaptiveMtDataset to be created.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Name of the parent project. In form of
+ * `projects/{project-number-or-id}/locations/{location-id}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. Name of the parent project. In form of
+ * `projects/{project-number-or-id}/locations/{location-id}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The AdaptiveMtDataset to be created.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_dataset = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Cloud\Translate\V3\AdaptiveMtDataset|null
+ */
+ public function getAdaptiveMtDataset()
+ {
+ return $this->adaptive_mt_dataset;
+ }
+
+ public function hasAdaptiveMtDataset()
+ {
+ return isset($this->adaptive_mt_dataset);
+ }
+
+ public function clearAdaptiveMtDataset()
+ {
+ unset($this->adaptive_mt_dataset);
+ }
+
+ /**
+ * Required. The AdaptiveMtDataset to be created.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_dataset = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param \Google\Cloud\Translate\V3\AdaptiveMtDataset $var
+ * @return $this
+ */
+ public function setAdaptiveMtDataset($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\AdaptiveMtDataset::class);
+ $this->adaptive_mt_dataset = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/DeleteAdaptiveMtDatasetRequest.php b/Translate/src/V3/DeleteAdaptiveMtDatasetRequest.php
new file mode 100644
index 000000000000..c24cd05f661f
--- /dev/null
+++ b/Translate/src/V3/DeleteAdaptiveMtDatasetRequest.php
@@ -0,0 +1,86 @@
+google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest
+ */
+class DeleteAdaptiveMtDatasetRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+
+ /**
+ * @param string $name Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\DeleteAdaptiveMtDatasetRequest
+ *
+ * @experimental
+ */
+ public static function build(string $name): self
+ {
+ return (new self())
+ ->setName($name);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/DeleteAdaptiveMtFileRequest.php b/Translate/src/V3/DeleteAdaptiveMtFileRequest.php
new file mode 100644
index 000000000000..0bdda553e08f
--- /dev/null
+++ b/Translate/src/V3/DeleteAdaptiveMtFileRequest.php
@@ -0,0 +1,86 @@
+google.cloud.translation.v3.DeleteAdaptiveMtFileRequest
+ */
+class DeleteAdaptiveMtFileRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the file to delete, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+
+ /**
+ * @param string $name Required. The resource name of the file to delete, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * Please see {@see TranslationServiceClient::adaptiveMtFileName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\DeleteAdaptiveMtFileRequest
+ *
+ * @experimental
+ */
+ public static function build(string $name): self
+ {
+ return (new self())
+ ->setName($name);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The resource name of the file to delete, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the file to delete, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The resource name of the file to delete, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/FileInputSource.php b/Translate/src/V3/FileInputSource.php
new file mode 100644
index 000000000000..d1a1d27d744b
--- /dev/null
+++ b/Translate/src/V3/FileInputSource.php
@@ -0,0 +1,135 @@
+google.cloud.translation.v3.FileInputSource
+ */
+class FileInputSource extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The file's mime type.
+ *
+ * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $mime_type = '';
+ /**
+ * Required. The file's byte contents.
+ *
+ * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $content = '';
+ /**
+ * Required. The file's display name.
+ *
+ * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $display_name = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $mime_type
+ * Required. The file's mime type.
+ * @type string $content
+ * Required. The file's byte contents.
+ * @type string $display_name
+ * Required. The file's display name.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The file's mime type.
+ *
+ * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getMimeType()
+ {
+ return $this->mime_type;
+ }
+
+ /**
+ * Required. The file's mime type.
+ *
+ * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setMimeType($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->mime_type = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The file's byte contents.
+ *
+ * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getContent()
+ {
+ return $this->content;
+ }
+
+ /**
+ * Required. The file's byte contents.
+ *
+ * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setContent($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->content = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The file's display name.
+ *
+ * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getDisplayName()
+ {
+ return $this->display_name;
+ }
+
+ /**
+ * Required. The file's display name.
+ *
+ * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setDisplayName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->display_name = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/Gapic/TranslationServiceGapicClient.php b/Translate/src/V3/Gapic/TranslationServiceGapicClient.php
index 9b999b9e7017..877652a1174f 100644
--- a/Translate/src/V3/Gapic/TranslationServiceGapicClient.php
+++ b/Translate/src/V3/Gapic/TranslationServiceGapicClient.php
@@ -35,20 +35,39 @@
use Google\ApiCore\Transport\TransportInterface;
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
+use Google\Cloud\Translate\V3\AdaptiveMtDataset;
+use Google\Cloud\Translate\V3\AdaptiveMtFile;
+use Google\Cloud\Translate\V3\AdaptiveMtTranslateRequest;
+use Google\Cloud\Translate\V3\AdaptiveMtTranslateResponse;
use Google\Cloud\Translate\V3\BatchDocumentInputConfig;
use Google\Cloud\Translate\V3\BatchDocumentOutputConfig;
use Google\Cloud\Translate\V3\BatchTranslateDocumentRequest;
use Google\Cloud\Translate\V3\BatchTranslateTextRequest;
+use Google\Cloud\Translate\V3\CreateAdaptiveMtDatasetRequest;
use Google\Cloud\Translate\V3\CreateGlossaryRequest;
+use Google\Cloud\Translate\V3\DeleteAdaptiveMtDatasetRequest;
+use Google\Cloud\Translate\V3\DeleteAdaptiveMtFileRequest;
use Google\Cloud\Translate\V3\DeleteGlossaryRequest;
use Google\Cloud\Translate\V3\DetectLanguageRequest;
use Google\Cloud\Translate\V3\DetectLanguageResponse;
use Google\Cloud\Translate\V3\DocumentInputConfig;
use Google\Cloud\Translate\V3\DocumentOutputConfig;
+use Google\Cloud\Translate\V3\FileInputSource;
+use Google\Cloud\Translate\V3\GcsInputSource;
+use Google\Cloud\Translate\V3\GetAdaptiveMtDatasetRequest;
+use Google\Cloud\Translate\V3\GetAdaptiveMtFileRequest;
use Google\Cloud\Translate\V3\GetGlossaryRequest;
use Google\Cloud\Translate\V3\GetSupportedLanguagesRequest;
use Google\Cloud\Translate\V3\Glossary;
+use Google\Cloud\Translate\V3\ImportAdaptiveMtFileRequest;
+use Google\Cloud\Translate\V3\ImportAdaptiveMtFileResponse;
use Google\Cloud\Translate\V3\InputConfig;
+use Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtFilesRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtFilesResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtSentencesRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtSentencesResponse;
use Google\Cloud\Translate\V3\ListGlossariesRequest;
use Google\Cloud\Translate\V3\ListGlossariesResponse;
use Google\Cloud\Translate\V3\OutputConfig;
@@ -59,6 +78,7 @@
use Google\Cloud\Translate\V3\TranslateTextRequest;
use Google\Cloud\Translate\V3\TranslateTextResponse;
use Google\LongRunning\Operation;
+use Google\Protobuf\GPBEmpty;
/**
* Service Description: Provides natural language translation operations.
@@ -70,36 +90,9 @@
* $translationServiceClient = new TranslationServiceClient();
* try {
* $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]');
- * $sourceLanguageCode = 'source_language_code';
- * $targetLanguageCodes = [];
- * $inputConfigs = [];
- * $outputConfig = new BatchDocumentOutputConfig();
- * $operationResponse = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateDocument');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
+ * $formattedDataset = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ * $content = [];
+ * $response = $translationServiceClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content);
* } finally {
* $translationServiceClient->close();
* }
@@ -136,6 +129,10 @@ class TranslationServiceGapicClient
'https://www.googleapis.com/auth/cloud-translation',
];
+ private static $adaptiveMtDatasetNameTemplate;
+
+ private static $adaptiveMtFileNameTemplate;
+
private static $glossaryNameTemplate;
private static $locationNameTemplate;
@@ -163,6 +160,24 @@ private static function getClientDefaults()
];
}
+ private static function getAdaptiveMtDatasetNameTemplate()
+ {
+ if (self::$adaptiveMtDatasetNameTemplate == null) {
+ self::$adaptiveMtDatasetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}');
+ }
+
+ return self::$adaptiveMtDatasetNameTemplate;
+ }
+
+ private static function getAdaptiveMtFileNameTemplate()
+ {
+ if (self::$adaptiveMtFileNameTemplate == null) {
+ self::$adaptiveMtFileNameTemplate = new PathTemplate('projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}');
+ }
+
+ return self::$adaptiveMtFileNameTemplate;
+ }
+
private static function getGlossaryNameTemplate()
{
if (self::$glossaryNameTemplate == null) {
@@ -185,6 +200,8 @@ private static function getPathTemplateMap()
{
if (self::$pathTemplateMap == null) {
self::$pathTemplateMap = [
+ 'adaptiveMtDataset' => self::getAdaptiveMtDatasetNameTemplate(),
+ 'adaptiveMtFile' => self::getAdaptiveMtFileNameTemplate(),
'glossary' => self::getGlossaryNameTemplate(),
'location' => self::getLocationNameTemplate(),
];
@@ -193,6 +210,46 @@ private static function getPathTemplateMap()
return self::$pathTemplateMap;
}
+ /**
+ * Formats a string containing the fully-qualified path to represent a
+ * adaptive_mt_dataset resource.
+ *
+ * @param string $project
+ * @param string $location
+ * @param string $dataset
+ *
+ * @return string The formatted adaptive_mt_dataset resource.
+ */
+ public static function adaptiveMtDatasetName($project, $location, $dataset)
+ {
+ return self::getAdaptiveMtDatasetNameTemplate()->render([
+ 'project' => $project,
+ 'location' => $location,
+ 'dataset' => $dataset,
+ ]);
+ }
+
+ /**
+ * Formats a string containing the fully-qualified path to represent a
+ * adaptive_mt_file resource.
+ *
+ * @param string $project
+ * @param string $location
+ * @param string $dataset
+ * @param string $file
+ *
+ * @return string The formatted adaptive_mt_file resource.
+ */
+ public static function adaptiveMtFileName($project, $location, $dataset, $file)
+ {
+ return self::getAdaptiveMtFileNameTemplate()->render([
+ 'project' => $project,
+ 'location' => $location,
+ 'dataset' => $dataset,
+ 'file' => $file,
+ ]);
+ }
+
/**
* Formats a string containing the fully-qualified path to represent a glossary
* resource.
@@ -233,6 +290,8 @@ public static function locationName($project, $location)
* Parses a formatted name string and returns an associative array of the components in the name.
* The following name formats are supported:
* Template: Pattern
+ * - adaptiveMtDataset: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}
+ * - adaptiveMtFile: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}
* - glossary: projects/{project}/locations/{location}/glossaries/{glossary}
* - location: projects/{project}/locations/{location}
*
@@ -361,6 +420,55 @@ public function __construct(array $options = [])
$this->operationsClient = $this->createOperationsClient($clientOptions);
}
+ /**
+ * Translate text using Adaptive MT.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]');
+ * $formattedDataset = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ * $content = [];
+ * $response = $translationServiceClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content);
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. Location to make a regional call.
+ *
+ * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+ * @param string $dataset Required. The resource name for the dataset to use for adaptive MT.
+ * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
+ * @param string[] $content Required. The content of the input in string format.
+ * For now only one sentence per request is supported.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Translate\V3\AdaptiveMtTranslateResponse
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function adaptiveMtTranslate($parent, $dataset, $content, array $optionalArgs = [])
+ {
+ $request = new AdaptiveMtTranslateRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $request->setDataset($dataset);
+ $request->setContent($content);
+ $requestParamHeaders['parent'] = $parent;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('AdaptiveMtTranslate', AdaptiveMtTranslateResponse::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Translates a large volume of document in asynchronous batch mode.
* This function provides real-time output as the inputs are being processed.
@@ -453,9 +561,9 @@ public function __construct(array $options = [])
* @type array $glossaries
* Optional. Glossaries to be applied. It's keyed by target language code.
* @type array $formatConversions
- * Optional. File format conversion map to be applied to all input files.
- * Map's key is the original mime_type. Map's value is the target mime_type of
- * translated documents.
+ * Optional. The file format conversion map that is applied to all input
+ * files. The map key is the original mime_type. The map value is the target
+ * mime_type of translated documents.
*
* Supported file format conversion includes:
* - `application/pdf` to
@@ -660,6 +768,49 @@ public function batchTranslateText($parent, $sourceLanguageCode, $targetLanguage
return $this->startOperationsCall('BatchTranslateText', $optionalArgs, $request, $this->getOperationsClient())->wait();
}
+ /**
+ * Creates an Adaptive MT dataset.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]');
+ * $adaptiveMtDataset = new AdaptiveMtDataset();
+ * $response = $translationServiceClient->createAdaptiveMtDataset($formattedParent, $adaptiveMtDataset);
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. Name of the parent project. In form of
+ * `projects/{project-number-or-id}/locations/{location-id}`
+ * @param AdaptiveMtDataset $adaptiveMtDataset Required. The AdaptiveMtDataset to be created.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Translate\V3\AdaptiveMtDataset
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function createAdaptiveMtDataset($parent, $adaptiveMtDataset, array $optionalArgs = [])
+ {
+ $request = new CreateAdaptiveMtDatasetRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $request->setAdaptiveMtDataset($adaptiveMtDataset);
+ $requestParamHeaders['parent'] = $parent;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('CreateAdaptiveMtDataset', AdaptiveMtDataset::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Creates a glossary and returns the long-running operation. Returns
* NOT_FOUND, if the project doesn't exist.
@@ -728,6 +879,83 @@ public function createGlossary($parent, $glossary, array $optionalArgs = [])
return $this->startOperationsCall('CreateGlossary', $optionalArgs, $request, $this->getOperationsClient())->wait();
}
+ /**
+ * Deletes an Adaptive MT dataset, including all its entries and associated
+ * metadata.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedName = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ * $translationServiceClient->deleteAdaptiveMtDataset($formattedName);
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $name Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function deleteAdaptiveMtDataset($name, array $optionalArgs = [])
+ {
+ $request = new DeleteAdaptiveMtDatasetRequest();
+ $requestParamHeaders = [];
+ $request->setName($name);
+ $requestParamHeaders['name'] = $name;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('DeleteAdaptiveMtDataset', GPBEmpty::class, $optionalArgs, $request)->wait();
+ }
+
+ /**
+ * Deletes an AdaptiveMtFile along with its sentences.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedName = $translationServiceClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ * $translationServiceClient->deleteAdaptiveMtFile($formattedName);
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $name Required. The resource name of the file to delete, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function deleteAdaptiveMtFile($name, array $optionalArgs = [])
+ {
+ $request = new DeleteAdaptiveMtFileRequest();
+ $requestParamHeaders = [];
+ $request->setName($name);
+ $requestParamHeaders['name'] = $name;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('DeleteAdaptiveMtFile', GPBEmpty::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Deletes a glossary, or cancels glossary construction
* if the glossary isn't created yet.
@@ -884,6 +1112,86 @@ public function detectLanguage($parent, array $optionalArgs = [])
return $this->startCall('DetectLanguage', DetectLanguageResponse::class, $optionalArgs, $request)->wait();
}
+ /**
+ * Gets the Adaptive MT dataset.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedName = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ * $response = $translationServiceClient->getAdaptiveMtDataset($formattedName);
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $name Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Translate\V3\AdaptiveMtDataset
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function getAdaptiveMtDataset($name, array $optionalArgs = [])
+ {
+ $request = new GetAdaptiveMtDatasetRequest();
+ $requestParamHeaders = [];
+ $request->setName($name);
+ $requestParamHeaders['name'] = $name;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('GetAdaptiveMtDataset', AdaptiveMtDataset::class, $optionalArgs, $request)->wait();
+ }
+
+ /**
+ * Gets and AdaptiveMtFile
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedName = $translationServiceClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ * $response = $translationServiceClient->getAdaptiveMtFile($formattedName);
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $name Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Translate\V3\AdaptiveMtFile
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function getAdaptiveMtFile($name, array $optionalArgs = [])
+ {
+ $request = new GetAdaptiveMtFileRequest();
+ $requestParamHeaders = [];
+ $request->setName($name);
+ $requestParamHeaders['name'] = $name;
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('GetAdaptiveMtFile', AdaptiveMtFile::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Gets a glossary. Returns NOT_FOUND, if the glossary doesn't
* exist.
@@ -1001,6 +1309,277 @@ public function getSupportedLanguages($parent, array $optionalArgs = [])
return $this->startCall('GetSupportedLanguages', SupportedLanguages::class, $optionalArgs, $request)->wait();
}
+ /**
+ * Imports an AdaptiveMtFile and adds all of its sentences into the
+ * AdaptiveMtDataset.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedParent = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ * $response = $translationServiceClient->importAdaptiveMtFile($formattedParent);
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type FileInputSource $fileInputSource
+ * Inline file source.
+ * @type GcsInputSource $gcsInputSource
+ * Google Cloud Storage file source.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Translate\V3\ImportAdaptiveMtFileResponse
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function importAdaptiveMtFile($parent, array $optionalArgs = [])
+ {
+ $request = new ImportAdaptiveMtFileRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $requestParamHeaders['parent'] = $parent;
+ if (isset($optionalArgs['fileInputSource'])) {
+ $request->setFileInputSource($optionalArgs['fileInputSource']);
+ }
+
+ if (isset($optionalArgs['gcsInputSource'])) {
+ $request->setGcsInputSource($optionalArgs['gcsInputSource']);
+ }
+
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('ImportAdaptiveMtFile', ImportAdaptiveMtFileResponse::class, $optionalArgs, $request)->wait();
+ }
+
+ /**
+ * Lists all Adaptive MT datasets for which the caller has read permission.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]');
+ * // Iterate over pages of elements
+ * $pagedResponse = $translationServiceClient->listAdaptiveMtDatasets($formattedParent);
+ * foreach ($pagedResponse->iteratePages() as $page) {
+ * foreach ($page as $element) {
+ * // doSomethingWith($element);
+ * }
+ * }
+ * // Alternatively:
+ * // Iterate through all elements
+ * $pagedResponse = $translationServiceClient->listAdaptiveMtDatasets($formattedParent);
+ * foreach ($pagedResponse->iterateAllElements() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. The resource name of the project from which to list the Adaptive
+ * MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $pageSize
+ * The maximum number of resources contained in the underlying API
+ * response. The API may return fewer values in a page, even if
+ * there are additional values to be retrieved.
+ * @type string $pageToken
+ * A page token is used to specify a page of values to be returned.
+ * If no page token is specified (the default), the first page
+ * of values will be returned. Any page token used here must have
+ * been generated by a previous call to the API.
+ * @type string $filter
+ * Optional. An expression for filtering the results of the request.
+ * Filter is not supported yet.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\ApiCore\PagedListResponse
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function listAdaptiveMtDatasets($parent, array $optionalArgs = [])
+ {
+ $request = new ListAdaptiveMtDatasetsRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $requestParamHeaders['parent'] = $parent;
+ if (isset($optionalArgs['pageSize'])) {
+ $request->setPageSize($optionalArgs['pageSize']);
+ }
+
+ if (isset($optionalArgs['pageToken'])) {
+ $request->setPageToken($optionalArgs['pageToken']);
+ }
+
+ if (isset($optionalArgs['filter'])) {
+ $request->setFilter($optionalArgs['filter']);
+ }
+
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->getPagedListResponse('ListAdaptiveMtDatasets', $optionalArgs, ListAdaptiveMtDatasetsResponse::class, $request);
+ }
+
+ /**
+ * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedParent = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ * // Iterate over pages of elements
+ * $pagedResponse = $translationServiceClient->listAdaptiveMtFiles($formattedParent);
+ * foreach ($pagedResponse->iteratePages() as $page) {
+ * foreach ($page as $element) {
+ * // doSomethingWith($element);
+ * }
+ * }
+ * // Alternatively:
+ * // Iterate through all elements
+ * $pagedResponse = $translationServiceClient->listAdaptiveMtFiles($formattedParent);
+ * foreach ($pagedResponse->iterateAllElements() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. The resource name of the project from which to list the Adaptive
+ * MT files.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $pageSize
+ * The maximum number of resources contained in the underlying API
+ * response. The API may return fewer values in a page, even if
+ * there are additional values to be retrieved.
+ * @type string $pageToken
+ * A page token is used to specify a page of values to be returned.
+ * If no page token is specified (the default), the first page
+ * of values will be returned. Any page token used here must have
+ * been generated by a previous call to the API.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\ApiCore\PagedListResponse
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function listAdaptiveMtFiles($parent, array $optionalArgs = [])
+ {
+ $request = new ListAdaptiveMtFilesRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $requestParamHeaders['parent'] = $parent;
+ if (isset($optionalArgs['pageSize'])) {
+ $request->setPageSize($optionalArgs['pageSize']);
+ }
+
+ if (isset($optionalArgs['pageToken'])) {
+ $request->setPageToken($optionalArgs['pageToken']);
+ }
+
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->getPagedListResponse('ListAdaptiveMtFiles', $optionalArgs, ListAdaptiveMtFilesResponse::class, $request);
+ }
+
+ /**
+ * Lists all AdaptiveMtSentences under a given file/dataset.
+ *
+ * Sample code:
+ * ```
+ * $translationServiceClient = new TranslationServiceClient();
+ * try {
+ * $formattedParent = $translationServiceClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ * // Iterate over pages of elements
+ * $pagedResponse = $translationServiceClient->listAdaptiveMtSentences($formattedParent);
+ * foreach ($pagedResponse->iteratePages() as $page) {
+ * foreach ($page as $element) {
+ * // doSomethingWith($element);
+ * }
+ * }
+ * // Alternatively:
+ * // Iterate through all elements
+ * $pagedResponse = $translationServiceClient->listAdaptiveMtSentences($formattedParent);
+ * foreach ($pagedResponse->iterateAllElements() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $translationServiceClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. The resource name of the project from which to list the Adaptive
+ * MT files. The following format lists all sentences under a file.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * The following format lists all sentences within a dataset.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $pageSize
+ * The maximum number of resources contained in the underlying API
+ * response. The API may return fewer values in a page, even if
+ * there are additional values to be retrieved.
+ * @type string $pageToken
+ * A page token is used to specify a page of values to be returned.
+ * If no page token is specified (the default), the first page
+ * of values will be returned. Any page token used here must have
+ * been generated by a previous call to the API.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\ApiCore\PagedListResponse
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function listAdaptiveMtSentences($parent, array $optionalArgs = [])
+ {
+ $request = new ListAdaptiveMtSentencesRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $requestParamHeaders['parent'] = $parent;
+ if (isset($optionalArgs['pageSize'])) {
+ $request->setPageSize($optionalArgs['pageSize']);
+ }
+
+ if (isset($optionalArgs['pageToken'])) {
+ $request->setPageToken($optionalArgs['pageToken']);
+ }
+
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->getPagedListResponse('ListAdaptiveMtSentences', $optionalArgs, ListAdaptiveMtSentencesResponse::class, $request);
+ }
+
/**
* Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
* exist.
diff --git a/Translate/src/V3/GcsInputSource.php b/Translate/src/V3/GcsInputSource.php
new file mode 100644
index 000000000000..4e8c9a8c67ea
--- /dev/null
+++ b/Translate/src/V3/GcsInputSource.php
@@ -0,0 +1,67 @@
+google.cloud.translation.v3.GcsInputSource
+ */
+class GcsInputSource extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+ *
+ * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $input_uri = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $input_uri
+ * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+ *
+ * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getInputUri()
+ {
+ return $this->input_uri;
+ }
+
+ /**
+ * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+ *
+ * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setInputUri($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->input_uri = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/GcsOutputDestination.php b/Translate/src/V3/GcsOutputDestination.php
new file mode 100644
index 000000000000..8b9cdb886b9b
--- /dev/null
+++ b/Translate/src/V3/GcsOutputDestination.php
@@ -0,0 +1,75 @@
+google.cloud.translation.v3.GcsOutputDestination
+ */
+class GcsOutputDestination extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Google Cloud Storage URI to output directory. For example,
+ * `gs://bucket/directory`. The requesting user must have write permission to
+ * the bucket. The directory will be created if it doesn't exist.
+ *
+ * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $output_uri_prefix = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $output_uri_prefix
+ * Required. Google Cloud Storage URI to output directory. For example,
+ * `gs://bucket/directory`. The requesting user must have write permission to
+ * the bucket. The directory will be created if it doesn't exist.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Google Cloud Storage URI to output directory. For example,
+ * `gs://bucket/directory`. The requesting user must have write permission to
+ * the bucket. The directory will be created if it doesn't exist.
+ *
+ * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getOutputUriPrefix()
+ {
+ return $this->output_uri_prefix;
+ }
+
+ /**
+ * Required. Google Cloud Storage URI to output directory. For example,
+ * `gs://bucket/directory`. The requesting user must have write permission to
+ * the bucket. The directory will be created if it doesn't exist.
+ *
+ * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setOutputUriPrefix($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->output_uri_prefix = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/GetAdaptiveMtDatasetRequest.php b/Translate/src/V3/GetAdaptiveMtDatasetRequest.php
new file mode 100644
index 000000000000..99ab219ad9d7
--- /dev/null
+++ b/Translate/src/V3/GetAdaptiveMtDatasetRequest.php
@@ -0,0 +1,86 @@
+google.cloud.translation.v3.GetAdaptiveMtDatasetRequest
+ */
+class GetAdaptiveMtDatasetRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+
+ /**
+ * @param string $name Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\GetAdaptiveMtDatasetRequest
+ *
+ * @experimental
+ */
+ public static function build(string $name): self
+ {
+ return (new self())
+ ->setName($name);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. Name of the dataset. In the form of
+ * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/GetAdaptiveMtFileRequest.php b/Translate/src/V3/GetAdaptiveMtFileRequest.php
new file mode 100644
index 000000000000..fb79e3f3cbe4
--- /dev/null
+++ b/Translate/src/V3/GetAdaptiveMtFileRequest.php
@@ -0,0 +1,86 @@
+google.cloud.translation.v3.GetAdaptiveMtFileRequest
+ */
+class GetAdaptiveMtFileRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $name = '';
+
+ /**
+ * @param string $name Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * Please see {@see TranslationServiceClient::adaptiveMtFileName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\GetAdaptiveMtFileRequest
+ *
+ * @experimental
+ */
+ public static function build(string $name): self
+ {
+ return (new self())
+ ->setName($name);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/ImportAdaptiveMtFileRequest.php b/Translate/src/V3/ImportAdaptiveMtFileRequest.php
new file mode 100644
index 000000000000..736798fb4a9a
--- /dev/null
+++ b/Translate/src/V3/ImportAdaptiveMtFileRequest.php
@@ -0,0 +1,161 @@
+google.cloud.translation.v3.ImportAdaptiveMtFileRequest
+ */
+class ImportAdaptiveMtFileRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ protected $source;
+
+ /**
+ * @param string $parent Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
+ * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\ImportAdaptiveMtFileRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent): self
+ {
+ return (new self())
+ ->setParent($parent);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
+ * @type \Google\Cloud\Translate\V3\FileInputSource $file_input_source
+ * Inline file source.
+ * @type \Google\Cloud\Translate\V3\GcsInputSource $gcs_input_source
+ * Google Cloud Storage file source.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. The resource name of the file, in form of
+ * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Inline file source.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.FileInputSource file_input_source = 2;
+ * @return \Google\Cloud\Translate\V3\FileInputSource|null
+ */
+ public function getFileInputSource()
+ {
+ return $this->readOneof(2);
+ }
+
+ public function hasFileInputSource()
+ {
+ return $this->hasOneof(2);
+ }
+
+ /**
+ * Inline file source.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.FileInputSource file_input_source = 2;
+ * @param \Google\Cloud\Translate\V3\FileInputSource $var
+ * @return $this
+ */
+ public function setFileInputSource($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\FileInputSource::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * Google Cloud Storage file source.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.GcsInputSource gcs_input_source = 3;
+ * @return \Google\Cloud\Translate\V3\GcsInputSource|null
+ */
+ public function getGcsInputSource()
+ {
+ return $this->readOneof(3);
+ }
+
+ public function hasGcsInputSource()
+ {
+ return $this->hasOneof(3);
+ }
+
+ /**
+ * Google Cloud Storage file source.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.GcsInputSource gcs_input_source = 3;
+ * @param \Google\Cloud\Translate\V3\GcsInputSource $var
+ * @return $this
+ */
+ public function setGcsInputSource($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsInputSource::class);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSource()
+ {
+ return $this->whichOneof("source");
+ }
+
+}
+
diff --git a/Translate/src/V3/ImportAdaptiveMtFileResponse.php b/Translate/src/V3/ImportAdaptiveMtFileResponse.php
new file mode 100644
index 000000000000..32ac38ab3154
--- /dev/null
+++ b/Translate/src/V3/ImportAdaptiveMtFileResponse.php
@@ -0,0 +1,77 @@
+google.cloud.translation.v3.ImportAdaptiveMtFileResponse
+ */
+class ImportAdaptiveMtFileResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Output only. The Adaptive MT file that was imported.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_file = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $adaptive_mt_file = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Translate\V3\AdaptiveMtFile $adaptive_mt_file
+ * Output only. The Adaptive MT file that was imported.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Output only. The Adaptive MT file that was imported.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_file = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Cloud\Translate\V3\AdaptiveMtFile|null
+ */
+ public function getAdaptiveMtFile()
+ {
+ return $this->adaptive_mt_file;
+ }
+
+ public function hasAdaptiveMtFile()
+ {
+ return isset($this->adaptive_mt_file);
+ }
+
+ public function clearAdaptiveMtFile()
+ {
+ unset($this->adaptive_mt_file);
+ }
+
+ /**
+ * Output only. The Adaptive MT file that was imported.
+ *
+ * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_file = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Cloud\Translate\V3\AdaptiveMtFile $var
+ * @return $this
+ */
+ public function setAdaptiveMtFile($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\AdaptiveMtFile::class);
+ $this->adaptive_mt_file = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/ListAdaptiveMtDatasetsRequest.php b/Translate/src/V3/ListAdaptiveMtDatasetsRequest.php
new file mode 100644
index 000000000000..b5edb32417c1
--- /dev/null
+++ b/Translate/src/V3/ListAdaptiveMtDatasetsRequest.php
@@ -0,0 +1,213 @@
+google.cloud.translation.v3.ListAdaptiveMtDatasetsRequest
+ */
+class ListAdaptiveMtDatasetsRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ /**
+ * Optional. Requested page size. The server may return fewer results than
+ * requested. If unspecified, the server picks an appropriate default.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $page_size = 0;
+ /**
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtDatasetsResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtDatasets` method. The first page is
+ * returned if `page_token`is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $page_token = '';
+ /**
+ * Optional. An expression for filtering the results of the request.
+ * Filter is not supported yet.
+ *
+ * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $filter = '';
+
+ /**
+ * @param string $parent Required. The resource name of the project from which to list the Adaptive
+ * MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
+ * Please see {@see TranslationServiceClient::locationName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent): self
+ {
+ return (new self())
+ ->setParent($parent);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
+ * @type int $page_size
+ * Optional. Requested page size. The server may return fewer results than
+ * requested. If unspecified, the server picks an appropriate default.
+ * @type string $page_token
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtDatasetsResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtDatasets` method. The first page is
+ * returned if `page_token`is empty or missing.
+ * @type string $filter
+ * Optional. An expression for filtering the results of the request.
+ * Filter is not supported yet.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. Requested page size. The server may return fewer results than
+ * requested. If unspecified, the server picks an appropriate default.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return int
+ */
+ public function getPageSize()
+ {
+ return $this->page_size;
+ }
+
+ /**
+ * Optional. Requested page size. The server may return fewer results than
+ * requested. If unspecified, the server picks an appropriate default.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @param int $var
+ * @return $this
+ */
+ public function setPageSize($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->page_size = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtDatasetsResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtDatasets` method. The first page is
+ * returned if `page_token`is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getPageToken()
+ {
+ return $this->page_token;
+ }
+
+ /**
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtDatasetsResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtDatasets` method. The first page is
+ * returned if `page_token`is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->page_token = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. An expression for filtering the results of the request.
+ * Filter is not supported yet.
+ *
+ * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getFilter()
+ {
+ return $this->filter;
+ }
+
+ /**
+ * Optional. An expression for filtering the results of the request.
+ * Filter is not supported yet.
+ *
+ * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setFilter($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->filter = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/ListAdaptiveMtDatasetsResponse.php b/Translate/src/V3/ListAdaptiveMtDatasetsResponse.php
new file mode 100644
index 000000000000..b836d5c7aeeb
--- /dev/null
+++ b/Translate/src/V3/ListAdaptiveMtDatasetsResponse.php
@@ -0,0 +1,109 @@
+google.cloud.translation.v3.ListAdaptiveMtDatasetsResponse
+ */
+class ListAdaptiveMtDatasetsResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Output only. A list of Adaptive MT datasets.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_datasets = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $adaptive_mt_datasets;
+ /**
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to
+ * `ListAdaptiveMtDatasets` method to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $next_page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array<\Google\Cloud\Translate\V3\AdaptiveMtDataset>|\Google\Protobuf\Internal\RepeatedField $adaptive_mt_datasets
+ * Output only. A list of Adaptive MT datasets.
+ * @type string $next_page_token
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to
+ * `ListAdaptiveMtDatasets` method to retrieve the next page of results.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Output only. A list of Adaptive MT datasets.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_datasets = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getAdaptiveMtDatasets()
+ {
+ return $this->adaptive_mt_datasets;
+ }
+
+ /**
+ * Output only. A list of Adaptive MT datasets.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_datasets = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param array<\Google\Cloud\Translate\V3\AdaptiveMtDataset>|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setAdaptiveMtDatasets($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtDataset::class);
+ $this->adaptive_mt_datasets = $arr;
+
+ return $this;
+ }
+
+ /**
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to
+ * `ListAdaptiveMtDatasets` method to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to
+ * `ListAdaptiveMtDatasets` method to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setNextPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->next_page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/ListAdaptiveMtFilesRequest.php b/Translate/src/V3/ListAdaptiveMtFilesRequest.php
new file mode 100644
index 000000000000..0f3634b2af81
--- /dev/null
+++ b/Translate/src/V3/ListAdaptiveMtFilesRequest.php
@@ -0,0 +1,175 @@
+google.cloud.translation.v3.ListAdaptiveMtFilesRequest
+ */
+class ListAdaptiveMtFilesRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ /**
+ * Optional.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $page_size = 0;
+ /**
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtFilesResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtFiles` method. The first page is
+ * returned if `page_token`is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $page_token = '';
+
+ /**
+ * @param string $parent Required. The resource name of the project from which to list the Adaptive
+ * MT files.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\ListAdaptiveMtFilesRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent): self
+ {
+ return (new self())
+ ->setParent($parent);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ * @type int $page_size
+ * Optional.
+ * @type string $page_token
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtFilesResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtFiles` method. The first page is
+ * returned if `page_token`is empty or missing.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return int
+ */
+ public function getPageSize()
+ {
+ return $this->page_size;
+ }
+
+ /**
+ * Optional.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @param int $var
+ * @return $this
+ */
+ public function setPageSize($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->page_size = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtFilesResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtFiles` method. The first page is
+ * returned if `page_token`is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getPageToken()
+ {
+ return $this->page_token;
+ }
+
+ /**
+ * Optional. A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtFilesResponse.next_page_token returned from the
+ * previous call to `ListAdaptiveMtFiles` method. The first page is
+ * returned if `page_token`is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/ListAdaptiveMtFilesResponse.php b/Translate/src/V3/ListAdaptiveMtFilesResponse.php
new file mode 100644
index 000000000000..dd11f5e0513a
--- /dev/null
+++ b/Translate/src/V3/ListAdaptiveMtFilesResponse.php
@@ -0,0 +1,109 @@
+google.cloud.translation.v3.ListAdaptiveMtFilesResponse
+ */
+class ListAdaptiveMtFilesResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Output only. The Adaptive MT files.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_files = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $adaptive_mt_files;
+ /**
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to
+ * `ListAdaptiveMtFiles` method to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $next_page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array<\Google\Cloud\Translate\V3\AdaptiveMtFile>|\Google\Protobuf\Internal\RepeatedField $adaptive_mt_files
+ * Output only. The Adaptive MT files.
+ * @type string $next_page_token
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to
+ * `ListAdaptiveMtFiles` method to retrieve the next page of results.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Output only. The Adaptive MT files.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_files = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getAdaptiveMtFiles()
+ {
+ return $this->adaptive_mt_files;
+ }
+
+ /**
+ * Output only. The Adaptive MT files.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_files = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param array<\Google\Cloud\Translate\V3\AdaptiveMtFile>|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setAdaptiveMtFiles($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtFile::class);
+ $this->adaptive_mt_files = $arr;
+
+ return $this;
+ }
+
+ /**
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to
+ * `ListAdaptiveMtFiles` method to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * Optional. A token to retrieve a page of results. Pass this value in the
+ * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to
+ * `ListAdaptiveMtFiles` method to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setNextPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->next_page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/ListAdaptiveMtSentencesRequest.php b/Translate/src/V3/ListAdaptiveMtSentencesRequest.php
new file mode 100644
index 000000000000..6c77ac1fbccd
--- /dev/null
+++ b/Translate/src/V3/ListAdaptiveMtSentencesRequest.php
@@ -0,0 +1,178 @@
+google.cloud.translation.v3.ListAdaptiveMtSentencesRequest
+ */
+class ListAdaptiveMtSentencesRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files. The following format lists all sentences under a file.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * The following format lists all sentences within a dataset.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ */
+ private $parent = '';
+ /**
+ * Generated from protobuf field int32 page_size = 2;
+ */
+ private $page_size = 0;
+ /**
+ * A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtSentencesRequest.next_page_token returned from the
+ * previous call to `ListTranslationMemories` method. The first page is
+ * returned if `page_token` is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3;
+ */
+ private $page_token = '';
+
+ /**
+ * @param string $parent Required. The resource name of the project from which to list the Adaptive
+ * MT files. The following format lists all sentences under a file.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * The following format lists all sentences within a dataset.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ * Please see {@see TranslationServiceClient::adaptiveMtFileName()} for help formatting this field.
+ *
+ * @return \Google\Cloud\Translate\V3\ListAdaptiveMtSentencesRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent): self
+ {
+ return (new self())
+ ->setParent($parent);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files. The following format lists all sentences under a file.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * The following format lists all sentences within a dataset.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ * @type int $page_size
+ * @type string $page_token
+ * A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtSentencesRequest.next_page_token returned from the
+ * previous call to `ListTranslationMemories` method. The first page is
+ * returned if `page_token` is empty or missing.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files. The following format lists all sentences under a file.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * The following format lists all sentences within a dataset.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. The resource name of the project from which to list the Adaptive
+ * MT files. The following format lists all sentences under a file.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
+ * The following format lists all sentences within a dataset.
+ * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Generated from protobuf field int32 page_size = 2;
+ * @return int
+ */
+ public function getPageSize()
+ {
+ return $this->page_size;
+ }
+
+ /**
+ * Generated from protobuf field int32 page_size = 2;
+ * @param int $var
+ * @return $this
+ */
+ public function setPageSize($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->page_size = $var;
+
+ return $this;
+ }
+
+ /**
+ * A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtSentencesRequest.next_page_token returned from the
+ * previous call to `ListTranslationMemories` method. The first page is
+ * returned if `page_token` is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3;
+ * @return string
+ */
+ public function getPageToken()
+ {
+ return $this->page_token;
+ }
+
+ /**
+ * A token identifying a page of results the server should return.
+ * Typically, this is the value of
+ * ListAdaptiveMtSentencesRequest.next_page_token returned from the
+ * previous call to `ListTranslationMemories` method. The first page is
+ * returned if `page_token` is empty or missing.
+ *
+ * Generated from protobuf field string page_token = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/ListAdaptiveMtSentencesResponse.php b/Translate/src/V3/ListAdaptiveMtSentencesResponse.php
new file mode 100644
index 000000000000..599f55ee9cfd
--- /dev/null
+++ b/Translate/src/V3/ListAdaptiveMtSentencesResponse.php
@@ -0,0 +1,101 @@
+google.cloud.translation.v3.ListAdaptiveMtSentencesResponse
+ */
+class ListAdaptiveMtSentencesResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Output only. The list of AdaptiveMtSentences.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtSentence adaptive_mt_sentences = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ private $adaptive_mt_sentences;
+ /**
+ * Optional.
+ *
+ * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $next_page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array<\Google\Cloud\Translate\V3\AdaptiveMtSentence>|\Google\Protobuf\Internal\RepeatedField $adaptive_mt_sentences
+ * Output only. The list of AdaptiveMtSentences.
+ * @type string $next_page_token
+ * Optional.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Output only. The list of AdaptiveMtSentences.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtSentence adaptive_mt_sentences = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getAdaptiveMtSentences()
+ {
+ return $this->adaptive_mt_sentences;
+ }
+
+ /**
+ * Output only. The list of AdaptiveMtSentences.
+ *
+ * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtSentence adaptive_mt_sentences = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param array<\Google\Cloud\Translate\V3\AdaptiveMtSentence>|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setAdaptiveMtSentences($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtSentence::class);
+ $this->adaptive_mt_sentences = $arr;
+
+ return $this;
+ }
+
+ /**
+ * Optional.
+ *
+ * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * Optional.
+ *
+ * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setNextPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->next_page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Translate/src/V3/gapic_metadata.json b/Translate/src/V3/gapic_metadata.json
index 83ec36ab8d9d..8645e8c2bd68 100644
--- a/Translate/src/V3/gapic_metadata.json
+++ b/Translate/src/V3/gapic_metadata.json
@@ -10,6 +10,11 @@
"grpc": {
"libraryClient": "TranslationServiceGapicClient",
"rpcs": {
+ "AdaptiveMtTranslate": {
+ "methods": [
+ "adaptiveMtTranslate"
+ ]
+ },
"BatchTranslateDocument": {
"methods": [
"batchTranslateDocument"
@@ -20,11 +25,26 @@
"batchTranslateText"
]
},
+ "CreateAdaptiveMtDataset": {
+ "methods": [
+ "createAdaptiveMtDataset"
+ ]
+ },
"CreateGlossary": {
"methods": [
"createGlossary"
]
},
+ "DeleteAdaptiveMtDataset": {
+ "methods": [
+ "deleteAdaptiveMtDataset"
+ ]
+ },
+ "DeleteAdaptiveMtFile": {
+ "methods": [
+ "deleteAdaptiveMtFile"
+ ]
+ },
"DeleteGlossary": {
"methods": [
"deleteGlossary"
@@ -35,6 +55,16 @@
"detectLanguage"
]
},
+ "GetAdaptiveMtDataset": {
+ "methods": [
+ "getAdaptiveMtDataset"
+ ]
+ },
+ "GetAdaptiveMtFile": {
+ "methods": [
+ "getAdaptiveMtFile"
+ ]
+ },
"GetGlossary": {
"methods": [
"getGlossary"
@@ -45,6 +75,26 @@
"getSupportedLanguages"
]
},
+ "ImportAdaptiveMtFile": {
+ "methods": [
+ "importAdaptiveMtFile"
+ ]
+ },
+ "ListAdaptiveMtDatasets": {
+ "methods": [
+ "listAdaptiveMtDatasets"
+ ]
+ },
+ "ListAdaptiveMtFiles": {
+ "methods": [
+ "listAdaptiveMtFiles"
+ ]
+ },
+ "ListAdaptiveMtSentences": {
+ "methods": [
+ "listAdaptiveMtSentences"
+ ]
+ },
"ListGlossaries": {
"methods": [
"listGlossaries"
diff --git a/Translate/src/V3/resources/translation_service_client_config.json b/Translate/src/V3/resources/translation_service_client_config.json
index 6cf662905ea5..3623db717192 100644
--- a/Translate/src/V3/resources/translation_service_client_config.json
+++ b/Translate/src/V3/resources/translation_service_client_config.json
@@ -39,6 +39,11 @@
}
},
"methods": {
+ "AdaptiveMtTranslate": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"BatchTranslateDocument": {
"timeout_millis": 600000,
"retry_codes_name": "no_retry_1_codes",
@@ -49,11 +54,26 @@
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params"
},
+ "CreateAdaptiveMtDataset": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"CreateGlossary": {
"timeout_millis": 600000,
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params"
},
+ "DeleteAdaptiveMtDataset": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "DeleteAdaptiveMtFile": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"DeleteGlossary": {
"timeout_millis": 600000,
"retry_codes_name": "retry_policy_1_codes",
@@ -64,6 +84,16 @@
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params"
},
+ "GetAdaptiveMtDataset": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "GetAdaptiveMtFile": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"GetGlossary": {
"timeout_millis": 600000,
"retry_codes_name": "retry_policy_1_codes",
@@ -74,6 +104,26 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "ImportAdaptiveMtFile": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "ListAdaptiveMtDatasets": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "ListAdaptiveMtFiles": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "ListAdaptiveMtSentences": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"ListGlossaries": {
"timeout_millis": 600000,
"retry_codes_name": "retry_policy_1_codes",
diff --git a/Translate/src/V3/resources/translation_service_descriptor_config.php b/Translate/src/V3/resources/translation_service_descriptor_config.php
index e61a28d352a6..485ef049f09f 100644
--- a/Translate/src/V3/resources/translation_service_descriptor_config.php
+++ b/Translate/src/V3/resources/translation_service_descriptor_config.php
@@ -79,6 +79,54 @@
],
],
],
+ 'AdaptiveMtTranslate' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtTranslateResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'CreateAdaptiveMtDataset' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtDataset',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'DeleteAdaptiveMtDataset' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Protobuf\GPBEmpty',
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'DeleteAdaptiveMtFile' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Protobuf\GPBEmpty',
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'DetectLanguage' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Cloud\Translate\V3\DetectLanguageResponse',
@@ -91,6 +139,30 @@
],
],
],
+ 'GetAdaptiveMtDataset' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtDataset',
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'GetAdaptiveMtFile' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtFile',
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'GetGlossary' => [
'callType' => \Google\ApiCore\Call::UNARY_CALL,
'responseType' => 'Google\Cloud\Translate\V3\Glossary',
@@ -115,6 +187,78 @@
],
],
],
+ 'ImportAdaptiveMtFile' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\ImportAdaptiveMtFileResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'ListAdaptiveMtDatasets' => [
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getAdaptiveMtDatasets',
+ ],
+ 'callType' => \Google\ApiCore\Call::PAGINATED_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'ListAdaptiveMtFiles' => [
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getAdaptiveMtFiles',
+ ],
+ 'callType' => \Google\ApiCore\Call::PAGINATED_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\ListAdaptiveMtFilesResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'ListAdaptiveMtSentences' => [
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getAdaptiveMtSentences',
+ ],
+ 'callType' => \Google\ApiCore\Call::PAGINATED_CALL,
+ 'responseType' => 'Google\Cloud\Translate\V3\ListAdaptiveMtSentencesResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'ListGlossaries' => [
'pageStreaming' => [
'requestPageTokenGetMethod' => 'getPageToken',
@@ -160,6 +304,8 @@
],
],
'templateMap' => [
+ 'adaptiveMtDataset' => 'projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}',
+ 'adaptiveMtFile' => 'projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}',
'glossary' => 'projects/{project}/locations/{location}/glossaries/{glossary}',
'location' => 'projects/{project}/locations/{location}',
],
diff --git a/Translate/src/V3/resources/translation_service_rest_client_config.php b/Translate/src/V3/resources/translation_service_rest_client_config.php
index 0239536089f7..720ee2e54ab0 100644
--- a/Translate/src/V3/resources/translation_service_rest_client_config.php
+++ b/Translate/src/V3/resources/translation_service_rest_client_config.php
@@ -27,6 +27,18 @@
],
],
'google.cloud.translation.v3.TranslationService' => [
+ 'AdaptiveMtTranslate' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:adaptiveMtTranslate',
+ 'body' => '*',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'BatchTranslateDocument' => [
'method' => 'post',
'uriTemplate' => '/v3/{parent=projects/*/locations/*}:batchTranslateDocument',
@@ -51,6 +63,18 @@
],
],
],
+ 'CreateAdaptiveMtDataset' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets',
+ 'body' => 'adaptive_mt_dataset',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'CreateGlossary' => [
'method' => 'post',
'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries',
@@ -63,6 +87,28 @@
],
],
],
+ 'DeleteAdaptiveMtDataset' => [
+ 'method' => 'delete',
+ 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'DeleteAdaptiveMtFile' => [
+ 'method' => 'delete',
+ 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'DeleteGlossary' => [
'method' => 'delete',
'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}',
@@ -93,6 +139,28 @@
],
],
],
+ 'GetAdaptiveMtDataset' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'GetAdaptiveMtFile' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'GetGlossary' => [
'method' => 'get',
'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}',
@@ -121,6 +189,57 @@
],
],
],
+ 'ImportAdaptiveMtFile' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}:importAdaptiveMtFile',
+ 'body' => '*',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'ListAdaptiveMtDatasets' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'ListAdaptiveMtFiles' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtFiles',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'ListAdaptiveMtSentences' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}/adaptiveMtSentences',
+ 'additionalBindings' => [
+ [
+ 'method' => 'get',
+ 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtSentences',
+ ],
+ ],
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'ListGlossaries' => [
'method' => 'get',
'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries',
diff --git a/Translate/tests/Unit/V3/Client/TranslationServiceClientTest.php b/Translate/tests/Unit/V3/Client/TranslationServiceClientTest.php
index 29c757026888..9de46cec56a0 100644
--- a/Translate/tests/Unit/V3/Client/TranslationServiceClientTest.php
+++ b/Translate/tests/Unit/V3/Client/TranslationServiceClientTest.php
@@ -27,21 +27,39 @@
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\Testing\GeneratedTest;
use Google\ApiCore\Testing\MockTransport;
+use Google\Cloud\Translate\V3\AdaptiveMtDataset;
+use Google\Cloud\Translate\V3\AdaptiveMtFile;
+use Google\Cloud\Translate\V3\AdaptiveMtSentence;
+use Google\Cloud\Translate\V3\AdaptiveMtTranslateRequest;
+use Google\Cloud\Translate\V3\AdaptiveMtTranslateResponse;
use Google\Cloud\Translate\V3\BatchDocumentOutputConfig;
use Google\Cloud\Translate\V3\BatchTranslateDocumentRequest;
use Google\Cloud\Translate\V3\BatchTranslateDocumentResponse;
use Google\Cloud\Translate\V3\BatchTranslateResponse;
use Google\Cloud\Translate\V3\BatchTranslateTextRequest;
use Google\Cloud\Translate\V3\Client\TranslationServiceClient;
+use Google\Cloud\Translate\V3\CreateAdaptiveMtDatasetRequest;
use Google\Cloud\Translate\V3\CreateGlossaryRequest;
+use Google\Cloud\Translate\V3\DeleteAdaptiveMtDatasetRequest;
+use Google\Cloud\Translate\V3\DeleteAdaptiveMtFileRequest;
use Google\Cloud\Translate\V3\DeleteGlossaryRequest;
use Google\Cloud\Translate\V3\DeleteGlossaryResponse;
use Google\Cloud\Translate\V3\DetectLanguageRequest;
use Google\Cloud\Translate\V3\DetectLanguageResponse;
use Google\Cloud\Translate\V3\DocumentInputConfig;
+use Google\Cloud\Translate\V3\GetAdaptiveMtDatasetRequest;
+use Google\Cloud\Translate\V3\GetAdaptiveMtFileRequest;
use Google\Cloud\Translate\V3\GetGlossaryRequest;
use Google\Cloud\Translate\V3\GetSupportedLanguagesRequest;
use Google\Cloud\Translate\V3\Glossary;
+use Google\Cloud\Translate\V3\ImportAdaptiveMtFileRequest;
+use Google\Cloud\Translate\V3\ImportAdaptiveMtFileResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtFilesRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtFilesResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtSentencesRequest;
+use Google\Cloud\Translate\V3\ListAdaptiveMtSentencesResponse;
use Google\Cloud\Translate\V3\ListGlossariesRequest;
use Google\Cloud\Translate\V3\ListGlossariesResponse;
use Google\Cloud\Translate\V3\OutputConfig;
@@ -53,6 +71,7 @@
use Google\LongRunning\GetOperationRequest;
use Google\LongRunning\Operation;
use Google\Protobuf\Any;
+use Google\Protobuf\GPBEmpty;
use Google\Rpc\Code;
use stdClass;
@@ -84,6 +103,82 @@ private function createClient(array $options = [])
return new TranslationServiceClient($options);
}
+ /** @test */
+ public function adaptiveMtTranslateTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $languageCode = 'languageCode-412800396';
+ $expectedResponse = new AdaptiveMtTranslateResponse();
+ $expectedResponse->setLanguageCode($languageCode);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $content = [];
+ $request = (new AdaptiveMtTranslateRequest())
+ ->setParent($formattedParent)
+ ->setDataset($formattedDataset)
+ ->setContent($content);
+ $response = $gapicClient->adaptiveMtTranslate($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/AdaptiveMtTranslate', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getDataset();
+ $this->assertProtobufEquals($formattedDataset, $actualValue);
+ $actualValue = $actualRequestObject->getContent();
+ $this->assertProtobufEquals($content, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function adaptiveMtTranslateExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $content = [];
+ $request = (new AdaptiveMtTranslateRequest())
+ ->setParent($formattedParent)
+ ->setDataset($formattedDataset)
+ ->setContent($content);
+ try {
+ $gapicClient->adaptiveMtTranslate($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function batchTranslateDocumentTest()
{
@@ -396,6 +491,88 @@ public function batchTranslateTextExceptionTest()
$this->assertTrue($operationsTransport->isExhausted());
}
+ /** @test */
+ public function createAdaptiveMtDatasetTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name = 'name3373707';
+ $displayName = 'displayName1615086568';
+ $sourceLanguageCode = 'sourceLanguageCode1687263568';
+ $targetLanguageCode = 'targetLanguageCode1323228230';
+ $exampleCount = 1517063674;
+ $expectedResponse = new AdaptiveMtDataset();
+ $expectedResponse->setName($name);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setSourceLanguageCode($sourceLanguageCode);
+ $expectedResponse->setTargetLanguageCode($targetLanguageCode);
+ $expectedResponse->setExampleCount($exampleCount);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $adaptiveMtDataset = new AdaptiveMtDataset();
+ $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $adaptiveMtDataset->setName($adaptiveMtDatasetName);
+ $request = (new CreateAdaptiveMtDatasetRequest())
+ ->setParent($formattedParent)
+ ->setAdaptiveMtDataset($adaptiveMtDataset);
+ $response = $gapicClient->createAdaptiveMtDataset($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/CreateAdaptiveMtDataset', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getAdaptiveMtDataset();
+ $this->assertProtobufEquals($adaptiveMtDataset, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function createAdaptiveMtDatasetExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $adaptiveMtDataset = new AdaptiveMtDataset();
+ $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $adaptiveMtDataset->setName($adaptiveMtDatasetName);
+ $request = (new CreateAdaptiveMtDatasetRequest())
+ ->setParent($formattedParent)
+ ->setAdaptiveMtDataset($adaptiveMtDataset);
+ try {
+ $gapicClient->createAdaptiveMtDataset($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function createGlossaryTest()
{
@@ -533,6 +710,128 @@ public function createGlossaryExceptionTest()
$this->assertTrue($operationsTransport->isExhausted());
}
+ /** @test */
+ public function deleteAdaptiveMtDatasetTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new DeleteAdaptiveMtDatasetRequest())
+ ->setName($formattedName);
+ $gapicClient->deleteAdaptiveMtDataset($request);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtDataset', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteAdaptiveMtDatasetExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new DeleteAdaptiveMtDatasetRequest())
+ ->setName($formattedName);
+ try {
+ $gapicClient->deleteAdaptiveMtDataset($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteAdaptiveMtFileTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $request = (new DeleteAdaptiveMtFileRequest())
+ ->setName($formattedName);
+ $gapicClient->deleteAdaptiveMtFile($request);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtFile', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteAdaptiveMtFileExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $request = (new DeleteAdaptiveMtFileRequest())
+ ->setName($formattedName);
+ try {
+ $gapicClient->deleteAdaptiveMtFile($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function deleteGlossaryTest()
{
@@ -719,7 +1018,7 @@ public function detectLanguageExceptionTest()
}
/** @test */
- public function getGlossaryTest()
+ public function getAdaptiveMtDatasetTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -728,31 +1027,35 @@ public function getGlossaryTest()
$this->assertTrue($transport->isExhausted());
// Mock response
$name2 = 'name2-1052831874';
- $entryCount = 811131134;
$displayName = 'displayName1615086568';
- $expectedResponse = new Glossary();
+ $sourceLanguageCode = 'sourceLanguageCode1687263568';
+ $targetLanguageCode = 'targetLanguageCode1323228230';
+ $exampleCount = 1517063674;
+ $expectedResponse = new AdaptiveMtDataset();
$expectedResponse->setName($name2);
- $expectedResponse->setEntryCount($entryCount);
$expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setSourceLanguageCode($sourceLanguageCode);
+ $expectedResponse->setTargetLanguageCode($targetLanguageCode);
+ $expectedResponse->setExampleCount($exampleCount);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
- $request = (new GetGlossaryRequest())
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new GetAdaptiveMtDatasetRequest())
->setName($formattedName);
- $response = $gapicClient->getGlossary($request);
+ $response = $gapicClient->getAdaptiveMtDataset($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall);
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtDataset', $actualFuncCall);
$actualValue = $actualRequestObject->getName();
$this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
}
/** @test */
- public function getGlossaryExceptionTest()
+ public function getAdaptiveMtDatasetExceptionTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -770,11 +1073,11 @@ public function getGlossaryExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
- $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
- $request = (new GetGlossaryRequest())
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new GetAdaptiveMtDatasetRequest())
->setName($formattedName);
try {
- $gapicClient->getGlossary($request);
+ $gapicClient->getAdaptiveMtDataset($request);
// If the $gapicClient method call did not throw, fail the test
$this->fail('Expected an ApiException, but no exception was thrown.');
} catch (ApiException $ex) {
@@ -787,7 +1090,7 @@ public function getGlossaryExceptionTest()
}
/** @test */
- public function getSupportedLanguagesTest()
+ public function getAdaptiveMtFileTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -795,26 +1098,32 @@ public function getSupportedLanguagesTest()
]);
$this->assertTrue($transport->isExhausted());
// Mock response
- $expectedResponse = new SupportedLanguages();
+ $name2 = 'name2-1052831874';
+ $displayName = 'displayName1615086568';
+ $entryCount = 811131134;
+ $expectedResponse = new AdaptiveMtFile();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setEntryCount($entryCount);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
- $request = (new GetSupportedLanguagesRequest())
- ->setParent($formattedParent);
- $response = $gapicClient->getSupportedLanguages($request);
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $request = (new GetAdaptiveMtFileRequest())
+ ->setName($formattedName);
+ $response = $gapicClient->getAdaptiveMtFile($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtFile', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
}
/** @test */
- public function getSupportedLanguagesExceptionTest()
+ public function getAdaptiveMtFileExceptionTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -832,11 +1141,11 @@ public function getSupportedLanguagesExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
- $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
- $request = (new GetSupportedLanguagesRequest())
- ->setParent($formattedParent);
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $request = (new GetAdaptiveMtFileRequest())
+ ->setName($formattedName);
try {
- $gapicClient->getSupportedLanguages($request);
+ $gapicClient->getAdaptiveMtFile($request);
// If the $gapicClient method call did not throw, fail the test
$this->fail('Expected an ApiException, but no exception was thrown.');
} catch (ApiException $ex) {
@@ -849,7 +1158,415 @@ public function getSupportedLanguagesExceptionTest()
}
/** @test */
- public function listGlossariesTest()
+ public function getGlossaryTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name2 = 'name2-1052831874';
+ $entryCount = 811131134;
+ $displayName = 'displayName1615086568';
+ $expectedResponse = new Glossary();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setEntryCount($entryCount);
+ $expectedResponse->setDisplayName($displayName);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
+ $request = (new GetGlossaryRequest())
+ ->setName($formattedName);
+ $response = $gapicClient->getGlossary($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getGlossaryExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
+ $request = (new GetGlossaryRequest())
+ ->setName($formattedName);
+ try {
+ $gapicClient->getGlossary($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getSupportedLanguagesTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new SupportedLanguages();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $request = (new GetSupportedLanguagesRequest())
+ ->setParent($formattedParent);
+ $response = $gapicClient->getSupportedLanguages($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getSupportedLanguagesExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $request = (new GetSupportedLanguagesRequest())
+ ->setParent($formattedParent);
+ try {
+ $gapicClient->getSupportedLanguages($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function importAdaptiveMtFileTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new ImportAdaptiveMtFileResponse();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new ImportAdaptiveMtFileRequest())
+ ->setParent($formattedParent);
+ $response = $gapicClient->importAdaptiveMtFile($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ImportAdaptiveMtFile', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function importAdaptiveMtFileExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new ImportAdaptiveMtFileRequest())
+ ->setParent($formattedParent);
+ try {
+ $gapicClient->importAdaptiveMtFile($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtDatasetsTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $adaptiveMtDatasetsElement = new AdaptiveMtDataset();
+ $adaptiveMtDatasets = [
+ $adaptiveMtDatasetsElement,
+ ];
+ $expectedResponse = new ListAdaptiveMtDatasetsResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setAdaptiveMtDatasets($adaptiveMtDatasets);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $request = (new ListAdaptiveMtDatasetsRequest())
+ ->setParent($formattedParent);
+ $response = $gapicClient->listAdaptiveMtDatasets($request);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getAdaptiveMtDatasets()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtDatasets', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtDatasetsExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $request = (new ListAdaptiveMtDatasetsRequest())
+ ->setParent($formattedParent);
+ try {
+ $gapicClient->listAdaptiveMtDatasets($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtFilesTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $adaptiveMtFilesElement = new AdaptiveMtFile();
+ $adaptiveMtFiles = [
+ $adaptiveMtFilesElement,
+ ];
+ $expectedResponse = new ListAdaptiveMtFilesResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setAdaptiveMtFiles($adaptiveMtFiles);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new ListAdaptiveMtFilesRequest())
+ ->setParent($formattedParent);
+ $response = $gapicClient->listAdaptiveMtFiles($request);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getAdaptiveMtFiles()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtFiles', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtFilesExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $request = (new ListAdaptiveMtFilesRequest())
+ ->setParent($formattedParent);
+ try {
+ $gapicClient->listAdaptiveMtFiles($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtSentencesTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $adaptiveMtSentencesElement = new AdaptiveMtSentence();
+ $adaptiveMtSentences = [
+ $adaptiveMtSentencesElement,
+ ];
+ $expectedResponse = new ListAdaptiveMtSentencesResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setAdaptiveMtSentences($adaptiveMtSentences);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $request = (new ListAdaptiveMtSentencesRequest())
+ ->setParent($formattedParent);
+ $response = $gapicClient->listAdaptiveMtSentences($request);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getAdaptiveMtSentences()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtSentences', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtSentencesExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $request = (new ListAdaptiveMtSentencesRequest())
+ ->setParent($formattedParent);
+ try {
+ $gapicClient->listAdaptiveMtSentences($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listGlossariesTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -1071,98 +1788,39 @@ public function translateTextExceptionTest()
}
/** @test */
- public function batchTranslateDocumentAsyncTest()
+ public function adaptiveMtTranslateAsyncTest()
{
- $operationsTransport = $this->createTransport();
- $operationsClient = new OperationsClient([
- 'apiEndpoint' => '',
- 'transport' => $operationsTransport,
- 'credentials' => $this->createCredentials(),
- ]);
$transport = $this->createTransport();
$gapicClient = $this->createClient([
'transport' => $transport,
- 'operationsClient' => $operationsClient,
]);
$this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
// Mock response
- $incompleteOperation = new Operation();
- $incompleteOperation->setName('operations/batchTranslateDocumentTest');
- $incompleteOperation->setDone(false);
- $transport->addResponse($incompleteOperation);
- $totalPages = 396186871;
- $translatedPages = 1652747493;
- $failedPages = 2002254526;
- $totalBillablePages = 1292117569;
- $totalCharacters = 1368640955;
- $translatedCharacters = 1337326221;
- $failedCharacters = 1723028396;
- $totalBillableCharacters = 1242495501;
- $expectedResponse = new BatchTranslateDocumentResponse();
- $expectedResponse->setTotalPages($totalPages);
- $expectedResponse->setTranslatedPages($translatedPages);
- $expectedResponse->setFailedPages($failedPages);
- $expectedResponse->setTotalBillablePages($totalBillablePages);
- $expectedResponse->setTotalCharacters($totalCharacters);
- $expectedResponse->setTranslatedCharacters($translatedCharacters);
- $expectedResponse->setFailedCharacters($failedCharacters);
- $expectedResponse->setTotalBillableCharacters($totalBillableCharacters);
- $anyResponse = new Any();
- $anyResponse->setValue($expectedResponse->serializeToString());
- $completeOperation = new Operation();
- $completeOperation->setName('operations/batchTranslateDocumentTest');
- $completeOperation->setDone(true);
- $completeOperation->setResponse($anyResponse);
- $operationsTransport->addResponse($completeOperation);
+ $languageCode = 'languageCode-412800396';
+ $expectedResponse = new AdaptiveMtTranslateResponse();
+ $expectedResponse->setLanguageCode($languageCode);
+ $transport->addResponse($expectedResponse);
// Mock request
$formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
- $sourceLanguageCode = 'sourceLanguageCode1687263568';
- $targetLanguageCodes = [];
- $inputConfigs = [];
- $outputConfig = new BatchDocumentOutputConfig();
- $request = (new BatchTranslateDocumentRequest())
+ $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $content = [];
+ $request = (new AdaptiveMtTranslateRequest())
->setParent($formattedParent)
- ->setSourceLanguageCode($sourceLanguageCode)
- ->setTargetLanguageCodes($targetLanguageCodes)
- ->setInputConfigs($inputConfigs)
- ->setOutputConfig($outputConfig);
- $response = $gapicClient->batchTranslateDocumentAsync($request)->wait();
- $this->assertFalse($response->isDone());
- $this->assertNull($response->getResult());
- $apiRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($apiRequests));
- $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
- $this->assertSame(0, count($operationsRequestsEmpty));
- $actualApiFuncCall = $apiRequests[0]->getFuncCall();
- $actualApiRequestObject = $apiRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.translation.v3.TranslationService/BatchTranslateDocument', $actualApiFuncCall);
- $actualValue = $actualApiRequestObject->getParent();
+ ->setDataset($formattedDataset)
+ ->setContent($content);
+ $response = $gapicClient->adaptiveMtTranslateAsync($request)->wait();
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/AdaptiveMtTranslate', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
- $actualValue = $actualApiRequestObject->getSourceLanguageCode();
- $this->assertProtobufEquals($sourceLanguageCode, $actualValue);
- $actualValue = $actualApiRequestObject->getTargetLanguageCodes();
- $this->assertProtobufEquals($targetLanguageCodes, $actualValue);
- $actualValue = $actualApiRequestObject->getInputConfigs();
- $this->assertProtobufEquals($inputConfigs, $actualValue);
- $actualValue = $actualApiRequestObject->getOutputConfig();
- $this->assertProtobufEquals($outputConfig, $actualValue);
- $expectedOperationsRequestObject = new GetOperationRequest();
- $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest');
- $response->pollUntilComplete([
- 'initialPollDelayMillis' => 1,
- ]);
- $this->assertTrue($response->isDone());
- $this->assertEquals($expectedResponse, $response->getResult());
- $apiRequestsEmpty = $transport->popReceivedCalls();
- $this->assertSame(0, count($apiRequestsEmpty));
- $operationsRequests = $operationsTransport->popReceivedCalls();
- $this->assertSame(1, count($operationsRequests));
- $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
- $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
- $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
- $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
+ $actualValue = $actualRequestObject->getDataset();
+ $this->assertProtobufEquals($formattedDataset, $actualValue);
+ $actualValue = $actualRequestObject->getContent();
+ $this->assertProtobufEquals($content, $actualValue);
$this->assertTrue($transport->isExhausted());
- $this->assertTrue($operationsTransport->isExhausted());
}
}
diff --git a/Translate/tests/Unit/V3/TranslationServiceClientTest.php b/Translate/tests/Unit/V3/TranslationServiceClientTest.php
index da38d3bf29bc..bac8b44a949d 100644
--- a/Translate/tests/Unit/V3/TranslationServiceClientTest.php
+++ b/Translate/tests/Unit/V3/TranslationServiceClientTest.php
@@ -27,6 +27,10 @@
use Google\ApiCore\LongRunning\OperationsClient;
use Google\ApiCore\Testing\GeneratedTest;
use Google\ApiCore\Testing\MockTransport;
+use Google\Cloud\Translate\V3\AdaptiveMtDataset;
+use Google\Cloud\Translate\V3\AdaptiveMtFile;
+use Google\Cloud\Translate\V3\AdaptiveMtSentence;
+use Google\Cloud\Translate\V3\AdaptiveMtTranslateResponse;
use Google\Cloud\Translate\V3\BatchDocumentOutputConfig;
use Google\Cloud\Translate\V3\BatchTranslateDocumentResponse;
use Google\Cloud\Translate\V3\BatchTranslateResponse;
@@ -34,6 +38,10 @@
use Google\Cloud\Translate\V3\DetectLanguageResponse;
use Google\Cloud\Translate\V3\DocumentInputConfig;
use Google\Cloud\Translate\V3\Glossary;
+use Google\Cloud\Translate\V3\ImportAdaptiveMtFileResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtFilesResponse;
+use Google\Cloud\Translate\V3\ListAdaptiveMtSentencesResponse;
use Google\Cloud\Translate\V3\ListGlossariesResponse;
use Google\Cloud\Translate\V3\OutputConfig;
use Google\Cloud\Translate\V3\SupportedLanguages;
@@ -43,6 +51,7 @@
use Google\LongRunning\GetOperationRequest;
use Google\LongRunning\Operation;
use Google\Protobuf\Any;
+use Google\Protobuf\GPBEmpty;
use Google\Rpc\Code;
use stdClass;
@@ -74,6 +83,74 @@ private function createClient(array $options = [])
return new TranslationServiceClient($options);
}
+ /** @test */
+ public function adaptiveMtTranslateTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $languageCode = 'languageCode-412800396';
+ $expectedResponse = new AdaptiveMtTranslateResponse();
+ $expectedResponse->setLanguageCode($languageCode);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $content = [];
+ $response = $gapicClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/AdaptiveMtTranslate', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getDataset();
+ $this->assertProtobufEquals($formattedDataset, $actualValue);
+ $actualValue = $actualRequestObject->getContent();
+ $this->assertProtobufEquals($content, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function adaptiveMtTranslateExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $content = [];
+ try {
+ $gapicClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function batchTranslateDocumentTest()
{
@@ -362,6 +439,82 @@ public function batchTranslateTextExceptionTest()
$this->assertTrue($operationsTransport->isExhausted());
}
+ /** @test */
+ public function createAdaptiveMtDatasetTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name = 'name3373707';
+ $displayName = 'displayName1615086568';
+ $sourceLanguageCode = 'sourceLanguageCode1687263568';
+ $targetLanguageCode = 'targetLanguageCode1323228230';
+ $exampleCount = 1517063674;
+ $expectedResponse = new AdaptiveMtDataset();
+ $expectedResponse->setName($name);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setSourceLanguageCode($sourceLanguageCode);
+ $expectedResponse->setTargetLanguageCode($targetLanguageCode);
+ $expectedResponse->setExampleCount($exampleCount);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $adaptiveMtDataset = new AdaptiveMtDataset();
+ $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $adaptiveMtDataset->setName($adaptiveMtDatasetName);
+ $response = $gapicClient->createAdaptiveMtDataset($formattedParent, $adaptiveMtDataset);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/CreateAdaptiveMtDataset', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getAdaptiveMtDataset();
+ $this->assertProtobufEquals($adaptiveMtDataset, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function createAdaptiveMtDatasetExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $adaptiveMtDataset = new AdaptiveMtDataset();
+ $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $adaptiveMtDataset->setName($adaptiveMtDatasetName);
+ try {
+ $gapicClient->createAdaptiveMtDataset($formattedParent, $adaptiveMtDataset);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function createGlossaryTest()
{
@@ -493,6 +646,120 @@ public function createGlossaryExceptionTest()
$this->assertTrue($operationsTransport->isExhausted());
}
+ /** @test */
+ public function deleteAdaptiveMtDatasetTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $gapicClient->deleteAdaptiveMtDataset($formattedName);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtDataset', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteAdaptiveMtDatasetExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ try {
+ $gapicClient->deleteAdaptiveMtDataset($formattedName);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteAdaptiveMtFileTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $gapicClient->deleteAdaptiveMtFile($formattedName);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtFile', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function deleteAdaptiveMtFileExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ try {
+ $gapicClient->deleteAdaptiveMtFile($formattedName);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function deleteGlossaryTest()
{
@@ -671,7 +938,7 @@ public function detectLanguageExceptionTest()
}
/** @test */
- public function getGlossaryTest()
+ public function getAdaptiveMtDatasetTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -680,29 +947,33 @@ public function getGlossaryTest()
$this->assertTrue($transport->isExhausted());
// Mock response
$name2 = 'name2-1052831874';
- $entryCount = 811131134;
$displayName = 'displayName1615086568';
- $expectedResponse = new Glossary();
+ $sourceLanguageCode = 'sourceLanguageCode1687263568';
+ $targetLanguageCode = 'targetLanguageCode1323228230';
+ $exampleCount = 1517063674;
+ $expectedResponse = new AdaptiveMtDataset();
$expectedResponse->setName($name2);
- $expectedResponse->setEntryCount($entryCount);
$expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setSourceLanguageCode($sourceLanguageCode);
+ $expectedResponse->setTargetLanguageCode($targetLanguageCode);
+ $expectedResponse->setExampleCount($exampleCount);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
- $response = $gapicClient->getGlossary($formattedName);
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $response = $gapicClient->getAdaptiveMtDataset($formattedName);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall);
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtDataset', $actualFuncCall);
$actualValue = $actualRequestObject->getName();
$this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
}
/** @test */
- public function getGlossaryExceptionTest()
+ public function getAdaptiveMtDatasetExceptionTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -720,9 +991,9 @@ public function getGlossaryExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
- $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
+ $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
try {
- $gapicClient->getGlossary($formattedName);
+ $gapicClient->getAdaptiveMtDataset($formattedName);
// If the $gapicClient method call did not throw, fail the test
$this->fail('Expected an ApiException, but no exception was thrown.');
} catch (ApiException $ex) {
@@ -735,7 +1006,7 @@ public function getGlossaryExceptionTest()
}
/** @test */
- public function getSupportedLanguagesTest()
+ public function getAdaptiveMtFileTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -743,24 +1014,30 @@ public function getSupportedLanguagesTest()
]);
$this->assertTrue($transport->isExhausted());
// Mock response
- $expectedResponse = new SupportedLanguages();
+ $name2 = 'name2-1052831874';
+ $displayName = 'displayName1615086568';
+ $entryCount = 811131134;
+ $expectedResponse = new AdaptiveMtFile();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setEntryCount($entryCount);
$transport->addResponse($expectedResponse);
// Mock request
- $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
- $response = $gapicClient->getSupportedLanguages($formattedParent);
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $response = $gapicClient->getAdaptiveMtFile($formattedName);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
- $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall);
- $actualValue = $actualRequestObject->getParent();
- $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtFile', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
}
/** @test */
- public function getSupportedLanguagesExceptionTest()
+ public function getAdaptiveMtFileExceptionTest()
{
$transport = $this->createTransport();
$gapicClient = $this->createClient([
@@ -778,9 +1055,393 @@ public function getSupportedLanguagesExceptionTest()
], JSON_PRETTY_PRINT);
$transport->addResponse(null, $status);
// Mock request
- $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
try {
- $gapicClient->getSupportedLanguages($formattedParent);
+ $gapicClient->getAdaptiveMtFile($formattedName);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getGlossaryTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name2 = 'name2-1052831874';
+ $entryCount = 811131134;
+ $displayName = 'displayName1615086568';
+ $expectedResponse = new Glossary();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setEntryCount($entryCount);
+ $expectedResponse->setDisplayName($displayName);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
+ $response = $gapicClient->getGlossary($formattedName);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall);
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($formattedName, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getGlossaryExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]');
+ try {
+ $gapicClient->getGlossary($formattedName);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getSupportedLanguagesTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new SupportedLanguages();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $response = $gapicClient->getSupportedLanguages($formattedParent);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getSupportedLanguagesExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ try {
+ $gapicClient->getSupportedLanguages($formattedParent);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function importAdaptiveMtFileTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new ImportAdaptiveMtFileResponse();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $response = $gapicClient->importAdaptiveMtFile($formattedParent);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ImportAdaptiveMtFile', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function importAdaptiveMtFileExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ try {
+ $gapicClient->importAdaptiveMtFile($formattedParent);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtDatasetsTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $adaptiveMtDatasetsElement = new AdaptiveMtDataset();
+ $adaptiveMtDatasets = [
+ $adaptiveMtDatasetsElement,
+ ];
+ $expectedResponse = new ListAdaptiveMtDatasetsResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setAdaptiveMtDatasets($adaptiveMtDatasets);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ $response = $gapicClient->listAdaptiveMtDatasets($formattedParent);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getAdaptiveMtDatasets()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtDatasets', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtDatasetsExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
+ try {
+ $gapicClient->listAdaptiveMtDatasets($formattedParent);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtFilesTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $adaptiveMtFilesElement = new AdaptiveMtFile();
+ $adaptiveMtFiles = [
+ $adaptiveMtFilesElement,
+ ];
+ $expectedResponse = new ListAdaptiveMtFilesResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setAdaptiveMtFiles($adaptiveMtFiles);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ $response = $gapicClient->listAdaptiveMtFiles($formattedParent);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getAdaptiveMtFiles()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtFiles', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtFilesExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
+ try {
+ $gapicClient->listAdaptiveMtFiles($formattedParent);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtSentencesTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $adaptiveMtSentencesElement = new AdaptiveMtSentence();
+ $adaptiveMtSentences = [
+ $adaptiveMtSentencesElement,
+ ];
+ $expectedResponse = new ListAdaptiveMtSentencesResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setAdaptiveMtSentences($adaptiveMtSentences);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ $response = $gapicClient->listAdaptiveMtSentences($formattedParent);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getAdaptiveMtSentences()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtSentences', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function listAdaptiveMtSentencesExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]');
+ try {
+ $gapicClient->listAdaptiveMtSentences($formattedParent);
// If the $gapicClient method call did not throw, fail the test
$this->fail('Expected an ApiException, but no exception was thrown.');
} catch (ApiException $ex) {