diff --git a/src/Language/V1beta2/LanguageServiceClient.php b/src/Language/V1beta2/LanguageServiceClient.php index 6a3d98151102..177f9ae7fb17 100644 --- a/src/Language/V1beta2/LanguageServiceClient.php +++ b/src/Language/V1beta2/LanguageServiceClient.php @@ -270,19 +270,19 @@ public function analyzeSentiment($document, $optionalArgs = []) * try { * $languageServiceClient = new LanguageServiceClient(); * $document = new Document(); - * $encodingType = EncodingType::NONE; - * $response = $languageServiceClient->analyzeEntities($document, $encodingType); + * $response = $languageServiceClient->analyzeEntities($document); * } finally { * $languageServiceClient->close(); * } * ``` * * @param Document $document Input document. - * @param int $encodingType The encoding type used by the API to calculate offsets. - * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @param array $optionalArgs { * Optional. * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @type \Google\GAX\RetrySettings $retrySettings * Retry settings to use for this call. If present, then * $timeoutMillis is ignored. @@ -296,11 +296,13 @@ public function analyzeSentiment($document, $optionalArgs = []) * @throws \Google\GAX\ApiException if the remote call fails * @experimental */ - public function analyzeEntities($document, $encodingType, $optionalArgs = []) + public function analyzeEntities($document, $optionalArgs = []) { $request = new AnalyzeEntitiesRequest(); $request->setDocument($document); - $request->setEncodingType($encodingType); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } $mergedSettings = $this->defaultCallSettings['analyzeEntities']->merge( new CallSettings($optionalArgs) @@ -327,19 +329,19 @@ public function analyzeEntities($document, $encodingType, $optionalArgs = []) * try { * $languageServiceClient = new LanguageServiceClient(); * $document = new Document(); - * $encodingType = EncodingType::NONE; - * $response = $languageServiceClient->analyzeEntitySentiment($document, $encodingType); + * $response = $languageServiceClient->analyzeEntitySentiment($document); * } finally { * $languageServiceClient->close(); * } * ``` * * @param Document $document Input document. - * @param int $encodingType The encoding type used by the API to calculate offsets. - * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @param array $optionalArgs { * Optional. * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @type \Google\GAX\RetrySettings $retrySettings * Retry settings to use for this call. If present, then * $timeoutMillis is ignored. @@ -353,11 +355,13 @@ public function analyzeEntities($document, $encodingType, $optionalArgs = []) * @throws \Google\GAX\ApiException if the remote call fails * @experimental */ - public function analyzeEntitySentiment($document, $encodingType, $optionalArgs = []) + public function analyzeEntitySentiment($document, $optionalArgs = []) { $request = new AnalyzeEntitySentimentRequest(); $request->setDocument($document); - $request->setEncodingType($encodingType); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } $mergedSettings = $this->defaultCallSettings['analyzeEntitySentiment']->merge( new CallSettings($optionalArgs) @@ -385,19 +389,19 @@ public function analyzeEntitySentiment($document, $encodingType, $optionalArgs = * try { * $languageServiceClient = new LanguageServiceClient(); * $document = new Document(); - * $encodingType = EncodingType::NONE; - * $response = $languageServiceClient->analyzeSyntax($document, $encodingType); + * $response = $languageServiceClient->analyzeSyntax($document); * } finally { * $languageServiceClient->close(); * } * ``` * * @param Document $document Input document. - * @param int $encodingType The encoding type used by the API to calculate offsets. - * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @param array $optionalArgs { * Optional. * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @type \Google\GAX\RetrySettings $retrySettings * Retry settings to use for this call. If present, then * $timeoutMillis is ignored. @@ -411,11 +415,13 @@ public function analyzeEntitySentiment($document, $encodingType, $optionalArgs = * @throws \Google\GAX\ApiException if the remote call fails * @experimental */ - public function analyzeSyntax($document, $encodingType, $optionalArgs = []) + public function analyzeSyntax($document, $optionalArgs = []) { $request = new AnalyzeSyntaxRequest(); $request->setDocument($document); - $request->setEncodingType($encodingType); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } $mergedSettings = $this->defaultCallSettings['analyzeSyntax']->merge( new CallSettings($optionalArgs) @@ -443,8 +449,7 @@ public function analyzeSyntax($document, $encodingType, $optionalArgs = []) * $languageServiceClient = new LanguageServiceClient(); * $document = new Document(); * $features = new Features(); - * $encodingType = EncodingType::NONE; - * $response = $languageServiceClient->annotateText($document, $features, $encodingType); + * $response = $languageServiceClient->annotateText($document, $features); * } finally { * $languageServiceClient->close(); * } @@ -452,11 +457,12 @@ public function analyzeSyntax($document, $encodingType, $optionalArgs = []) * * @param Document $document Input document. * @param Features $features The enabled features. - * @param int $encodingType The encoding type used by the API to calculate offsets. - * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @param array $optionalArgs { * Optional. * + * @type int $encodingType + * The encoding type used by the API to calculate offsets. + * For allowed values, use constants defined on {@see \Google\Cloud\Language\V1beta2\EncodingType} * @type \Google\GAX\RetrySettings $retrySettings * Retry settings to use for this call. If present, then * $timeoutMillis is ignored. @@ -470,12 +476,14 @@ public function analyzeSyntax($document, $encodingType, $optionalArgs = []) * @throws \Google\GAX\ApiException if the remote call fails * @experimental */ - public function annotateText($document, $features, $encodingType, $optionalArgs = []) + public function annotateText($document, $features, $optionalArgs = []) { $request = new AnnotateTextRequest(); $request->setDocument($document); $request->setFeatures($features); - $request->setEncodingType($encodingType); + if (isset($optionalArgs['encodingType'])) { + $request->setEncodingType($optionalArgs['encodingType']); + } $mergedSettings = $this->defaultCallSettings['annotateText']->merge( new CallSettings($optionalArgs) diff --git a/src/PubSub/V1/PublisherClient.php b/src/PubSub/V1/PublisherClient.php index cad46c40d935..5c5b9c481aa2 100644 --- a/src/PubSub/V1/PublisherClient.php +++ b/src/PubSub/V1/PublisherClient.php @@ -391,6 +391,8 @@ public function __construct($options = []) * @param array $optionalArgs { * Optional. * + * @type array $labels + * User labels. * @type \Google\GAX\RetrySettings $retrySettings * Retry settings to use for this call. If present, then * $timeoutMillis is ignored. @@ -408,6 +410,9 @@ public function createTopic($name, $optionalArgs = []) { $request = new Topic(); $request->setName($name); + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } $mergedSettings = $this->defaultCallSettings['createTopic']->merge( new CallSettings($optionalArgs) diff --git a/src/PubSub/V1/SubscriberClient.php b/src/PubSub/V1/SubscriberClient.php index b81cf7c0ad1d..1af17a76f09b 100644 --- a/src/PubSub/V1/SubscriberClient.php +++ b/src/PubSub/V1/SubscriberClient.php @@ -587,6 +587,8 @@ public function __construct($options = []) * of acknowledged messages, and thus configures how far back in time a `Seek` * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10 * minutes. + * @type array $labels + * User labels. * @type \Google\GAX\RetrySettings $retrySettings * Retry settings to use for this call. If present, then * $timeoutMillis is ignored. @@ -617,6 +619,9 @@ public function createSubscription($name, $topic, $optionalArgs = []) if (isset($optionalArgs['messageRetentionDuration'])) { $request->setMessageRetentionDuration($optionalArgs['messageRetentionDuration']); } + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } $mergedSettings = $this->defaultCallSettings['createSubscription']->merge( new CallSettings($optionalArgs) @@ -690,6 +695,10 @@ public function getSubscription($subscription, $optionalArgs = []) /** * Updates an existing subscription. Note that certain properties of a * subscription, such as its topic, are not modifiable. + * NOTE: The style guide requires body: "subscription" instead of body: "*". + * Keeping the latter for internal consistency in V1, however it should be + * corrected in V2. See + * https://cloud.google.com/apis/design/standard_methods#update for details. * * Sample code: * ```