Reference documentation and code samples for the Google Cloud Commerce Producer V1beta Client class CommerceTransactionClient.
Service Description: APIs related to managing resources that model commercial transactions.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Namespace
Google \ Cloud \ CommerceProducer \ V1beta \ ClientMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
options |
array|Google\ApiCore\Options\ClientOptions
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
Google\Auth\FetchAuthTokenInterface|Google\ApiCore\CredentialsWrapper
This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|Google\ApiCore\Transport\TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
↳ logger |
false|Psr\Log\LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
↳ universeDomain |
string
The service domain for the client. Defaults to 'googleapis.com'. |
cancelPrivateOffer
Cancels the target PrivateOffer.
The async variant is CommerceTransactionClient::cancelPrivateOfferAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\CancelPrivateOfferRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOffer |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\CancelPrivateOfferRequest;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\PrivateOffer;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::privateOfferName()} for help formatting this field.
*/
function cancel_private_offer_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new CancelPrivateOfferRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var PrivateOffer $response */
$response = $commerceTransactionClient->cancelPrivateOffer($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
{
$formattedName = CommerceTransactionClient::privateOfferName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]'
);
cancel_private_offer_sample($formattedName);
}
createPrivateOffer
Creates a new PrivateOffer in a given project and location.
The async variant is CommerceTransactionClient::createPrivateOfferAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\CreatePrivateOfferRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOffer |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\CreatePrivateOfferRequest;
use Google\Cloud\CommerceProducer\V1beta\PrivateOffer;
/**
* @param string $formattedParent Value for parent. Please see
* {@see CommerceTransactionClient::locationName()} for help formatting this field.
*/
function create_private_offer_sample(string $formattedParent): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$privateOffer = new PrivateOffer();
$request = (new CreatePrivateOfferRequest())
->setParent($formattedParent)
->setPrivateOffer($privateOffer);
// Call the API and handle any network failures.
try {
/** @var PrivateOffer $response */
$response = $commerceTransactionClient->createPrivateOffer($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
{
$formattedParent = CommerceTransactionClient::locationName('[PROJECT]', '[LOCATION]');
create_private_offer_sample($formattedParent);
}
createPrivateOfferDocument
Creates a new PrivateOfferDocument in a given project and location.
The async variant is CommerceTransactionClient::createPrivateOfferDocumentAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\CreatePrivateOfferDocumentRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\CreatePrivateOfferDocumentRequest;
use Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument;
use Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument\DocumentType;
/**
* @param string $formattedParent Value for parent. Please see
* {@see CommerceTransactionClient::privateOfferName()} for help formatting this field.
* @param int $privateOfferDocumentDocumentType The classification type of the document.
* Used to distinguish between different types of documents that may be
* attached to a private offer for different business purposes.
*/
function create_private_offer_document_sample(
string $formattedParent,
int $privateOfferDocumentDocumentType
): void {
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$privateOfferDocument = (new PrivateOfferDocument())
->setDocumentType($privateOfferDocumentDocumentType);
$request = (new CreatePrivateOfferDocumentRequest())
->setParent($formattedParent)
->setPrivateOfferDocument($privateOfferDocument);
// Call the API and handle any network failures.
try {
/** @var PrivateOfferDocument $response */
$response = $commerceTransactionClient->createPrivateOfferDocument($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
{
$formattedParent = CommerceTransactionClient::privateOfferName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]'
);
$privateOfferDocumentDocumentType = DocumentType::DOCUMENT_TYPE_UNSPECIFIED;
create_private_offer_document_sample($formattedParent, $privateOfferDocumentDocumentType);
}
deletePrivateOffer
Deletes the target PrivateOffer.
The async variant is CommerceTransactionClient::deletePrivateOfferAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\DeletePrivateOfferRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\DeletePrivateOfferRequest;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::privateOfferName()} for help formatting this field.
*/
function delete_private_offer_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new DeletePrivateOfferRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$commerceTransactionClient->deletePrivateOffer($request);
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 = CommerceTransactionClient::privateOfferName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]'
);
delete_private_offer_sample($formattedName);
}
deletePrivateOfferDocument
Deletes the target PrivateOfferDocument.
The async variant is CommerceTransactionClient::deletePrivateOfferDocumentAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\DeletePrivateOfferDocumentRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\DeletePrivateOfferDocumentRequest;
/**
* @param string $formattedName Name of the resource. Please see
* {@see CommerceTransactionClient::privateOfferDocumentName()} for help formatting this field.
*/
function delete_private_offer_document_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new DeletePrivateOfferDocumentRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$commerceTransactionClient->deletePrivateOfferDocument($request);
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 = CommerceTransactionClient::privateOfferDocumentName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]',
'[DOCUMENT]'
);
delete_private_offer_document_sample($formattedName);
}
getPrivateOffer
Gets details of a single PrivateOffer.
The async variant is CommerceTransactionClient::getPrivateOfferAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetPrivateOfferRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOffer |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\GetPrivateOfferRequest;
use Google\Cloud\CommerceProducer\V1beta\PrivateOffer;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::privateOfferName()} for help formatting this field.
*/
function get_private_offer_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new GetPrivateOfferRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var PrivateOffer $response */
$response = $commerceTransactionClient->getPrivateOffer($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
{
$formattedName = CommerceTransactionClient::privateOfferName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]'
);
get_private_offer_sample($formattedName);
}
getPrivateOfferDocument
Gets details of a single PrivateOfferDocument.
The async variant is CommerceTransactionClient::getPrivateOfferDocumentAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetPrivateOfferDocumentRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\GetPrivateOfferDocumentRequest;
use Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument;
/**
* @param string $formattedName Name of the resource. Please see
* {@see CommerceTransactionClient::privateOfferDocumentName()} for help formatting this field.
*/
function get_private_offer_document_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new GetPrivateOfferDocumentRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var PrivateOfferDocument $response */
$response = $commerceTransactionClient->getPrivateOfferDocument($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
{
$formattedName = CommerceTransactionClient::privateOfferDocumentName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]',
'[DOCUMENT]'
);
get_private_offer_document_sample($formattedName);
}
getService
Gets details of a single Service.
The async variant is CommerceTransactionClient::getServiceAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetServiceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\Service |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\GetServiceRequest;
use Google\Cloud\CommerceProducer\V1beta\Service;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::serviceName()} for help formatting this field.
*/
function get_service_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new GetServiceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Service $response */
$response = $commerceTransactionClient->getService($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
{
$formattedName = CommerceTransactionClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]');
get_service_sample($formattedName);
}
getSku
Gets details of a single Sku.
The async variant is CommerceTransactionClient::getSkuAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetSkuRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\Sku |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\GetSkuRequest;
use Google\Cloud\CommerceProducer\V1beta\Sku;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::skuName()} for help formatting this field.
*/
function get_sku_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new GetSkuRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Sku $response */
$response = $commerceTransactionClient->getSku($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
{
$formattedName = CommerceTransactionClient::skuName(
'[PROJECT]',
'[LOCATION]',
'[SERVICE]',
'[SKU]'
);
get_sku_sample($formattedName);
}
getSkuGroup
Gets details of a single SkuGroup.
The async variant is CommerceTransactionClient::getSkuGroupAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetSkuGroupRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\SkuGroup |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\GetSkuGroupRequest;
use Google\Cloud\CommerceProducer\V1beta\SkuGroup;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::skuGroupName()} for help formatting this field.
*/
function get_sku_group_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new GetSkuGroupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var SkuGroup $response */
$response = $commerceTransactionClient->getSkuGroup($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
{
$formattedName = CommerceTransactionClient::skuGroupName('[PROJECT]', '[LOCATION]', '[SKU_GROUP]');
get_sku_group_sample($formattedName);
}
getStandardOffer
Gets details of a single StandardOffer.
The async variant is CommerceTransactionClient::getStandardOfferAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetStandardOfferRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\StandardOffer |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\GetStandardOfferRequest;
use Google\Cloud\CommerceProducer\V1beta\StandardOffer;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::standardOfferName()} for help formatting this field.
*/
function get_standard_offer_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new GetStandardOfferRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var StandardOffer $response */
$response = $commerceTransactionClient->getStandardOffer($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
{
$formattedName = CommerceTransactionClient::standardOfferName(
'[PROJECT]',
'[LOCATION]',
'[SERVICE]',
'[STANDARD_OFFER]'
);
get_standard_offer_sample($formattedName);
}
listPrivateOfferDocuments
Lists PrivateOfferDocuments for the given parent.
The async variant is CommerceTransactionClient::listPrivateOfferDocumentsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListPrivateOfferDocumentsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\ListPrivateOfferDocumentsRequest;
use Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument;
/**
* @param string $formattedParent Parent value for ListPrivateOfferDocumentsRequest. Please see
* {@see CommerceTransactionClient::privateOfferName()} for help formatting this field.
*/
function list_private_offer_documents_sample(string $formattedParent): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new ListPrivateOfferDocumentsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $commerceTransactionClient->listPrivateOfferDocuments($request);
/** @var PrivateOfferDocument $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 = CommerceTransactionClient::privateOfferName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]'
);
list_private_offer_documents_sample($formattedParent);
}
listPrivateOffers
Lists PrivateOffers for the given parent.
The async variant is CommerceTransactionClient::listPrivateOffersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListPrivateOffersRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\ListPrivateOffersRequest;
use Google\Cloud\CommerceProducer\V1beta\PrivateOffer;
/**
* @param string $formattedParent Parent value for ListPrivateOffersRequest
* Please see {@see CommerceTransactionClient::locationName()} for help formatting this field.
*/
function list_private_offers_sample(string $formattedParent): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new ListPrivateOffersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $commerceTransactionClient->listPrivateOffers($request);
/** @var PrivateOffer $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 = CommerceTransactionClient::locationName('[PROJECT]', '[LOCATION]');
list_private_offers_sample($formattedParent);
}
listServices
Lists Services in a given project and location.
The async variant is CommerceTransactionClient::listServicesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListServicesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\ListServicesRequest;
use Google\Cloud\CommerceProducer\V1beta\Service;
/**
* @param string $formattedParent Parent value for ListServicesRequest
* Please see {@see CommerceTransactionClient::locationName()} for help formatting this field.
*/
function list_services_sample(string $formattedParent): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new ListServicesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $commerceTransactionClient->listServices($request);
/** @var Service $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 = CommerceTransactionClient::locationName('[PROJECT]', '[LOCATION]');
list_services_sample($formattedParent);
}
listSkuGroups
Lists SkuGroups for the given parent.
The async variant is CommerceTransactionClient::listSkuGroupsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListSkuGroupsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\ListSkuGroupsRequest;
use Google\Cloud\CommerceProducer\V1beta\SkuGroup;
/**
* @param string $formattedParent Parent value for ListSkuGroupsRequest
* Please see {@see CommerceTransactionClient::locationName()} for help formatting this field.
*/
function list_sku_groups_sample(string $formattedParent): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new ListSkuGroupsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $commerceTransactionClient->listSkuGroups($request);
/** @var SkuGroup $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 = CommerceTransactionClient::locationName('[PROJECT]', '[LOCATION]');
list_sku_groups_sample($formattedParent);
}
listSkus
Lists Skus for the given parent.
The async variant is CommerceTransactionClient::listSkusAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListSkusRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\ListSkusRequest;
use Google\Cloud\CommerceProducer\V1beta\Sku;
/**
* @param string $formattedParent Parent value for ListSkusRequest
* Please see {@see CommerceTransactionClient::serviceName()} for help formatting this field.
*/
function list_skus_sample(string $formattedParent): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new ListSkusRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $commerceTransactionClient->listSkus($request);
/** @var Sku $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 = CommerceTransactionClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]');
list_skus_sample($formattedParent);
}
listStandardOffers
Lists StandardOffers for the given parent.
The async variant is CommerceTransactionClient::listStandardOffersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListStandardOffersRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\ListStandardOffersRequest;
use Google\Cloud\CommerceProducer\V1beta\StandardOffer;
/**
* @param string $formattedParent Parent value for ListStandardOffersRequest
* Please see {@see CommerceTransactionClient::serviceName()} for help formatting this field.
*/
function list_standard_offers_sample(string $formattedParent): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new ListStandardOffersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $commerceTransactionClient->listStandardOffers($request);
/** @var StandardOffer $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 = CommerceTransactionClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]');
list_standard_offers_sample($formattedParent);
}
publishPrivateOffer
Publishes the target PrivateOffer.
The async variant is CommerceTransactionClient::publishPrivateOfferAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\PublishPrivateOfferRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOffer |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\PrivateOffer;
use Google\Cloud\CommerceProducer\V1beta\PublishPrivateOfferRequest;
/**
* @param string $formattedName Name of the resource
* Please see {@see CommerceTransactionClient::privateOfferName()} for help formatting this field.
*/
function publish_private_offer_sample(string $formattedName): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new PublishPrivateOfferRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var PrivateOffer $response */
$response = $commerceTransactionClient->publishPrivateOffer($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
{
$formattedName = CommerceTransactionClient::privateOfferName(
'[PROJECT]',
'[LOCATION]',
'[PRIVATE_OFFER]'
);
publish_private_offer_sample($formattedName);
}
resolveAmendmentTarget
Resolves the existing offer that must be amended when creating a new PrivateOffer. Use this method to determine the correct amendment target before creating or publishing an offer.
The async variant is CommerceTransactionClient::resolveAmendmentTargetAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ResolveAmendmentTargetRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\ResolveAmendmentTargetResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\ResolveAmendmentTargetRequest;
use Google\Cloud\CommerceProducer\V1beta\ResolveAmendmentTargetResponse;
/**
* @param string $formattedParent Parent value for ResolveAmendmentTargetRequest
* Please see {@see CommerceTransactionClient::locationName()} for help formatting this field.
* @param string $formattedTargetBillingAccount The customer's billing account targeted by the offer. This is the
* billing account for which the new private offer will be created on. Format:
* billingAccounts/{billing_account}. Please see
* {@see CommerceTransactionClient::billingAccountName()} for help formatting this field.
* @param string $formattedBaseStandardOffer The base standard offer that the private offer will be based on.
* Format:
* projects/{project}/locations/{location}/services/{service}/standardOffers/{standard_offer}. Please see
* {@see CommerceTransactionClient::standardOfferName()} for help formatting this field.
*/
function resolve_amendment_target_sample(
string $formattedParent,
string $formattedTargetBillingAccount,
string $formattedBaseStandardOffer
): void {
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = (new ResolveAmendmentTargetRequest())
->setParent($formattedParent)
->setTargetBillingAccount($formattedTargetBillingAccount)
->setBaseStandardOffer($formattedBaseStandardOffer);
// Call the API and handle any network failures.
try {
/** @var ResolveAmendmentTargetResponse $response */
$response = $commerceTransactionClient->resolveAmendmentTarget($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
{
$formattedParent = CommerceTransactionClient::locationName('[PROJECT]', '[LOCATION]');
$formattedTargetBillingAccount = CommerceTransactionClient::billingAccountName('[BILLING_ACCOUNT]');
$formattedBaseStandardOffer = CommerceTransactionClient::standardOfferName(
'[PROJECT]',
'[LOCATION]',
'[SERVICE]',
'[STANDARD_OFFER]'
);
resolve_amendment_target_sample(
$formattedParent,
$formattedTargetBillingAccount,
$formattedBaseStandardOffer
);
}
updatePrivateOffer
Updates the target PrivateOffer.
The async variant is CommerceTransactionClient::updatePrivateOfferAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\UpdatePrivateOfferRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOffer |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\PrivateOffer;
use Google\Cloud\CommerceProducer\V1beta\UpdatePrivateOfferRequest;
/**
* 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 update_private_offer_sample(): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$privateOffer = new PrivateOffer();
$request = (new UpdatePrivateOfferRequest())
->setPrivateOffer($privateOffer);
// Call the API and handle any network failures.
try {
/** @var PrivateOffer $response */
$response = $commerceTransactionClient->updatePrivateOffer($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updatePrivateOfferDocument
Updates the target PrivateOfferDocument.
The async variant is CommerceTransactionClient::updatePrivateOfferDocumentAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\UpdatePrivateOfferDocumentRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument;
use Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument\DocumentType;
use Google\Cloud\CommerceProducer\V1beta\UpdatePrivateOfferDocumentRequest;
/**
* @param int $privateOfferDocumentDocumentType The classification type of the document.
* Used to distinguish between different types of documents that may be
* attached to a private offer for different business purposes.
*/
function update_private_offer_document_sample(int $privateOfferDocumentDocumentType): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$privateOfferDocument = (new PrivateOfferDocument())
->setDocumentType($privateOfferDocumentDocumentType);
$request = (new UpdatePrivateOfferDocumentRequest())
->setPrivateOfferDocument($privateOfferDocument);
// Call the API and handle any network failures.
try {
/** @var PrivateOfferDocument $response */
$response = $commerceTransactionClient->updatePrivateOfferDocument($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
{
$privateOfferDocumentDocumentType = DocumentType::DOCUMENT_TYPE_UNSPECIFIED;
update_private_offer_document_sample($privateOfferDocumentDocumentType);
}
getLocation
Gets information about a location.
The async variant is CommerceTransactionClient::getLocationAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Location\Location |
|
use Google\ApiCore\ApiException;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
/**
* 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 get_location_sample(): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $commerceTransactionClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in
the ListLocationsRequest.name field: *
Global locations: If name is empty, the method lists the
public locations available to all projects. * Project-specific
locations: If name follows the format
projects/{project}, the method lists locations visible to that
specific project. This includes public, private, or other
project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is
passed as the name field. For direct service calls, the resource
name is
incorporated into the request path based on the specific service
implementation and version.
The async variant is CommerceTransactionClient::listLocationsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\CommerceProducer\V1beta\Client\CommerceTransactionClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
/**
* 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 list_locations_sample(): void
{
// Create a client.
$commerceTransactionClient = new CommerceTransactionClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $commerceTransactionClient->listLocations($request);
/** @var Location $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());
}
}
cancelPrivateOfferAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\CancelPrivateOfferRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOffer> |
|
createPrivateOfferAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\CreatePrivateOfferRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOffer> |
|
createPrivateOfferDocumentAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\CreatePrivateOfferDocumentRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument> |
|
deletePrivateOfferAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\DeletePrivateOfferRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<void> |
|
deletePrivateOfferDocumentAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\DeletePrivateOfferDocumentRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<void> |
|
getPrivateOfferAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetPrivateOfferRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOffer> |
|
getPrivateOfferDocumentAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetPrivateOfferDocumentRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument> |
|
getServiceAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetServiceRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\Service> |
|
getSkuAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetSkuRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\Sku> |
|
getSkuGroupAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetSkuGroupRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\SkuGroup> |
|
getStandardOfferAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\GetStandardOfferRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\StandardOffer> |
|
listPrivateOfferDocumentsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListPrivateOfferDocumentsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listPrivateOffersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListPrivateOffersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listServicesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListServicesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listSkuGroupsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListSkuGroupsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listSkusAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListSkusRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listStandardOffersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ListStandardOffersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
publishPrivateOfferAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\PublishPrivateOfferRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOffer> |
|
resolveAmendmentTargetAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\ResolveAmendmentTargetRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\ResolveAmendmentTargetResponse> |
|
updatePrivateOfferAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\UpdatePrivateOfferRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOffer> |
|
updatePrivateOfferDocumentAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\CommerceProducer\V1beta\UpdatePrivateOfferDocumentRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\CommerceProducer\V1beta\PrivateOfferDocument> |
|
getLocationAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location> |
|
listLocationsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
static::billingAccountName
Formats a string containing the fully-qualified path to represent a billing_account resource.
| Parameter | |
|---|---|
| Name | Description |
billingAccount |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted billing_account resource. |
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted location resource. |
static::privateOfferName
Formats a string containing the fully-qualified path to represent a private_offer resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
privateOffer |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted private_offer resource. |
static::privateOfferDocumentName
Formats a string containing the fully-qualified path to represent a private_offer_document resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
privateOffer |
string
|
document |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted private_offer_document resource. |
static::serviceName
Formats a string containing the fully-qualified path to represent a service resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
service |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted service resource. |
static::skuName
Formats a string containing the fully-qualified path to represent a sku resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
service |
string
|
sku |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted sku resource. |
static::skuGroupName
Formats a string containing the fully-qualified path to represent a sku_group resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
skuGroup |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted sku_group resource. |
static::standardOfferName
Formats a string containing the fully-qualified path to represent a standard_offer resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
service |
string
|
standardOffer |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted standard_offer resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- billingAccount: billingAccounts/{billing_account}
- location: projects/{project}/locations/{location}
- privateOffer: projects/{project}/locations/{location}/privateOffers/{private_offer}
- privateOfferDocument: projects/{project}/locations/{location}/privateOffers/{private_offer}/documents/{document}
- service: projects/{project}/locations/{location}/services/{service}
- sku: projects/{project}/locations/{location}/services/{service}/skus/{sku}
- skuGroup: projects/{project}/locations/{location}/skuGroups/{sku_group}
- standardOffer: projects/{project}/locations/{location}/services/{service}/standardOffers/{standard_offer}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
| Parameters | |
|---|---|
| Name | Description |
formattedName |
string
The formatted name string |
template |
?string
Optional name of template to match |
| Returns | |
|---|---|
| Type | Description |
array |
An associative array from name component IDs to component values. |