Skip to content

Commit

Permalink
feat: Add GroundedGenerationService API (#7781)
Browse files Browse the repository at this point in the history
feat: Add AdvancedCompleteQuery API
feat: Add lite search API to allow public website search with API key
feat: Add Sitemap APIs to preview channel
feat: Support search personalization to preview channel
feat: Support natural language understanding search
feat: Add BillingEstimation in data store
feat: Support Google Workspace search
feat: Support advanced boost search
feat: Add one_box_page_size on search
feat: support query regex in control match rules
docs: deprecate extractive_answers in answer generation
docs: deprecate asynchronous mode in answer generation
docs: keep the API doc up-to-date with recent changes
PiperOrigin-RevId: 691212731
Source-Link: googleapis/googleapis@e6b6ff9
Source-Link: googleapis/googleapis-gen@67144fd
Copy-Tag: eyJwIjoiRXZlbnRhcmNQdWJsaXNoaW5nLy5Pd2xCb3QueWFtbCIsImgiOiI2NzE0NGZkNDNjNWEzZTE2NDQxMGIzNjE3ZTU3NTJmMmUwNjZlYzI1In0=
  • Loading branch information
gcf-owl-bot[bot] authored Oct 31, 2024
1 parent 4d95d21 commit ab36815
Show file tree
Hide file tree
Showing 13 changed files with 1,040 additions and 8 deletions.
Binary file added EventarcPublishing/metadata/V1/CloudEvent.php
Binary file not shown.
Binary file modified EventarcPublishing/metadata/V1/Publisher.php
Binary file not shown.
71 changes: 71 additions & 0 deletions EventarcPublishing/samples/V1/PublisherClient/publish.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START eventarcpublishing_v1_generated_Publisher_Publish_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\Publishing\V1\Client\PublisherClient;
use Google\Cloud\Eventarc\Publishing\V1\PublishRequest;
use Google\Cloud\Eventarc\Publishing\V1\PublishResponse;

/**
* Publish events to a message bus.
*
* @param string $messageBus The full name of the message bus to publish events to. Format:
* `projects/{project}/locations/{location}/messageBuses/{messageBus}`.
*/
function publish_sample(string $messageBus): void
{
// Create a client.
$publisherClient = new PublisherClient();

// Prepare the request message.
$request = (new PublishRequest())
->setMessageBus($messageBus);

// Call the API and handle any network failures.
try {
/** @var PublishResponse $response */
$response = $publisherClient->publish($request);
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
{
$messageBus = '[MESSAGE_BUS]';

publish_sample($messageBus);
}
// [END eventarcpublishing_v1_generated_Publisher_Publish_sync]
29 changes: 29 additions & 0 deletions EventarcPublishing/src/V1/Client/PublisherClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
use Google\Cloud\Eventarc\Publishing\V1\PublishChannelConnectionEventsResponse;
use Google\Cloud\Eventarc\Publishing\V1\PublishEventsRequest;
use Google\Cloud\Eventarc\Publishing\V1\PublishEventsResponse;
use Google\Cloud\Eventarc\Publishing\V1\PublishRequest;
use Google\Cloud\Eventarc\Publishing\V1\PublishResponse;
use Google\Protobuf\Any;
use GuzzleHttp\Promise\PromiseInterface;

Expand Down Expand Up @@ -67,6 +69,7 @@
* This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods.
*
* @method PromiseInterface publishAsync(PublishRequest $request, array $optionalArgs = [])
* @method PromiseInterface publishChannelConnectionEventsAsync(PublishChannelConnectionEventsRequest $request, array $optionalArgs = [])
* @method PromiseInterface publishEventsAsync(PublishEventsRequest $request, array $optionalArgs = [])
*/
Expand Down Expand Up @@ -186,6 +189,32 @@ public function __call($method, $args)
return call_user_func_array([$this, 'startAsyncCall'], $args);
}

/**
* Publish events to a message bus.
*
* The async variant is {@see PublisherClient::publishAsync()} .
*
* @example samples/V1/PublisherClient/publish.php
*
* @param PublishRequest $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 PublishResponse
*
* @throws ApiException Thrown if the API call fails.
*/
public function publish(PublishRequest $request, array $callOptions = []): PublishResponse
{
return $this->startApiCall('Publish', $request, $callOptions)->wait();
}

/**
* Publish events to a ChannelConnection in a partner's project.
*
Expand Down
Loading

0 comments on commit ab36815

Please sign in to comment.