Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE: diff PR #605

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 32 additions & 24 deletions src/Language/V1beta2/LanguageServiceClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand All @@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -443,20 +449,20 @@ 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();
* }
* ```
*
* @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.
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/PubSub/V1/PublisherClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/PubSub/V1/SubscriberClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
* ```
Expand Down