diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 9677c42590a3..b4442c85f378 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -1294,7 +1294,7 @@ "library_type": "GAPIC_AUTO", "api_shortname": "merchantapi" }, - "ShoppingMerchantDatasources": { + "ShoppingMerchantDataSources": { "language": "php", "distribution_name": "google/shopping-merchant-datasources", "release_level": "preview", diff --git a/ShoppingMerchantDataSources/.OwlBot.yaml b/ShoppingMerchantDataSources/.OwlBot.yaml new file mode 100644 index 000000000000..662fb443fe39 --- /dev/null +++ b/ShoppingMerchantDataSources/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/shopping/merchant/datasources/(v1beta)/.*-php/(.*) + dest: /owl-bot-staging/ShoppingMerchantDataSources/$1/$2 +api-name: ShoppingMerchantDataSources diff --git a/ShoppingMerchantDatasources/.gitattributes b/ShoppingMerchantDataSources/.gitattributes similarity index 100% rename from ShoppingMerchantDatasources/.gitattributes rename to ShoppingMerchantDataSources/.gitattributes diff --git a/ShoppingMerchantDatasources/.github/pull_request_template.md b/ShoppingMerchantDataSources/.github/pull_request_template.md similarity index 88% rename from ShoppingMerchantDatasources/.github/pull_request_template.md rename to ShoppingMerchantDataSources/.github/pull_request_template.md index 508d9567d793..03185d83e6da 100644 --- a/ShoppingMerchantDatasources/.github/pull_request_template.md +++ b/ShoppingMerchantDataSources/.github/pull_request_template.md @@ -14,7 +14,7 @@ $ git clone git@github.com:googleapis/google-cloud-php.git ``` * Move your changes into the correct location in that library. Library code -belongs in `ShoppingMerchantDatasources/src`, and tests in `ShoppingMerchantDatasources/tests`. +belongs in `ShoppingMerchantDataSources/src`, and tests in `ShoppingMerchantDataSources/tests`. * Push the changes in a new branch to a fork, and open a new pull request [here](https://github.com/googleapis/google-cloud-php). diff --git a/ShoppingMerchantDatasources/CONTRIBUTING.md b/ShoppingMerchantDataSources/CONTRIBUTING.md similarity index 100% rename from ShoppingMerchantDatasources/CONTRIBUTING.md rename to ShoppingMerchantDataSources/CONTRIBUTING.md diff --git a/ShoppingMerchantDatasources/LICENSE b/ShoppingMerchantDataSources/LICENSE similarity index 100% rename from ShoppingMerchantDatasources/LICENSE rename to ShoppingMerchantDataSources/LICENSE diff --git a/ShoppingMerchantDatasources/README.md b/ShoppingMerchantDataSources/README.md similarity index 94% rename from ShoppingMerchantDatasources/README.md rename to ShoppingMerchantDataSources/README.md index 215b6d98a7d6..56dfac0a1fe8 100644 --- a/ShoppingMerchantDatasources/README.md +++ b/ShoppingMerchantDataSources/README.md @@ -1,6 +1,6 @@ -# Google Shopping Merchant Datasources for PHP +# Google Shopping Merchant DataSources for PHP -> Idiomatic PHP client for [Google Shopping Merchant Datasources](https://developers.google.com/merchant/api). +> Idiomatic PHP client for [Google Shopping Merchant DataSources](https://developers.google.com/merchant/api). [![Latest Stable Version](https://poser.pugx.org/google/shopping-merchant-datasources/v/stable)](https://packagist.org/packages/google/shopping-merchant-datasources) [![Packagist](https://img.shields.io/packagist/dm/google/shopping-merchant-datasources.svg)](https://packagist.org/packages/google/shopping-merchant-datasources) diff --git a/ShoppingMerchantDatasources/VERSION b/ShoppingMerchantDataSources/VERSION similarity index 100% rename from ShoppingMerchantDatasources/VERSION rename to ShoppingMerchantDataSources/VERSION diff --git a/ShoppingMerchantDatasources/composer.json b/ShoppingMerchantDataSources/composer.json similarity index 83% rename from ShoppingMerchantDatasources/composer.json rename to ShoppingMerchantDataSources/composer.json index 691b330a9b7d..1f5a417b901d 100644 --- a/ShoppingMerchantDatasources/composer.json +++ b/ShoppingMerchantDataSources/composer.json @@ -1,18 +1,18 @@ { "name": "google/shopping-merchant-datasources", - "description": "Google Shopping Merchant Datasources Client for PHP", + "description": "Google Shopping Merchant DataSources Client for PHP", "license": "Apache-2.0", "minimum-stability": "stable", "autoload": { "psr-4": { - "Google\\Shopping\\Merchant\\Datasources\\": "src", + "Google\\Shopping\\Merchant\\DataSources\\": "src", "GPBMetadata\\Google\\Shopping\\Merchant\\Datasources\\": "metadata" } }, "extra": { "component": { "id": "shopping-merchant-datasources", - "path": "ShoppingMerchantDatasources", + "path": "ShoppingMerchantDataSources", "target": "googleapis/php-shopping-merchant-datasources" } }, diff --git a/ShoppingMerchantDatasources/metadata/V1Beta/Datasources.php b/ShoppingMerchantDataSources/metadata/V1Beta/Datasources.php similarity index 95% rename from ShoppingMerchantDatasources/metadata/V1Beta/Datasources.php rename to ShoppingMerchantDataSources/metadata/V1Beta/Datasources.php index 964ff3530c83..df82b6e6308a 100644 Binary files a/ShoppingMerchantDatasources/metadata/V1Beta/Datasources.php and b/ShoppingMerchantDataSources/metadata/V1Beta/Datasources.php differ diff --git a/ShoppingMerchantDatasources/metadata/V1Beta/Datasourcetypes.php b/ShoppingMerchantDataSources/metadata/V1Beta/Datasourcetypes.php similarity index 63% rename from ShoppingMerchantDatasources/metadata/V1Beta/Datasourcetypes.php rename to ShoppingMerchantDataSources/metadata/V1Beta/Datasourcetypes.php index 6315bdf7b252..e1e5e2992914 100644 Binary files a/ShoppingMerchantDatasources/metadata/V1Beta/Datasourcetypes.php and b/ShoppingMerchantDataSources/metadata/V1Beta/Datasourcetypes.php differ diff --git a/ShoppingMerchantDatasources/metadata/V1Beta/Fileinputs.php b/ShoppingMerchantDataSources/metadata/V1Beta/Fileinputs.php similarity index 89% rename from ShoppingMerchantDatasources/metadata/V1Beta/Fileinputs.php rename to ShoppingMerchantDataSources/metadata/V1Beta/Fileinputs.php index 22eaf1d0d76a..735341eff2aa 100644 Binary files a/ShoppingMerchantDatasources/metadata/V1Beta/Fileinputs.php and b/ShoppingMerchantDataSources/metadata/V1Beta/Fileinputs.php differ diff --git a/ShoppingMerchantDataSources/metadata/V1Beta/Fileuploads.php b/ShoppingMerchantDataSources/metadata/V1Beta/Fileuploads.php new file mode 100644 index 000000000000..e68bcb591fdc Binary files /dev/null and b/ShoppingMerchantDataSources/metadata/V1Beta/Fileuploads.php differ diff --git a/ShoppingMerchantDatasources/owlbot.py b/ShoppingMerchantDataSources/owlbot.py similarity index 96% rename from ShoppingMerchantDatasources/owlbot.py rename to ShoppingMerchantDataSources/owlbot.py index 161b2926b9bd..881d51374bf2 100644 --- a/ShoppingMerchantDatasources/owlbot.py +++ b/ShoppingMerchantDataSources/owlbot.py @@ -24,7 +24,7 @@ logging.basicConfig(level=logging.DEBUG) -src = Path(f"../{php.STAGING_DIR}/ShoppingMerchantDatasources").resolve() +src = Path(f"../{php.STAGING_DIR}/ShoppingMerchantDataSources").resolve() dest = Path().resolve() # Added so that we can pass copy_excludes in the owlbot_main() call diff --git a/ShoppingMerchantDatasources/phpunit.xml.dist b/ShoppingMerchantDataSources/phpunit.xml.dist similarity index 100% rename from ShoppingMerchantDatasources/phpunit.xml.dist rename to ShoppingMerchantDataSources/phpunit.xml.dist diff --git a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/create_data_source.php b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/create_data_source.php similarity index 91% rename from ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/create_data_source.php rename to ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/create_data_source.php index 51916fb14a3f..40a2e5b7b35d 100644 --- a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/create_data_source.php +++ b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/create_data_source.php @@ -24,11 +24,11 @@ // [START merchantapi_v1beta_generated_DataSourcesService_CreateDataSource_sync] use Google\ApiCore\ApiException; -use Google\Shopping\Merchant\Datasources\V1beta\Client\DataSourcesServiceClient; -use Google\Shopping\Merchant\Datasources\V1beta\CreateDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\DataSource; -use Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource; -use Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource\Channel; +use Google\Shopping\Merchant\DataSources\V1beta\Client\DataSourcesServiceClient; +use Google\Shopping\Merchant\DataSources\V1beta\CreateDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\DataSource; +use Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource; +use Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\Channel; /** * Creates the new data source configuration for the given account. diff --git a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/delete_data_source.php b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/delete_data_source.php similarity index 95% rename from ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/delete_data_source.php rename to ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/delete_data_source.php index ad4fc6aa88af..b70696e5b115 100644 --- a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/delete_data_source.php +++ b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/delete_data_source.php @@ -24,8 +24,8 @@ // [START merchantapi_v1beta_generated_DataSourcesService_DeleteDataSource_sync] use Google\ApiCore\ApiException; -use Google\Shopping\Merchant\Datasources\V1beta\Client\DataSourcesServiceClient; -use Google\Shopping\Merchant\Datasources\V1beta\DeleteDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\Client\DataSourcesServiceClient; +use Google\Shopping\Merchant\DataSources\V1beta\DeleteDataSourceRequest; /** * Deletes a data source from your Merchant Center account. diff --git a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/fetch_data_source.php b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/fetch_data_source.php similarity index 95% rename from ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/fetch_data_source.php rename to ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/fetch_data_source.php index c52db577e25e..4d8526c8d385 100644 --- a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/fetch_data_source.php +++ b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/fetch_data_source.php @@ -24,8 +24,8 @@ // [START merchantapi_v1beta_generated_DataSourcesService_FetchDataSource_sync] use Google\ApiCore\ApiException; -use Google\Shopping\Merchant\Datasources\V1beta\Client\DataSourcesServiceClient; -use Google\Shopping\Merchant\Datasources\V1beta\FetchDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\Client\DataSourcesServiceClient; +use Google\Shopping\Merchant\DataSources\V1beta\FetchDataSourceRequest; /** * Performs the data fetch immediately (even outside fetch schedule) on a diff --git a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/get_data_source.php b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/get_data_source.php similarity index 93% rename from ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/get_data_source.php rename to ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/get_data_source.php index f52a2378a767..d4514aa22944 100644 --- a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/get_data_source.php +++ b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/get_data_source.php @@ -24,9 +24,9 @@ // [START merchantapi_v1beta_generated_DataSourcesService_GetDataSource_sync] use Google\ApiCore\ApiException; -use Google\Shopping\Merchant\Datasources\V1beta\Client\DataSourcesServiceClient; -use Google\Shopping\Merchant\Datasources\V1beta\DataSource; -use Google\Shopping\Merchant\Datasources\V1beta\GetDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\Client\DataSourcesServiceClient; +use Google\Shopping\Merchant\DataSources\V1beta\DataSource; +use Google\Shopping\Merchant\DataSources\V1beta\GetDataSourceRequest; /** * Retrieves the data source configuration for the given account. diff --git a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/list_data_sources.php b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/list_data_sources.php similarity index 93% rename from ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/list_data_sources.php rename to ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/list_data_sources.php index 0ce83d697da2..da0c2556aa5c 100644 --- a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/list_data_sources.php +++ b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/list_data_sources.php @@ -25,9 +25,9 @@ // [START merchantapi_v1beta_generated_DataSourcesService_ListDataSources_sync] use Google\ApiCore\ApiException; use Google\ApiCore\PagedListResponse; -use Google\Shopping\Merchant\Datasources\V1beta\Client\DataSourcesServiceClient; -use Google\Shopping\Merchant\Datasources\V1beta\DataSource; -use Google\Shopping\Merchant\Datasources\V1beta\ListDataSourcesRequest; +use Google\Shopping\Merchant\DataSources\V1beta\Client\DataSourcesServiceClient; +use Google\Shopping\Merchant\DataSources\V1beta\DataSource; +use Google\Shopping\Merchant\DataSources\V1beta\ListDataSourcesRequest; /** * Lists the configurations for data sources for the given account. diff --git a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/update_data_source.php b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/update_data_source.php similarity index 90% rename from ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/update_data_source.php rename to ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/update_data_source.php index 7d357f9641e4..6594714b08bd 100644 --- a/ShoppingMerchantDatasources/samples/V1beta/DataSourcesServiceClient/update_data_source.php +++ b/ShoppingMerchantDataSources/samples/V1beta/DataSourcesServiceClient/update_data_source.php @@ -25,11 +25,11 @@ // [START merchantapi_v1beta_generated_DataSourcesService_UpdateDataSource_sync] use Google\ApiCore\ApiException; use Google\Protobuf\FieldMask; -use Google\Shopping\Merchant\Datasources\V1beta\Client\DataSourcesServiceClient; -use Google\Shopping\Merchant\Datasources\V1beta\DataSource; -use Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource; -use Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource\Channel; -use Google\Shopping\Merchant\Datasources\V1beta\UpdateDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\Client\DataSourcesServiceClient; +use Google\Shopping\Merchant\DataSources\V1beta\DataSource; +use Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource; +use Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\Channel; +use Google\Shopping\Merchant\DataSources\V1beta\UpdateDataSourceRequest; /** * Updates the existing data source configuration. The fields that are diff --git a/ShoppingMerchantDataSources/samples/V1beta/FileUploadsServiceClient/get_file_upload.php b/ShoppingMerchantDataSources/samples/V1beta/FileUploadsServiceClient/get_file_upload.php new file mode 100644 index 000000000000..87a7d91b5aa2 --- /dev/null +++ b/ShoppingMerchantDataSources/samples/V1beta/FileUploadsServiceClient/get_file_upload.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var FileUpload $response */ + $response = $fileUploadsServiceClient->getFileUpload($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 = FileUploadsServiceClient::fileUploadName( + '[ACCOUNT]', + '[DATASOURCE]', + '[FILEUPLOAD]' + ); + + get_file_upload_sample($formattedName); +} +// [END merchantapi_v1beta_generated_FileUploadsService_GetFileUpload_sync] diff --git a/ShoppingMerchantDatasources/src/V1beta/Client/DataSourcesServiceClient.php b/ShoppingMerchantDataSources/src/V1beta/Client/DataSourcesServiceClient.php similarity index 97% rename from ShoppingMerchantDatasources/src/V1beta/Client/DataSourcesServiceClient.php rename to ShoppingMerchantDataSources/src/V1beta/Client/DataSourcesServiceClient.php index 516734376895..bad560e26e0d 100644 --- a/ShoppingMerchantDatasources/src/V1beta/Client/DataSourcesServiceClient.php +++ b/ShoppingMerchantDataSources/src/V1beta/Client/DataSourcesServiceClient.php @@ -24,7 +24,7 @@ * @experimental */ -namespace Google\Shopping\Merchant\Datasources\V1beta\Client; +namespace Google\Shopping\Merchant\DataSources\V1beta\Client; use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; @@ -35,13 +35,13 @@ use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; use Google\Auth\FetchAuthTokenInterface; -use Google\Shopping\Merchant\Datasources\V1beta\CreateDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\DataSource; -use Google\Shopping\Merchant\Datasources\V1beta\DeleteDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\FetchDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\GetDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\ListDataSourcesRequest; -use Google\Shopping\Merchant\Datasources\V1beta\UpdateDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\CreateDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\DataSource; +use Google\Shopping\Merchant\DataSources\V1beta\DeleteDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\FetchDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\GetDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\ListDataSourcesRequest; +use Google\Shopping\Merchant\DataSources\V1beta\UpdateDataSourceRequest; use GuzzleHttp\Promise\PromiseInterface; /** diff --git a/ShoppingMerchantDataSources/src/V1beta/Client/FileUploadsServiceClient.php b/ShoppingMerchantDataSources/src/V1beta/Client/FileUploadsServiceClient.php new file mode 100644 index 000000000000..7c3acfc4a6b6 --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/Client/FileUploadsServiceClient.php @@ -0,0 +1,250 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/file_uploads_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/file_uploads_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/file_uploads_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/file_uploads_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a file_upload + * resource. + * + * @param string $account + * @param string $datasource + * @param string $fileupload + * + * @return string The formatted file_upload resource. + * + * @experimental + */ + public static function fileUploadName(string $account, string $datasource, string $fileupload): string + { + return self::getPathTemplate('fileUpload')->render([ + 'account' => $account, + 'datasource' => $datasource, + 'fileupload' => $fileupload, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - fileUpload: accounts/{account}/dataSources/{datasource}/fileUploads/{fileupload} + * + * 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. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * + * @experimental + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'merchantapi.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * 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. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * 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 {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * 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. + * } + * + * @throws ValidationException + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Gets the latest data source file upload. Only the `latest` alias is + * accepted for a file upload. + * + * The async variant is {@see FileUploadsServiceClient::getFileUploadAsync()} . + * + * @example samples/V1beta/FileUploadsServiceClient/get_file_upload.php + * + * @param GetFileUploadRequest $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 FileUpload + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getFileUpload(GetFileUploadRequest $request, array $callOptions = []): FileUpload + { + return $this->startApiCall('GetFileUpload', $request, $callOptions)->wait(); + } +} diff --git a/ShoppingMerchantDatasources/src/V1beta/CreateDataSourceRequest.php b/ShoppingMerchantDataSources/src/V1beta/CreateDataSourceRequest.php similarity index 89% rename from ShoppingMerchantDatasources/src/V1beta/CreateDataSourceRequest.php rename to ShoppingMerchantDataSources/src/V1beta/CreateDataSourceRequest.php index 5e2a06d7eb8a..55a409b7d4e6 100644 --- a/ShoppingMerchantDatasources/src/V1beta/CreateDataSourceRequest.php +++ b/ShoppingMerchantDataSources/src/V1beta/CreateDataSourceRequest.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -33,13 +33,13 @@ class CreateDataSourceRequest extends \Google\Protobuf\Internal\Message * @param string $parent Required. The account where this data source will be created. * Format: `accounts/{account}` * Please see {@see DataSourcesServiceClient::accountName()} for help formatting this field. - * @param \Google\Shopping\Merchant\Datasources\V1beta\DataSource $dataSource Required. The data source to create. + * @param \Google\Shopping\Merchant\DataSources\V1beta\DataSource $dataSource Required. The data source to create. * - * @return \Google\Shopping\Merchant\Datasources\V1beta\CreateDataSourceRequest + * @return \Google\Shopping\Merchant\DataSources\V1beta\CreateDataSourceRequest * * @experimental */ - public static function build(string $parent, \Google\Shopping\Merchant\Datasources\V1beta\DataSource $dataSource): self + public static function build(string $parent, \Google\Shopping\Merchant\DataSources\V1beta\DataSource $dataSource): self { return (new self()) ->setParent($parent) @@ -55,7 +55,7 @@ public static function build(string $parent, \Google\Shopping\Merchant\Datasourc * @type string $parent * Required. The account where this data source will be created. * Format: `accounts/{account}` - * @type \Google\Shopping\Merchant\Datasources\V1beta\DataSource $data_source + * @type \Google\Shopping\Merchant\DataSources\V1beta\DataSource $data_source * Required. The data source to create. * } */ @@ -96,7 +96,7 @@ public function setParent($var) * Required. The data source to create. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.DataSource data_source = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\DataSource|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\DataSource|null */ public function getDataSource() { @@ -117,12 +117,12 @@ public function clearDataSource() * Required. The data source to create. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.DataSource data_source = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\DataSource $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\DataSource $var * @return $this */ public function setDataSource($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\DataSource::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\DataSource::class); $this->data_source = $var; return $this; diff --git a/ShoppingMerchantDatasources/src/V1beta/DataSource.php b/ShoppingMerchantDataSources/src/V1beta/DataSource.php similarity index 90% rename from ShoppingMerchantDatasources/src/V1beta/DataSource.php rename to ShoppingMerchantDataSources/src/V1beta/DataSource.php index 163311124daa..9003ef8dc1e8 100644 --- a/ShoppingMerchantDatasources/src/V1beta/DataSource.php +++ b/ShoppingMerchantDataSources/src/V1beta/DataSource.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -58,23 +58,23 @@ class DataSource extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource $primary_product_data_source + * @type \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource $primary_product_data_source * Required. The [primary data * source](https://support.google.com/merchants/answer/7439058) for local * and online products. - * @type \Google\Shopping\Merchant\Datasources\V1beta\SupplementalProductDataSource $supplemental_product_data_source + * @type \Google\Shopping\Merchant\DataSources\V1beta\SupplementalProductDataSource $supplemental_product_data_source * Required. The [supplemental data * source](https://support.google.com/merchants/answer/7439058) for local * and online products. - * @type \Google\Shopping\Merchant\Datasources\V1beta\LocalInventoryDataSource $local_inventory_data_source + * @type \Google\Shopping\Merchant\DataSources\V1beta\LocalInventoryDataSource $local_inventory_data_source * Required. The [local * inventory](https://support.google.com/merchants/answer/7023001) data * source. - * @type \Google\Shopping\Merchant\Datasources\V1beta\RegionalInventoryDataSource $regional_inventory_data_source + * @type \Google\Shopping\Merchant\DataSources\V1beta\RegionalInventoryDataSource $regional_inventory_data_source * Required. The [regional * inventory](https://support.google.com/merchants/answer/7439058) data * source. - * @type \Google\Shopping\Merchant\Datasources\V1beta\PromotionDataSource $promotion_data_source + * @type \Google\Shopping\Merchant\DataSources\V1beta\PromotionDataSource $promotion_data_source * Required. The * [promotion](https://support.google.com/merchants/answer/2906014) data * source. @@ -90,7 +90,7 @@ class DataSource extends \Google\Protobuf\Internal\Message * Output only. Determines the type of input to the data source. Based on the * input some settings might not work. Only generic data sources can be * created through the API. - * @type \Google\Shopping\Merchant\Datasources\V1beta\FileInput $file_input + * @type \Google\Shopping\Merchant\DataSources\V1beta\FileInput $file_input * Optional. The field is used only when data is managed through a file. * } */ @@ -105,7 +105,7 @@ public function __construct($data = NULL) { * and online products. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.PrimaryProductDataSource primary_product_data_source = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource|null */ public function getPrimaryProductDataSource() { @@ -123,12 +123,12 @@ public function hasPrimaryProductDataSource() * and online products. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.PrimaryProductDataSource primary_product_data_source = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource $var * @return $this */ public function setPrimaryProductDataSource($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource::class); $this->writeOneof(4, $var); return $this; @@ -140,7 +140,7 @@ public function setPrimaryProductDataSource($var) * and online products. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.SupplementalProductDataSource supplemental_product_data_source = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\SupplementalProductDataSource|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\SupplementalProductDataSource|null */ public function getSupplementalProductDataSource() { @@ -158,12 +158,12 @@ public function hasSupplementalProductDataSource() * and online products. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.SupplementalProductDataSource supplemental_product_data_source = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\SupplementalProductDataSource $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\SupplementalProductDataSource $var * @return $this */ public function setSupplementalProductDataSource($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\SupplementalProductDataSource::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\SupplementalProductDataSource::class); $this->writeOneof(5, $var); return $this; @@ -175,7 +175,7 @@ public function setSupplementalProductDataSource($var) * source. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.LocalInventoryDataSource local_inventory_data_source = 6 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\LocalInventoryDataSource|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\LocalInventoryDataSource|null */ public function getLocalInventoryDataSource() { @@ -193,12 +193,12 @@ public function hasLocalInventoryDataSource() * source. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.LocalInventoryDataSource local_inventory_data_source = 6 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\LocalInventoryDataSource $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\LocalInventoryDataSource $var * @return $this */ public function setLocalInventoryDataSource($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\LocalInventoryDataSource::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\LocalInventoryDataSource::class); $this->writeOneof(6, $var); return $this; @@ -210,7 +210,7 @@ public function setLocalInventoryDataSource($var) * source. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.RegionalInventoryDataSource regional_inventory_data_source = 7 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\RegionalInventoryDataSource|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\RegionalInventoryDataSource|null */ public function getRegionalInventoryDataSource() { @@ -228,12 +228,12 @@ public function hasRegionalInventoryDataSource() * source. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.RegionalInventoryDataSource regional_inventory_data_source = 7 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\RegionalInventoryDataSource $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\RegionalInventoryDataSource $var * @return $this */ public function setRegionalInventoryDataSource($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\RegionalInventoryDataSource::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\RegionalInventoryDataSource::class); $this->writeOneof(7, $var); return $this; @@ -245,7 +245,7 @@ public function setRegionalInventoryDataSource($var) * source. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.PromotionDataSource promotion_data_source = 8 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\PromotionDataSource|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\PromotionDataSource|null */ public function getPromotionDataSource() { @@ -263,12 +263,12 @@ public function hasPromotionDataSource() * source. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.PromotionDataSource promotion_data_source = 8 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\PromotionDataSource $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\PromotionDataSource $var * @return $this */ public function setPromotionDataSource($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\PromotionDataSource::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\PromotionDataSource::class); $this->writeOneof(8, $var); return $this; @@ -380,7 +380,7 @@ public function getInput() */ public function setInput($var) { - GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Datasources\V1beta\DataSource\Input::class); + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\DataSources\V1beta\DataSource\Input::class); $this->input = $var; return $this; @@ -390,7 +390,7 @@ public function setInput($var) * Optional. The field is used only when data is managed through a file. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileInput file_input = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\FileInput|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\FileInput|null */ public function getFileInput() { @@ -411,12 +411,12 @@ public function clearFileInput() * Optional. The field is used only when data is managed through a file. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileInput file_input = 11 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\FileInput $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\FileInput $var * @return $this */ public function setFileInput($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\FileInput::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\FileInput::class); $this->file_input = $var; return $this; diff --git a/ShoppingMerchantDatasources/src/V1beta/DataSource/Input.php b/ShoppingMerchantDataSources/src/V1beta/DataSource/Input.php similarity index 97% rename from ShoppingMerchantDatasources/src/V1beta/DataSource/Input.php rename to ShoppingMerchantDataSources/src/V1beta/DataSource/Input.php index 95a87cb08bbe..f0ec410b3f3c 100644 --- a/ShoppingMerchantDatasources/src/V1beta/DataSource/Input.php +++ b/ShoppingMerchantDataSources/src/V1beta/DataSource/Input.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta\DataSource; +namespace Google\Shopping\Merchant\DataSources\V1beta\DataSource; use UnexpectedValueException; diff --git a/ShoppingMerchantDataSources/src/V1beta/DataSourceReference.php b/ShoppingMerchantDataSources/src/V1beta/DataSourceReference.php new file mode 100644 index 000000000000..ffd73ec45aaa --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/DataSourceReference.php @@ -0,0 +1,154 @@ +google.shopping.merchant.datasources.v1beta.DataSourceReference + */ +class DataSourceReference extends \Google\Protobuf\Internal\Message +{ + protected $data_source_id; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $self + * Self should be used to reference the primary data source itself. + * @type string $primary_data_source_name + * Optional. The name of the primary data source. + * Format: + * `accounts/{account}/dataSources/{datasource}` + * @type string $supplemental_data_source_name + * Optional. The name of the supplemental data source. + * Format: + * `accounts/{account}/dataSources/{datasource}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Datasources\V1Beta\Datasourcetypes::initOnce(); + parent::__construct($data); + } + + /** + * Self should be used to reference the primary data source itself. + * + * Generated from protobuf field bool self = 1; + * @return bool + */ + public function getSelf() + { + return $this->readOneof(1); + } + + public function hasSelf() + { + return $this->hasOneof(1); + } + + /** + * Self should be used to reference the primary data source itself. + * + * Generated from protobuf field bool self = 1; + * @param bool $var + * @return $this + */ + public function setSelf($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. The name of the primary data source. + * Format: + * `accounts/{account}/dataSources/{datasource}` + * + * Generated from protobuf field string primary_data_source_name = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPrimaryDataSourceName() + { + return $this->readOneof(3); + } + + public function hasPrimaryDataSourceName() + { + return $this->hasOneof(3); + } + + /** + * Optional. The name of the primary data source. + * Format: + * `accounts/{account}/dataSources/{datasource}` + * + * Generated from protobuf field string primary_data_source_name = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPrimaryDataSourceName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Optional. The name of the supplemental data source. + * Format: + * `accounts/{account}/dataSources/{datasource}` + * + * Generated from protobuf field string supplemental_data_source_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSupplementalDataSourceName() + { + return $this->readOneof(2); + } + + public function hasSupplementalDataSourceName() + { + return $this->hasOneof(2); + } + + /** + * Optional. The name of the supplemental data source. + * Format: + * `accounts/{account}/dataSources/{datasource}` + * + * Generated from protobuf field string supplemental_data_source_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSupplementalDataSourceName($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getDataSourceId() + { + return $this->whichOneof("data_source_id"); + } + +} + diff --git a/ShoppingMerchantDatasources/src/V1beta/DeleteDataSourceRequest.php b/ShoppingMerchantDataSources/src/V1beta/DeleteDataSourceRequest.php similarity index 95% rename from ShoppingMerchantDatasources/src/V1beta/DeleteDataSourceRequest.php rename to ShoppingMerchantDataSources/src/V1beta/DeleteDataSourceRequest.php index e1510c8ad295..1ef5f790b80d 100644 --- a/ShoppingMerchantDatasources/src/V1beta/DeleteDataSourceRequest.php +++ b/ShoppingMerchantDataSources/src/V1beta/DeleteDataSourceRequest.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -28,7 +28,7 @@ class DeleteDataSourceRequest extends \Google\Protobuf\Internal\Message * Format: `accounts/{account}/dataSources/{datasource}` * Please see {@see DataSourcesServiceClient::dataSourceName()} for help formatting this field. * - * @return \Google\Shopping\Merchant\Datasources\V1beta\DeleteDataSourceRequest + * @return \Google\Shopping\Merchant\DataSources\V1beta\DeleteDataSourceRequest * * @experimental */ diff --git a/ShoppingMerchantDatasources/src/V1beta/FetchDataSourceRequest.php b/ShoppingMerchantDataSources/src/V1beta/FetchDataSourceRequest.php similarity index 97% rename from ShoppingMerchantDatasources/src/V1beta/FetchDataSourceRequest.php rename to ShoppingMerchantDataSources/src/V1beta/FetchDataSourceRequest.php index 8dbc2c96b44b..3377545b156d 100644 --- a/ShoppingMerchantDatasources/src/V1beta/FetchDataSourceRequest.php +++ b/ShoppingMerchantDataSources/src/V1beta/FetchDataSourceRequest.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; diff --git a/ShoppingMerchantDatasources/src/V1beta/FileInput.php b/ShoppingMerchantDataSources/src/V1beta/FileInput.php similarity index 93% rename from ShoppingMerchantDatasources/src/V1beta/FileInput.php rename to ShoppingMerchantDataSources/src/V1beta/FileInput.php index ce4a7ac5a393..3856a6a9a502 100644 --- a/ShoppingMerchantDatasources/src/V1beta/FileInput.php +++ b/ShoppingMerchantDataSources/src/V1beta/FileInput.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/fileinputs.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -44,7 +44,7 @@ class FileInput extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Shopping\Merchant\Datasources\V1beta\FileInput\FetchSettings $fetch_settings + * @type \Google\Shopping\Merchant\DataSources\V1beta\FileInput\FetchSettings $fetch_settings * Optional. Fetch details to deliver the data source. It contains settings * for `FETCH` and `GOOGLE_SHEETS` file input types. The required fields vary * based on the frequency of fetching. @@ -66,7 +66,7 @@ public function __construct($data = NULL) { * based on the frequency of fetching. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileInput.FetchSettings fetch_settings = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\FileInput\FetchSettings|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\FileInput\FetchSettings|null */ public function getFetchSettings() { @@ -89,12 +89,12 @@ public function clearFetchSettings() * based on the frequency of fetching. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileInput.FetchSettings fetch_settings = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\FileInput\FetchSettings $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\FileInput\FetchSettings $var * @return $this */ public function setFetchSettings($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\FileInput\FetchSettings::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\FileInput\FetchSettings::class); $this->fetch_settings = $var; return $this; @@ -148,7 +148,7 @@ public function getFileInputType() */ public function setFileInputType($var) { - GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Datasources\V1beta\FileInput\FileInputType::class); + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\DataSources\V1beta\FileInput\FileInputType::class); $this->file_input_type = $var; return $this; diff --git a/ShoppingMerchantDatasources/src/V1beta/FileInput/FetchSettings.php b/ShoppingMerchantDataSources/src/V1beta/FileInput/FetchSettings.php similarity index 99% rename from ShoppingMerchantDatasources/src/V1beta/FileInput/FetchSettings.php rename to ShoppingMerchantDataSources/src/V1beta/FileInput/FetchSettings.php index 1e056b90782f..dda12045abcb 100644 --- a/ShoppingMerchantDatasources/src/V1beta/FileInput/FetchSettings.php +++ b/ShoppingMerchantDataSources/src/V1beta/FileInput/FetchSettings.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/fileinputs.proto -namespace Google\Shopping\Merchant\Datasources\V1beta\FileInput; +namespace Google\Shopping\Merchant\DataSources\V1beta\FileInput; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -295,7 +295,7 @@ public function getFrequency() */ public function setFrequency($var) { - GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Datasources\V1beta\FileInput\FetchSettings\Frequency::class); + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\DataSources\V1beta\FileInput\FetchSettings\Frequency::class); $this->frequency = $var; return $this; diff --git a/ShoppingMerchantDatasources/src/V1beta/FileInput/FetchSettings/Frequency.php b/ShoppingMerchantDataSources/src/V1beta/FileInput/FetchSettings/Frequency.php similarity index 97% rename from ShoppingMerchantDatasources/src/V1beta/FileInput/FetchSettings/Frequency.php rename to ShoppingMerchantDataSources/src/V1beta/FileInput/FetchSettings/Frequency.php index 6f4d3e69e446..8241f63626e5 100644 --- a/ShoppingMerchantDatasources/src/V1beta/FileInput/FetchSettings/Frequency.php +++ b/ShoppingMerchantDataSources/src/V1beta/FileInput/FetchSettings/Frequency.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/fileinputs.proto -namespace Google\Shopping\Merchant\Datasources\V1beta\FileInput\FetchSettings; +namespace Google\Shopping\Merchant\DataSources\V1beta\FileInput\FetchSettings; use UnexpectedValueException; diff --git a/ShoppingMerchantDatasources/src/V1beta/FileInput/FileInputType.php b/ShoppingMerchantDataSources/src/V1beta/FileInput/FileInputType.php similarity index 97% rename from ShoppingMerchantDatasources/src/V1beta/FileInput/FileInputType.php rename to ShoppingMerchantDataSources/src/V1beta/FileInput/FileInputType.php index 3cfe3196d5ec..d55408ceaff9 100644 --- a/ShoppingMerchantDatasources/src/V1beta/FileInput/FileInputType.php +++ b/ShoppingMerchantDataSources/src/V1beta/FileInput/FileInputType.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/fileinputs.proto -namespace Google\Shopping\Merchant\Datasources\V1beta\FileInput; +namespace Google\Shopping\Merchant\DataSources\V1beta\FileInput; use UnexpectedValueException; diff --git a/ShoppingMerchantDataSources/src/V1beta/FileUpload.php b/ShoppingMerchantDataSources/src/V1beta/FileUpload.php new file mode 100644 index 000000000000..0d44cdeb9012 --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/FileUpload.php @@ -0,0 +1,326 @@ +google.shopping.merchant.datasources.v1beta.FileUpload + */ +class FileUpload extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of the data source file upload. + * Format: + * `{datasource.name=accounts/{account}/dataSources/{datasource}/fileUploads/{fileupload}}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The data source id. + * + * Generated from protobuf field int64 data_source_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $data_source_id = 0; + /** + * Output only. The processing state of the data source. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileUpload.ProcessingState processing_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $processing_state = 0; + /** + * Output only. The list of issues occurring in the data source. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.FileUpload.Issue issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $issues; + /** + * Output only. The number of items in the data source that were processed. + * + * Generated from protobuf field int64 items_total = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $items_total = 0; + /** + * Output only. The number of items in the data source that were created. + * + * Generated from protobuf field int64 items_created = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $items_created = 0; + /** + * Output only. The number of items in the data source that were updated. + * + * Generated from protobuf field int64 items_updated = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $items_updated = 0; + /** + * Output only. The date at which the file of the data source was uploaded. + * + * Generated from protobuf field .google.protobuf.Timestamp upload_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $upload_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of the data source file upload. + * Format: + * `{datasource.name=accounts/{account}/dataSources/{datasource}/fileUploads/{fileupload}}` + * @type int|string $data_source_id + * Output only. The data source id. + * @type int $processing_state + * Output only. The processing state of the data source. + * @type array<\Google\Shopping\Merchant\DataSources\V1beta\FileUpload\Issue>|\Google\Protobuf\Internal\RepeatedField $issues + * Output only. The list of issues occurring in the data source. + * @type int|string $items_total + * Output only. The number of items in the data source that were processed. + * @type int|string $items_created + * Output only. The number of items in the data source that were created. + * @type int|string $items_updated + * Output only. The number of items in the data source that were updated. + * @type \Google\Protobuf\Timestamp $upload_time + * Output only. The date at which the file of the data source was uploaded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Datasources\V1Beta\Fileuploads::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of the data source file upload. + * Format: + * `{datasource.name=accounts/{account}/dataSources/{datasource}/fileUploads/{fileupload}}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of the data source file upload. + * Format: + * `{datasource.name=accounts/{account}/dataSources/{datasource}/fileUploads/{fileupload}}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The data source id. + * + * Generated from protobuf field int64 data_source_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getDataSourceId() + { + return $this->data_source_id; + } + + /** + * Output only. The data source id. + * + * Generated from protobuf field int64 data_source_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setDataSourceId($var) + { + GPBUtil::checkInt64($var); + $this->data_source_id = $var; + + return $this; + } + + /** + * Output only. The processing state of the data source. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileUpload.ProcessingState processing_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getProcessingState() + { + return $this->processing_state; + } + + /** + * Output only. The processing state of the data source. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileUpload.ProcessingState processing_state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setProcessingState($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\DataSources\V1beta\FileUpload\ProcessingState::class); + $this->processing_state = $var; + + return $this; + } + + /** + * Output only. The list of issues occurring in the data source. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.FileUpload.Issue issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIssues() + { + return $this->issues; + } + + /** + * Output only. The list of issues occurring in the data source. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.FileUpload.Issue issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Shopping\Merchant\DataSources\V1beta\FileUpload\Issue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\DataSources\V1beta\FileUpload\Issue::class); + $this->issues = $arr; + + return $this; + } + + /** + * Output only. The number of items in the data source that were processed. + * + * Generated from protobuf field int64 items_total = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getItemsTotal() + { + return $this->items_total; + } + + /** + * Output only. The number of items in the data source that were processed. + * + * Generated from protobuf field int64 items_total = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setItemsTotal($var) + { + GPBUtil::checkInt64($var); + $this->items_total = $var; + + return $this; + } + + /** + * Output only. The number of items in the data source that were created. + * + * Generated from protobuf field int64 items_created = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getItemsCreated() + { + return $this->items_created; + } + + /** + * Output only. The number of items in the data source that were created. + * + * Generated from protobuf field int64 items_created = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setItemsCreated($var) + { + GPBUtil::checkInt64($var); + $this->items_created = $var; + + return $this; + } + + /** + * Output only. The number of items in the data source that were updated. + * + * Generated from protobuf field int64 items_updated = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getItemsUpdated() + { + return $this->items_updated; + } + + /** + * Output only. The number of items in the data source that were updated. + * + * Generated from protobuf field int64 items_updated = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setItemsUpdated($var) + { + GPBUtil::checkInt64($var); + $this->items_updated = $var; + + return $this; + } + + /** + * Output only. The date at which the file of the data source was uploaded. + * + * Generated from protobuf field .google.protobuf.Timestamp upload_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUploadTime() + { + return $this->upload_time; + } + + public function hasUploadTime() + { + return isset($this->upload_time); + } + + public function clearUploadTime() + { + unset($this->upload_time); + } + + /** + * Output only. The date at which the file of the data source was uploaded. + * + * Generated from protobuf field .google.protobuf.Timestamp upload_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUploadTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->upload_time = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantDataSources/src/V1beta/FileUpload/Issue.php b/ShoppingMerchantDataSources/src/V1beta/FileUpload/Issue.php new file mode 100644 index 000000000000..4124eacf48fd --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/FileUpload/Issue.php @@ -0,0 +1,258 @@ +google.shopping.merchant.datasources.v1beta.FileUpload.Issue + */ +class Issue extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The title of the issue, for example, "Item too big". + * + * Generated from protobuf field string title = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $title = ''; + /** + * Output only. The error description, for example, "Your data source + * contains items which have too many attributes, or are too big. These + * items will be dropped". + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $description = ''; + /** + * Output only. The code of the error, for example, + * "validation/invalid_value". Returns + * "?" if the code is unknown. + * + * Generated from protobuf field string code = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $code = ''; + /** + * Output only. The number of occurrences of the error in the file upload. + * + * Generated from protobuf field int64 count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $count = 0; + /** + * Output only. The severity of the issue. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileUpload.Issue.Severity severity = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $severity = 0; + /** + * Output only. Link to the documentation explaining the issue in more + * details, if available. + * + * Generated from protobuf field string documentation_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $documentation_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $title + * Output only. The title of the issue, for example, "Item too big". + * @type string $description + * Output only. The error description, for example, "Your data source + * contains items which have too many attributes, or are too big. These + * items will be dropped". + * @type string $code + * Output only. The code of the error, for example, + * "validation/invalid_value". Returns + * "?" if the code is unknown. + * @type int|string $count + * Output only. The number of occurrences of the error in the file upload. + * @type int $severity + * Output only. The severity of the issue. + * @type string $documentation_uri + * Output only. Link to the documentation explaining the issue in more + * details, if available. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Datasources\V1Beta\Fileuploads::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The title of the issue, for example, "Item too big". + * + * Generated from protobuf field string title = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Output only. The title of the issue, for example, "Item too big". + * + * Generated from protobuf field string title = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * Output only. The error description, for example, "Your data source + * contains items which have too many attributes, or are too big. These + * items will be dropped". + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Output only. The error description, for example, "Your data source + * contains items which have too many attributes, or are too big. These + * items will be dropped". + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The code of the error, for example, + * "validation/invalid_value". Returns + * "?" if the code is unknown. + * + * Generated from protobuf field string code = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Output only. The code of the error, for example, + * "validation/invalid_value". Returns + * "?" if the code is unknown. + * + * Generated from protobuf field string code = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + + /** + * Output only. The number of occurrences of the error in the file upload. + * + * Generated from protobuf field int64 count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * Output only. The number of occurrences of the error in the file upload. + * + * Generated from protobuf field int64 count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt64($var); + $this->count = $var; + + return $this; + } + + /** + * Output only. The severity of the issue. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileUpload.Issue.Severity severity = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Output only. The severity of the issue. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.FileUpload.Issue.Severity severity = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\DataSources\V1beta\FileUpload\Issue\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Output only. Link to the documentation explaining the issue in more + * details, if available. + * + * Generated from protobuf field string documentation_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDocumentationUri() + { + return $this->documentation_uri; + } + + /** + * Output only. Link to the documentation explaining the issue in more + * details, if available. + * + * Generated from protobuf field string documentation_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDocumentationUri($var) + { + GPBUtil::checkString($var, True); + $this->documentation_uri = $var; + + return $this; + } + +} + + diff --git a/ShoppingMerchantDataSources/src/V1beta/FileUpload/Issue/Severity.php b/ShoppingMerchantDataSources/src/V1beta/FileUpload/Issue/Severity.php new file mode 100644 index 000000000000..1280f1bcfb7f --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/FileUpload/Issue/Severity.php @@ -0,0 +1,62 @@ +google.shopping.merchant.datasources.v1beta.FileUpload.Issue.Severity + */ +class Severity +{ + /** + * Severity unspecified. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * The issue is the warning. + * + * Generated from protobuf enum WARNING = 1; + */ + const WARNING = 1; + /** + * The issue is an error. + * + * Generated from protobuf enum ERROR = 2; + */ + const ERROR = 2; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/ShoppingMerchantDataSources/src/V1beta/FileUpload/ProcessingState.php b/ShoppingMerchantDataSources/src/V1beta/FileUpload/ProcessingState.php new file mode 100644 index 000000000000..4d871aee8ce3 --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/FileUpload/ProcessingState.php @@ -0,0 +1,70 @@ +google.shopping.merchant.datasources.v1beta.FileUpload.ProcessingState + */ +class ProcessingState +{ + /** + * Processing state unspecified. + * + * Generated from protobuf enum PROCESSING_STATE_UNSPECIFIED = 0; + */ + const PROCESSING_STATE_UNSPECIFIED = 0; + /** + * The data source could not be processed or all the items had errors. + * + * Generated from protobuf enum FAILED = 1; + */ + const FAILED = 1; + /** + * The data source is being processed. + * + * Generated from protobuf enum IN_PROGRESS = 2; + */ + const IN_PROGRESS = 2; + /** + * The data source was processed successfully, though some items might have + * had errors. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + + private static $valueToName = [ + self::PROCESSING_STATE_UNSPECIFIED => 'PROCESSING_STATE_UNSPECIFIED', + self::FAILED => 'FAILED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::SUCCEEDED => 'SUCCEEDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/ShoppingMerchantDatasources/src/V1beta/GetDataSourceRequest.php b/ShoppingMerchantDataSources/src/V1beta/GetDataSourceRequest.php similarity index 95% rename from ShoppingMerchantDatasources/src/V1beta/GetDataSourceRequest.php rename to ShoppingMerchantDataSources/src/V1beta/GetDataSourceRequest.php index 2d17a5e9e0b4..77e615125af0 100644 --- a/ShoppingMerchantDatasources/src/V1beta/GetDataSourceRequest.php +++ b/ShoppingMerchantDataSources/src/V1beta/GetDataSourceRequest.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -28,7 +28,7 @@ class GetDataSourceRequest extends \Google\Protobuf\Internal\Message * Format: `accounts/{account}/dataSources/{datasource}` * Please see {@see DataSourcesServiceClient::dataSourceName()} for help formatting this field. * - * @return \Google\Shopping\Merchant\Datasources\V1beta\GetDataSourceRequest + * @return \Google\Shopping\Merchant\DataSources\V1beta\GetDataSourceRequest * * @experimental */ diff --git a/ShoppingMerchantDataSources/src/V1beta/GetFileUploadRequest.php b/ShoppingMerchantDataSources/src/V1beta/GetFileUploadRequest.php new file mode 100644 index 000000000000..171462df697b --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/GetFileUploadRequest.php @@ -0,0 +1,91 @@ +google.shopping.merchant.datasources.v1beta.GetFileUploadRequest + */ +class GetFileUploadRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the data source file upload to retrieve. + * Format: + * `accounts/{account}/dataSources/{datasource}/fileUploads/latest` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the data source file upload to retrieve. + * Format: + * `accounts/{account}/dataSources/{datasource}/fileUploads/latest` + * Please see {@see FileUploadsServiceClient::fileUploadName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\DataSources\V1beta\GetFileUploadRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the data source file upload to retrieve. + * Format: + * `accounts/{account}/dataSources/{datasource}/fileUploads/latest` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Datasources\V1Beta\Fileuploads::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the data source file upload to retrieve. + * Format: + * `accounts/{account}/dataSources/{datasource}/fileUploads/latest` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the data source file upload to retrieve. + * Format: + * `accounts/{account}/dataSources/{datasource}/fileUploads/latest` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantDatasources/src/V1beta/ListDataSourcesRequest.php b/ShoppingMerchantDataSources/src/V1beta/ListDataSourcesRequest.php similarity index 98% rename from ShoppingMerchantDatasources/src/V1beta/ListDataSourcesRequest.php rename to ShoppingMerchantDataSources/src/V1beta/ListDataSourcesRequest.php index 855b5bd16f24..9c64a434729f 100644 --- a/ShoppingMerchantDatasources/src/V1beta/ListDataSourcesRequest.php +++ b/ShoppingMerchantDataSources/src/V1beta/ListDataSourcesRequest.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -46,7 +46,7 @@ class ListDataSourcesRequest extends \Google\Protobuf\Internal\Message * Format: `accounts/{account}` * Please see {@see DataSourcesServiceClient::accountName()} for help formatting this field. * - * @return \Google\Shopping\Merchant\Datasources\V1beta\ListDataSourcesRequest + * @return \Google\Shopping\Merchant\DataSources\V1beta\ListDataSourcesRequest * * @experimental */ diff --git a/ShoppingMerchantDatasources/src/V1beta/ListDataSourcesResponse.php b/ShoppingMerchantDataSources/src/V1beta/ListDataSourcesResponse.php similarity index 93% rename from ShoppingMerchantDatasources/src/V1beta/ListDataSourcesResponse.php rename to ShoppingMerchantDataSources/src/V1beta/ListDataSourcesResponse.php index d4adb39df479..8c50f4c04393 100644 --- a/ShoppingMerchantDatasources/src/V1beta/ListDataSourcesResponse.php +++ b/ShoppingMerchantDataSources/src/V1beta/ListDataSourcesResponse.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -35,7 +35,7 @@ class ListDataSourcesResponse extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type array<\Google\Shopping\Merchant\Datasources\V1beta\DataSource>|\Google\Protobuf\Internal\RepeatedField $data_sources + * @type array<\Google\Shopping\Merchant\DataSources\V1beta\DataSource>|\Google\Protobuf\Internal\RepeatedField $data_sources * The data sources from the specified account. * @type string $next_page_token * A token, which can be sent as `page_token` to retrieve the next page. @@ -62,12 +62,12 @@ public function getDataSources() * The data sources from the specified account. * * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.DataSource data_sources = 1; - * @param array<\Google\Shopping\Merchant\Datasources\V1beta\DataSource>|\Google\Protobuf\Internal\RepeatedField $var + * @param array<\Google\Shopping\Merchant\DataSources\V1beta\DataSource>|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setDataSources($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Datasources\V1beta\DataSource::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\DataSources\V1beta\DataSource::class); $this->data_sources = $arr; return $this; diff --git a/ShoppingMerchantDatasources/src/V1beta/LocalInventoryDataSource.php b/ShoppingMerchantDataSources/src/V1beta/LocalInventoryDataSource.php similarity index 98% rename from ShoppingMerchantDatasources/src/V1beta/LocalInventoryDataSource.php rename to ShoppingMerchantDataSources/src/V1beta/LocalInventoryDataSource.php index 5bd74225e70a..7fa88b23a23c 100644 --- a/ShoppingMerchantDatasources/src/V1beta/LocalInventoryDataSource.php +++ b/ShoppingMerchantDataSources/src/V1beta/LocalInventoryDataSource.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasourcetypes.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; diff --git a/ShoppingMerchantDatasources/src/V1beta/PrimaryProductDataSource.php b/ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource.php similarity index 83% rename from ShoppingMerchantDatasources/src/V1beta/PrimaryProductDataSource.php rename to ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource.php index 725929b67eb4..caa08a1e6814 100644 --- a/ShoppingMerchantDatasources/src/V1beta/PrimaryProductDataSource.php +++ b/ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasourcetypes.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -58,6 +58,13 @@ class PrimaryProductDataSource extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated string countries = 6 [(.google.api.field_behavior) = OPTIONAL]; */ private $countries; + /** + * Optional. Default rule management of the data source. If set, the linked + * data sources will be replaced. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.PrimaryProductDataSource.DefaultRule default_rule = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $default_rule = null; /** * Constructor. @@ -92,6 +99,9 @@ class PrimaryProductDataSource extends \Google\Protobuf\Internal\Message * Optional. The countries where the items may be displayed. Represented as a * [CLDR territory * code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml). + * @type \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\DefaultRule $default_rule + * Optional. Default rule management of the data source. If set, the linked + * data sources will be replaced. * } */ public function __construct($data = NULL) { @@ -119,7 +129,7 @@ public function getChannel() */ public function setChannel($var) { - GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource\Channel::class); + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\Channel::class); $this->channel = $var; return $this; @@ -261,5 +271,43 @@ public function setCountries($var) return $this; } + /** + * Optional. Default rule management of the data source. If set, the linked + * data sources will be replaced. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.PrimaryProductDataSource.DefaultRule default_rule = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\DefaultRule|null + */ + public function getDefaultRule() + { + return $this->default_rule; + } + + public function hasDefaultRule() + { + return isset($this->default_rule); + } + + public function clearDefaultRule() + { + unset($this->default_rule); + } + + /** + * Optional. Default rule management of the data source. If set, the linked + * data sources will be replaced. + * + * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.PrimaryProductDataSource.DefaultRule default_rule = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\DefaultRule $var + * @return $this + */ + public function setDefaultRule($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\DefaultRule::class); + $this->default_rule = $var; + + return $this; + } + } diff --git a/ShoppingMerchantDatasources/src/V1beta/PrimaryProductDataSource/Channel.php b/ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource/Channel.php similarity index 92% rename from ShoppingMerchantDatasources/src/V1beta/PrimaryProductDataSource/Channel.php rename to ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource/Channel.php index d0a015f65ae9..7fb341bfc37e 100644 --- a/ShoppingMerchantDatasources/src/V1beta/PrimaryProductDataSource/Channel.php +++ b/ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource/Channel.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasourcetypes.proto -namespace Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource; +namespace Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource; use UnexpectedValueException; @@ -35,6 +35,8 @@ class Channel const LOCAL_PRODUCTS = 2; /** * Unified data source for both local and online products. + * Note: Products management through the API is not possible for this + * channel. * * Generated from protobuf enum PRODUCTS = 3; */ diff --git a/ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource/DefaultRule.php b/ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource/DefaultRule.php new file mode 100644 index 000000000000..bb519afedb51 --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/PrimaryProductDataSource/DefaultRule.php @@ -0,0 +1,124 @@ +google.shopping.merchant.datasources.v1beta.PrimaryProductDataSource.DefaultRule + */ +class DefaultRule extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The list of data sources linked in the [default + * rule](https://support.google.com/merchants/answer/7450276). + * This list is ordered by the default rule priority of joining the data. + * It might include none or multiple references to `self` and supplemental + * data sources. + * The list must not be empty. + * To link the data source to the default rule, you need to add a + * new reference to this list (in sequential order). + * To unlink the data source from the default rule, you need to + * remove the given reference from this list. + * Changing the order of this list will result in changing the priority of + * data sources in the default rule. + * For example, providing the following list: [`1001`, `self`] will + * take attribute values from supplemental data source `1001`, and fallback + * to `self` if the attribute is not set in `1001`. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.DataSourceReference take_from_data_sources = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $take_from_data_sources; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Shopping\Merchant\DataSources\V1beta\DataSourceReference>|\Google\Protobuf\Internal\RepeatedField $take_from_data_sources + * Required. The list of data sources linked in the [default + * rule](https://support.google.com/merchants/answer/7450276). + * This list is ordered by the default rule priority of joining the data. + * It might include none or multiple references to `self` and supplemental + * data sources. + * The list must not be empty. + * To link the data source to the default rule, you need to add a + * new reference to this list (in sequential order). + * To unlink the data source from the default rule, you need to + * remove the given reference from this list. + * Changing the order of this list will result in changing the priority of + * data sources in the default rule. + * For example, providing the following list: [`1001`, `self`] will + * take attribute values from supplemental data source `1001`, and fallback + * to `self` if the attribute is not set in `1001`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Datasources\V1Beta\Datasourcetypes::initOnce(); + parent::__construct($data); + } + + /** + * Required. The list of data sources linked in the [default + * rule](https://support.google.com/merchants/answer/7450276). + * This list is ordered by the default rule priority of joining the data. + * It might include none or multiple references to `self` and supplemental + * data sources. + * The list must not be empty. + * To link the data source to the default rule, you need to add a + * new reference to this list (in sequential order). + * To unlink the data source from the default rule, you need to + * remove the given reference from this list. + * Changing the order of this list will result in changing the priority of + * data sources in the default rule. + * For example, providing the following list: [`1001`, `self`] will + * take attribute values from supplemental data source `1001`, and fallback + * to `self` if the attribute is not set in `1001`. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.DataSourceReference take_from_data_sources = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTakeFromDataSources() + { + return $this->take_from_data_sources; + } + + /** + * Required. The list of data sources linked in the [default + * rule](https://support.google.com/merchants/answer/7450276). + * This list is ordered by the default rule priority of joining the data. + * It might include none or multiple references to `self` and supplemental + * data sources. + * The list must not be empty. + * To link the data source to the default rule, you need to add a + * new reference to this list (in sequential order). + * To unlink the data source from the default rule, you need to + * remove the given reference from this list. + * Changing the order of this list will result in changing the priority of + * data sources in the default rule. + * For example, providing the following list: [`1001`, `self`] will + * take attribute values from supplemental data source `1001`, and fallback + * to `self` if the attribute is not set in `1001`. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.DataSourceReference take_from_data_sources = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Shopping\Merchant\DataSources\V1beta\DataSourceReference>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTakeFromDataSources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\DataSources\V1beta\DataSourceReference::class); + $this->take_from_data_sources = $arr; + + return $this; + } + +} + + diff --git a/ShoppingMerchantDatasources/src/V1beta/PromotionDataSource.php b/ShoppingMerchantDataSources/src/V1beta/PromotionDataSource.php similarity index 98% rename from ShoppingMerchantDatasources/src/V1beta/PromotionDataSource.php rename to ShoppingMerchantDataSources/src/V1beta/PromotionDataSource.php index c2971d9c23a6..ac271f118797 100644 --- a/ShoppingMerchantDatasources/src/V1beta/PromotionDataSource.php +++ b/ShoppingMerchantDataSources/src/V1beta/PromotionDataSource.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasourcetypes.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; diff --git a/ShoppingMerchantDatasources/src/V1beta/RegionalInventoryDataSource.php b/ShoppingMerchantDataSources/src/V1beta/RegionalInventoryDataSource.php similarity index 98% rename from ShoppingMerchantDatasources/src/V1beta/RegionalInventoryDataSource.php rename to ShoppingMerchantDataSources/src/V1beta/RegionalInventoryDataSource.php index cef3f26f4e5c..cf9c841760f8 100644 --- a/ShoppingMerchantDatasources/src/V1beta/RegionalInventoryDataSource.php +++ b/ShoppingMerchantDataSources/src/V1beta/RegionalInventoryDataSource.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasourcetypes.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; diff --git a/ShoppingMerchantDatasources/src/V1beta/SupplementalProductDataSource.php b/ShoppingMerchantDataSources/src/V1beta/SupplementalProductDataSource.php similarity index 75% rename from ShoppingMerchantDatasources/src/V1beta/SupplementalProductDataSource.php rename to ShoppingMerchantDataSources/src/V1beta/SupplementalProductDataSource.php index a14d5bfaf3e2..342d480790b7 100644 --- a/ShoppingMerchantDatasources/src/V1beta/SupplementalProductDataSource.php +++ b/ShoppingMerchantDataSources/src/V1beta/SupplementalProductDataSource.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasourcetypes.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -44,6 +44,14 @@ class SupplementalProductDataSource extends \Google\Protobuf\Internal\Message * Generated from protobuf field optional string content_language = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; */ protected $content_language = null; + /** + * Output only. The (unordered and deduplicated) list of all primary data + * sources linked to this data source in either default or custom rules. + * Supplemental data source cannot be deleted before all links are removed. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.DataSourceReference referencing_primary_data_sources = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $referencing_primary_data_sources; /** * Constructor. @@ -72,6 +80,10 @@ class SupplementalProductDataSource extends \Google\Protobuf\Internal\Message * If set, the data source will only accept products matching this * combination. If unset, the data source will accept produts without that * restriction. + * @type array<\Google\Shopping\Merchant\DataSources\V1beta\DataSourceReference>|\Google\Protobuf\Internal\RepeatedField $referencing_primary_data_sources + * Output only. The (unordered and deduplicated) list of all primary data + * sources linked to this data source in either default or custom rules. + * Supplemental data source cannot be deleted before all links are removed. * } */ public function __construct($data = NULL) { @@ -185,5 +197,35 @@ public function setContentLanguage($var) return $this; } + /** + * Output only. The (unordered and deduplicated) list of all primary data + * sources linked to this data source in either default or custom rules. + * Supplemental data source cannot be deleted before all links are removed. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.DataSourceReference referencing_primary_data_sources = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencingPrimaryDataSources() + { + return $this->referencing_primary_data_sources; + } + + /** + * Output only. The (unordered and deduplicated) list of all primary data + * sources linked to this data source in either default or custom rules. + * Supplemental data source cannot be deleted before all links are removed. + * + * Generated from protobuf field repeated .google.shopping.merchant.datasources.v1beta.DataSourceReference referencing_primary_data_sources = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Shopping\Merchant\DataSources\V1beta\DataSourceReference>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferencingPrimaryDataSources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\DataSources\V1beta\DataSourceReference::class); + $this->referencing_primary_data_sources = $arr; + + return $this; + } + } diff --git a/ShoppingMerchantDatasources/src/V1beta/UpdateDataSourceRequest.php b/ShoppingMerchantDataSources/src/V1beta/UpdateDataSourceRequest.php similarity index 92% rename from ShoppingMerchantDatasources/src/V1beta/UpdateDataSourceRequest.php rename to ShoppingMerchantDataSources/src/V1beta/UpdateDataSourceRequest.php index f0852c6fe162..4fa6274ce9a0 100644 --- a/ShoppingMerchantDatasources/src/V1beta/UpdateDataSourceRequest.php +++ b/ShoppingMerchantDataSources/src/V1beta/UpdateDataSourceRequest.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/shopping/merchant/datasources/v1beta/datasources.proto -namespace Google\Shopping\Merchant\Datasources\V1beta; +namespace Google\Shopping\Merchant\DataSources\V1beta; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; @@ -33,7 +33,7 @@ class UpdateDataSourceRequest extends \Google\Protobuf\Internal\Message protected $update_mask = null; /** - * @param \Google\Shopping\Merchant\Datasources\V1beta\DataSource $dataSource Required. The data source resource to update. + * @param \Google\Shopping\Merchant\DataSources\V1beta\DataSource $dataSource Required. The data source resource to update. * @param \Google\Protobuf\FieldMask $updateMask Required. The list of data source fields to be updated. * * Fields specified in the update mask without a value specified in the @@ -42,11 +42,11 @@ class UpdateDataSourceRequest extends \Google\Protobuf\Internal\Message * Providing special "*" value for full data source replacement is not * supported. * - * @return \Google\Shopping\Merchant\Datasources\V1beta\UpdateDataSourceRequest + * @return \Google\Shopping\Merchant\DataSources\V1beta\UpdateDataSourceRequest * * @experimental */ - public static function build(\Google\Shopping\Merchant\Datasources\V1beta\DataSource $dataSource, \Google\Protobuf\FieldMask $updateMask): self + public static function build(\Google\Shopping\Merchant\DataSources\V1beta\DataSource $dataSource, \Google\Protobuf\FieldMask $updateMask): self { return (new self()) ->setDataSource($dataSource) @@ -59,7 +59,7 @@ public static function build(\Google\Shopping\Merchant\Datasources\V1beta\DataSo * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Shopping\Merchant\Datasources\V1beta\DataSource $data_source + * @type \Google\Shopping\Merchant\DataSources\V1beta\DataSource $data_source * Required. The data source resource to update. * @type \Google\Protobuf\FieldMask $update_mask * Required. The list of data source fields to be updated. @@ -78,7 +78,7 @@ public function __construct($data = NULL) { * Required. The data source resource to update. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.DataSource data_source = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Shopping\Merchant\Datasources\V1beta\DataSource|null + * @return \Google\Shopping\Merchant\DataSources\V1beta\DataSource|null */ public function getDataSource() { @@ -99,12 +99,12 @@ public function clearDataSource() * Required. The data source resource to update. * * Generated from protobuf field .google.shopping.merchant.datasources.v1beta.DataSource data_source = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Shopping\Merchant\Datasources\V1beta\DataSource $var + * @param \Google\Shopping\Merchant\DataSources\V1beta\DataSource $var * @return $this */ public function setDataSource($var) { - GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Datasources\V1beta\DataSource::class); + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\DataSources\V1beta\DataSource::class); $this->data_source = $var; return $this; diff --git a/ShoppingMerchantDatasources/src/V1beta/gapic_metadata.json b/ShoppingMerchantDataSources/src/V1beta/gapic_metadata.json similarity index 76% rename from ShoppingMerchantDatasources/src/V1beta/gapic_metadata.json rename to ShoppingMerchantDataSources/src/V1beta/gapic_metadata.json index a982ccd30154..02fed0075ffa 100644 --- a/ShoppingMerchantDatasources/src/V1beta/gapic_metadata.json +++ b/ShoppingMerchantDataSources/src/V1beta/gapic_metadata.json @@ -3,7 +3,7 @@ "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", "language": "php", "protoPackage": "google.shopping.merchant.datasources.v1beta", - "libraryPackage": "Google\\Shopping\\Merchant\\Datasources\\V1beta", + "libraryPackage": "Google\\Shopping\\Merchant\\DataSources\\V1beta", "services": { "DataSourcesService": { "clients": { @@ -43,6 +43,20 @@ } } } + }, + "FileUploadsService": { + "clients": { + "grpc": { + "libraryClient": "FileUploadsServiceGapicClient", + "rpcs": { + "GetFileUpload": { + "methods": [ + "getFileUpload" + ] + } + } + } + } } } } \ No newline at end of file diff --git a/ShoppingMerchantDatasources/src/V1beta/resources/data_sources_service_client_config.json b/ShoppingMerchantDataSources/src/V1beta/resources/data_sources_service_client_config.json similarity index 100% rename from ShoppingMerchantDatasources/src/V1beta/resources/data_sources_service_client_config.json rename to ShoppingMerchantDataSources/src/V1beta/resources/data_sources_service_client_config.json diff --git a/ShoppingMerchantDatasources/src/V1beta/resources/data_sources_service_descriptor_config.php b/ShoppingMerchantDataSources/src/V1beta/resources/data_sources_service_descriptor_config.php similarity index 97% rename from ShoppingMerchantDatasources/src/V1beta/resources/data_sources_service_descriptor_config.php rename to ShoppingMerchantDataSources/src/V1beta/resources/data_sources_service_descriptor_config.php index 989016d16b4c..4f58e381e6b6 100644 --- a/ShoppingMerchantDatasources/src/V1beta/resources/data_sources_service_descriptor_config.php +++ b/ShoppingMerchantDataSources/src/V1beta/resources/data_sources_service_descriptor_config.php @@ -25,7 +25,7 @@ 'google.shopping.merchant.datasources.v1beta.DataSourcesService' => [ 'CreateDataSource' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Shopping\Merchant\Datasources\V1beta\DataSource', + 'responseType' => 'Google\Shopping\Merchant\DataSources\V1beta\DataSource', 'headerParams' => [ [ 'keyName' => 'parent', @@ -61,7 +61,7 @@ ], 'GetDataSource' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Shopping\Merchant\Datasources\V1beta\DataSource', + 'responseType' => 'Google\Shopping\Merchant\DataSources\V1beta\DataSource', 'headerParams' => [ [ 'keyName' => 'name', @@ -81,7 +81,7 @@ 'resourcesGetMethod' => 'getDataSources', ], 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Shopping\Merchant\Datasources\V1beta\ListDataSourcesResponse', + 'responseType' => 'Google\Shopping\Merchant\DataSources\V1beta\ListDataSourcesResponse', 'headerParams' => [ [ 'keyName' => 'parent', @@ -93,7 +93,7 @@ ], 'UpdateDataSource' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Shopping\Merchant\Datasources\V1beta\DataSource', + 'responseType' => 'Google\Shopping\Merchant\DataSources\V1beta\DataSource', 'headerParams' => [ [ 'keyName' => 'data_source.name', diff --git a/ShoppingMerchantDatasources/src/V1beta/resources/data_sources_service_rest_client_config.php b/ShoppingMerchantDataSources/src/V1beta/resources/data_sources_service_rest_client_config.php similarity index 100% rename from ShoppingMerchantDatasources/src/V1beta/resources/data_sources_service_rest_client_config.php rename to ShoppingMerchantDataSources/src/V1beta/resources/data_sources_service_rest_client_config.php diff --git a/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_client_config.json b/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_client_config.json new file mode 100644 index 000000000000..407182afbaff --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.shopping.merchant.datasources.v1beta.FileUploadsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "GetFileUpload": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_descriptor_config.php b/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_descriptor_config.php new file mode 100644 index 000000000000..386987815ac9 --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_descriptor_config.php @@ -0,0 +1,43 @@ + [ + 'google.shopping.merchant.datasources.v1beta.FileUploadsService' => [ + 'GetFileUpload' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\DataSources\V1beta\FileUpload', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'fileUpload' => 'accounts/{account}/dataSources/{datasource}/fileUploads/{fileupload}', + ], + ], + ], +]; diff --git a/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_rest_client_config.php b/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_rest_client_config.php new file mode 100644 index 000000000000..90290d6224c8 --- /dev/null +++ b/ShoppingMerchantDataSources/src/V1beta/resources/file_uploads_service_rest_client_config.php @@ -0,0 +1,40 @@ + [ + 'google.shopping.merchant.datasources.v1beta.FileUploadsService' => [ + 'GetFileUpload' => [ + 'method' => 'get', + 'uriTemplate' => '/datasources/v1beta/{name=accounts/*/dataSources/*/fileUploads/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ShoppingMerchantDatasources/tests/Unit/V1beta/Client/DataSourcesServiceClientTest.php b/ShoppingMerchantDataSources/tests/Unit/V1beta/Client/DataSourcesServiceClientTest.php similarity index 96% rename from ShoppingMerchantDatasources/tests/Unit/V1beta/Client/DataSourcesServiceClientTest.php rename to ShoppingMerchantDataSources/tests/Unit/V1beta/Client/DataSourcesServiceClientTest.php index 832c9296f010..972a6966cba5 100644 --- a/ShoppingMerchantDatasources/tests/Unit/V1beta/Client/DataSourcesServiceClientTest.php +++ b/ShoppingMerchantDataSources/tests/Unit/V1beta/Client/DataSourcesServiceClientTest.php @@ -20,7 +20,7 @@ * This file was automatically generated - do not edit! */ -namespace Google\Shopping\Merchant\Datasources\Tests\Unit\V1beta\Client; +namespace Google\Shopping\Merchant\DataSources\Tests\Unit\V1beta\Client; use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; @@ -29,17 +29,17 @@ use Google\Protobuf\FieldMask; use Google\Protobuf\GPBEmpty; use Google\Rpc\Code; -use Google\Shopping\Merchant\Datasources\V1beta\Client\DataSourcesServiceClient; -use Google\Shopping\Merchant\Datasources\V1beta\CreateDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\DataSource; -use Google\Shopping\Merchant\Datasources\V1beta\DeleteDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\FetchDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\GetDataSourceRequest; -use Google\Shopping\Merchant\Datasources\V1beta\ListDataSourcesRequest; -use Google\Shopping\Merchant\Datasources\V1beta\ListDataSourcesResponse; -use Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource; -use Google\Shopping\Merchant\Datasources\V1beta\PrimaryProductDataSource\Channel; -use Google\Shopping\Merchant\Datasources\V1beta\UpdateDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\Client\DataSourcesServiceClient; +use Google\Shopping\Merchant\DataSources\V1beta\CreateDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\DataSource; +use Google\Shopping\Merchant\DataSources\V1beta\DeleteDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\FetchDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\GetDataSourceRequest; +use Google\Shopping\Merchant\DataSources\V1beta\ListDataSourcesRequest; +use Google\Shopping\Merchant\DataSources\V1beta\ListDataSourcesResponse; +use Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource; +use Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource\Channel; +use Google\Shopping\Merchant\DataSources\V1beta\UpdateDataSourceRequest; use stdClass; /** diff --git a/ShoppingMerchantDataSources/tests/Unit/V1beta/Client/FileUploadsServiceClientTest.php b/ShoppingMerchantDataSources/tests/Unit/V1beta/Client/FileUploadsServiceClientTest.php new file mode 100644 index 000000000000..1f6e7b973c9d --- /dev/null +++ b/ShoppingMerchantDataSources/tests/Unit/V1beta/Client/FileUploadsServiceClientTest.php @@ -0,0 +1,179 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return FileUploadsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new FileUploadsServiceClient($options); + } + + /** @test */ + public function getFileUploadTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $dataSourceId = 1015796374; + $itemsTotal = 384543227; + $itemsCreated = 1985498473; + $itemsUpdated = 722513724; + $expectedResponse = new FileUpload(); + $expectedResponse->setName($name2); + $expectedResponse->setDataSourceId($dataSourceId); + $expectedResponse->setItemsTotal($itemsTotal); + $expectedResponse->setItemsCreated($itemsCreated); + $expectedResponse->setItemsUpdated($itemsUpdated); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->fileUploadName('[ACCOUNT]', '[DATASOURCE]', '[FILEUPLOAD]'); + $request = (new GetFileUploadRequest())->setName($formattedName); + $response = $gapicClient->getFileUpload($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.datasources.v1beta.FileUploadsService/GetFileUpload', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFileUploadExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->fileUploadName('[ACCOUNT]', '[DATASOURCE]', '[FILEUPLOAD]'); + $request = (new GetFileUploadRequest())->setName($formattedName); + try { + $gapicClient->getFileUpload($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFileUploadAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $dataSourceId = 1015796374; + $itemsTotal = 384543227; + $itemsCreated = 1985498473; + $itemsUpdated = 722513724; + $expectedResponse = new FileUpload(); + $expectedResponse->setName($name2); + $expectedResponse->setDataSourceId($dataSourceId); + $expectedResponse->setItemsTotal($itemsTotal); + $expectedResponse->setItemsCreated($itemsCreated); + $expectedResponse->setItemsUpdated($itemsUpdated); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->fileUploadName('[ACCOUNT]', '[DATASOURCE]', '[FILEUPLOAD]'); + $request = (new GetFileUploadRequest())->setName($formattedName); + $response = $gapicClient->getFileUploadAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.datasources.v1beta.FileUploadsService/GetFileUpload', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/ShoppingMerchantDatasources/.OwlBot.yaml b/ShoppingMerchantDatasources/.OwlBot.yaml deleted file mode 100644 index 49e75ace32d4..000000000000 --- a/ShoppingMerchantDatasources/.OwlBot.yaml +++ /dev/null @@ -1,4 +0,0 @@ -deep-copy-regex: - - source: /google/shopping/merchant/datasources/(v1beta)/.*-php/(.*) - dest: /owl-bot-staging/ShoppingMerchantDatasources/$1/$2 -api-name: ShoppingMerchantDatasources diff --git a/composer.json b/composer.json index 391e3b7e1aef..1ee42b70ccbb 100644 --- a/composer.json +++ b/composer.json @@ -466,7 +466,7 @@ "GPBMetadata\\Google\\Shopping\\Css\\": "ShoppingCss/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Accounts\\": "ShoppingMerchantAccounts/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Conversions\\": "ShoppingMerchantConversions/metadata", - "GPBMetadata\\Google\\Shopping\\Merchant\\Datasources\\": "ShoppingMerchantDatasources/metadata", + "GPBMetadata\\Google\\Shopping\\Merchant\\Datasources\\": "ShoppingMerchantDataSources/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Inventories\\": "ShoppingMerchantInventories/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Lfp\\": "ShoppingMerchantLfp/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Notifications\\": "ShoppingMerchantNotifications/metadata", @@ -675,7 +675,7 @@ "Google\\Shopping\\Css\\": "ShoppingCss/src", "Google\\Shopping\\Merchant\\Accounts\\": "ShoppingMerchantAccounts/src", "Google\\Shopping\\Merchant\\Conversions\\": "ShoppingMerchantConversions/src", - "Google\\Shopping\\Merchant\\Datasources\\": "ShoppingMerchantDatasources/src", + "Google\\Shopping\\Merchant\\DataSources\\": "ShoppingMerchantDataSources/src", "Google\\Shopping\\Merchant\\Inventories\\": "ShoppingMerchantInventories/src", "Google\\Shopping\\Merchant\\Lfp\\": "ShoppingMerchantLfp/src", "Google\\Shopping\\Merchant\\Notifications\\": "ShoppingMerchantNotifications/src",