Skip to content

Commit

Permalink
feat: Add FileUploads service (#7702)
Browse files Browse the repository at this point in the history
docs: A comment for enum value `PRODUCTS` in enum `Channel` is changed
PiperOrigin-RevId: 678641097
Source-Link: googleapis/googleapis@9c4c174
Source-Link: googleapis/googleapis-gen@13cfe50
Copy-Tag: eyJwIjoiU2hvcHBpbmdNZXJjaGFudERhdGFzb3VyY2VzLy5Pd2xCb3QueWFtbCIsImgiOiIxM2NmZTUwNGE2ZjBhZWRjMDQxNmMyMzg1MWYyNzgxNTc4MzRmOTA1In0=

* fix directory casing from new PHP namespace
Co-authored-by: Brent Shaffer <[email protected]>
  • Loading branch information
gcf-owl-bot[bot] and bshaffer authored Sep 27, 2024
1 parent abe3c50 commit 51c6ec1
Show file tree
Hide file tree
Showing 61 changed files with 1,950 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .repo-metadata-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@
"library_type": "GAPIC_AUTO",
"api_shortname": "merchantapi"
},
"ShoppingMerchantDatasources": {
"ShoppingMerchantDataSources": {
"language": "php",
"distribution_name": "google/shopping-merchant-datasources",
"release_level": "preview",
Expand Down
4 changes: 4 additions & 0 deletions ShoppingMerchantDataSources/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deep-copy-regex:
- source: /google/shopping/merchant/datasources/(v1beta)/.*-php/(.*)
dest: /owl-bot-staging/ShoppingMerchantDataSources/$1/$2
api-name: ShoppingMerchantDataSources
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $ git clone [email protected]: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).
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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"
}
},
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

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

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

// [START merchantapi_v1beta_generated_FileUploadsService_GetFileUpload_sync]
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\DataSources\V1beta\Client\FileUploadsServiceClient;
use Google\Shopping\Merchant\DataSources\V1beta\FileUpload;
use Google\Shopping\Merchant\DataSources\V1beta\GetFileUploadRequest;

/**
* Gets the latest data source file upload. Only the `latest` alias is
* accepted for a file upload.
*
* @param string $formattedName 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.
*/
function get_file_upload_sample(string $formattedName): void
{
// Create a client.
$fileUploadsServiceClient = new FileUploadsServiceClient();

// Prepare the request message.
$request = (new GetFileUploadRequest())
->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]
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/**
Expand Down
Loading

0 comments on commit 51c6ec1

Please sign in to comment.