Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ShoppingMerchantInventories/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'--package=@prettier/plugin-php@^0.19',
'--',
'prettier',
'**/Gapic/*',
'**/Client/*',
'--write',
'--parser=php',
'--single-quote',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ final class LocalInventoryServiceClient
*
* @internal
*/
public static $serviceScopes = [
'https://www.googleapis.com/auth/content',
];
public static $serviceScopes = ['https://www.googleapis.com/auth/content'];

private static function getClientDefaults()
{
Expand Down Expand Up @@ -345,8 +343,10 @@ public function insertLocalInventory(InsertLocalInventoryRequest $request, array
*
* @throws ApiException Thrown if the API call fails.
*/
public function listLocalInventories(ListLocalInventoriesRequest $request, array $callOptions = []): PagedListResponse
{
public function listLocalInventories(
ListLocalInventoriesRequest $request,
array $callOptions = []
): PagedListResponse {
return $this->startApiCall('ListLocalInventories', $request, $callOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ final class RegionalInventoryServiceClient
*
* @internal
*/
public static $serviceScopes = [
'https://www.googleapis.com/auth/content',
];
public static $serviceScopes = ['https://www.googleapis.com/auth/content'];

private static function getClientDefaults()
{
Expand All @@ -103,7 +101,8 @@ private static function getClientDefaults()
],
'transportConfig' => [
'rest' => [
'restClientConfigPath' => __DIR__ . '/../resources/regional_inventory_service_rest_client_config.php',
'restClientConfigPath' =>
__DIR__ . '/../resources/regional_inventory_service_rest_client_config.php',
],
],
];
Expand Down Expand Up @@ -314,8 +313,10 @@ public function deleteRegionalInventory(DeleteRegionalInventoryRequest $request,
*
* @throws ApiException Thrown if the API call fails.
*/
public function insertRegionalInventory(InsertRegionalInventoryRequest $request, array $callOptions = []): RegionalInventory
{
public function insertRegionalInventory(
InsertRegionalInventoryRequest $request,
array $callOptions = []
): RegionalInventory {
return $this->startApiCall('InsertRegionalInventory', $request, $callOptions)->wait();
}

Expand Down Expand Up @@ -346,8 +347,10 @@ public function insertRegionalInventory(InsertRegionalInventoryRequest $request,
*
* @throws ApiException Thrown if the API call fails.
*/
public function listRegionalInventories(ListRegionalInventoriesRequest $request, array $callOptions = []): PagedListResponse
{
public function listRegionalInventories(
ListRegionalInventoriesRequest $request,
array $callOptions = []
): PagedListResponse {
return $this->startApiCall('ListRegionalInventories', $request, $callOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ final class LocalInventoryServiceClient
*
* @internal
*/
public static $serviceScopes = [
'https://www.googleapis.com/auth/content',
];
public static $serviceScopes = ['https://www.googleapis.com/auth/content'];

private static function getClientDefaults()
{
Expand Down Expand Up @@ -363,8 +361,10 @@ public function insertLocalInventory(InsertLocalInventoryRequest $request, array
*
* @experimental
*/
public function listLocalInventories(ListLocalInventoriesRequest $request, array $callOptions = []): PagedListResponse
{
public function listLocalInventories(
ListLocalInventoriesRequest $request,
array $callOptions = []
): PagedListResponse {
return $this->startApiCall('ListLocalInventories', $request, $callOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ final class RegionalInventoryServiceClient
*
* @internal
*/
public static $serviceScopes = [
'https://www.googleapis.com/auth/content',
];
public static $serviceScopes = ['https://www.googleapis.com/auth/content'];

private static function getClientDefaults()
{
Expand All @@ -107,7 +105,8 @@ private static function getClientDefaults()
],
'transportConfig' => [
'rest' => [
'restClientConfigPath' => __DIR__ . '/../resources/regional_inventory_service_rest_client_config.php',
'restClientConfigPath' =>
__DIR__ . '/../resources/regional_inventory_service_rest_client_config.php',
],
],
];
Expand Down Expand Up @@ -330,8 +329,10 @@ public function deleteRegionalInventory(DeleteRegionalInventoryRequest $request,
*
* @experimental
*/
public function insertRegionalInventory(InsertRegionalInventoryRequest $request, array $callOptions = []): RegionalInventory
{
public function insertRegionalInventory(
InsertRegionalInventoryRequest $request,
array $callOptions = []
): RegionalInventory {
return $this->startApiCall('InsertRegionalInventory', $request, $callOptions)->wait();
}

Expand Down Expand Up @@ -364,8 +365,10 @@ public function insertRegionalInventory(InsertRegionalInventoryRequest $request,
*
* @experimental
*/
public function listRegionalInventories(ListRegionalInventoriesRequest $request, array $callOptions = []): PagedListResponse
{
public function listRegionalInventories(
ListRegionalInventoriesRequest $request,
array $callOptions = []
): PagedListResponse {
return $this->startApiCall('ListRegionalInventories', $request, $callOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ private function createTransport($deserialize = null)
/** @return CredentialsWrapper */
private function createCredentials()
{
return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
return $this->getMockBuilder(CredentialsWrapper::class)
->disableOriginalConstructor()
->getMock();
}

/** @return LocalInventoryServiceClient */
Expand All @@ -77,14 +79,16 @@ public function deleteLocalInventoryTest()
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $gapicClient->localInventoryName('[ACCOUNT]', '[PRODUCT]', '[STORE_CODE]');
$request = (new DeleteLocalInventoryRequest())
->setName($formattedName);
$request = (new DeleteLocalInventoryRequest())->setName($formattedName);
$gapicClient->deleteLocalInventory($request);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
$this->assertSame('/google.shopping.merchant.inventories.v1.LocalInventoryService/DeleteLocalInventory', $actualFuncCall);
$this->assertSame(
'/google.shopping.merchant.inventories.v1.LocalInventoryService/DeleteLocalInventory',
$actualFuncCall
);
$actualValue = $actualRequestObject->getName();
$this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
Expand All @@ -101,17 +105,19 @@ public function deleteLocalInventoryExceptionTest()
$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);
$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->localInventoryName('[ACCOUNT]', '[PRODUCT]', '[STORE_CODE]');
$request = (new DeleteLocalInventoryRequest())
->setName($formattedName);
$request = (new DeleteLocalInventoryRequest())->setName($formattedName);
try {
$gapicClient->deleteLocalInventory($request);
// If the $gapicClient method call did not throw, fail the test
Expand Down Expand Up @@ -149,16 +155,17 @@ public function insertLocalInventoryTest()
$localInventory = new LocalInventory();
$localInventoryStoreCode = 'localInventoryStoreCode1126909757';
$localInventory->setStoreCode($localInventoryStoreCode);
$request = (new InsertLocalInventoryRequest())
->setParent($formattedParent)
->setLocalInventory($localInventory);
$request = (new InsertLocalInventoryRequest())->setParent($formattedParent)->setLocalInventory($localInventory);
$response = $gapicClient->insertLocalInventory($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.inventories.v1.LocalInventoryService/InsertLocalInventory', $actualFuncCall);
$this->assertSame(
'/google.shopping.merchant.inventories.v1.LocalInventoryService/InsertLocalInventory',
$actualFuncCall
);
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$actualValue = $actualRequestObject->getLocalInventory();
Expand All @@ -177,21 +184,22 @@ public function insertLocalInventoryExceptionTest()
$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);
$expectedExceptionMessage = json_encode(
[
'message' => 'internal error',
'code' => Code::DATA_LOSS,
'status' => 'DATA_LOSS',
'details' => [],
],
JSON_PRETTY_PRINT
);
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->productName('[ACCOUNT]', '[PRODUCT]');
$localInventory = new LocalInventory();
$localInventoryStoreCode = 'localInventoryStoreCode1126909757';
$localInventory->setStoreCode($localInventoryStoreCode);
$request = (new InsertLocalInventoryRequest())
->setParent($formattedParent)
->setLocalInventory($localInventory);
$request = (new InsertLocalInventoryRequest())->setParent($formattedParent)->setLocalInventory($localInventory);
try {
$gapicClient->insertLocalInventory($request);
// If the $gapicClient method call did not throw, fail the test
Expand All @@ -216,17 +224,14 @@ public function listLocalInventoriesTest()
// Mock response
$nextPageToken = '';
$localInventoriesElement = new LocalInventory();
$localInventories = [
$localInventoriesElement,
];
$localInventories = [$localInventoriesElement];
$expectedResponse = new ListLocalInventoriesResponse();
$expectedResponse->setNextPageToken($nextPageToken);
$expectedResponse->setLocalInventories($localInventories);
$transport->addResponse($expectedResponse);
// Mock request
$formattedParent = $gapicClient->productName('[ACCOUNT]', '[PRODUCT]');
$request = (new ListLocalInventoriesRequest())
->setParent($formattedParent);
$request = (new ListLocalInventoriesRequest())->setParent($formattedParent);
$response = $gapicClient->listLocalInventories($request);
$this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
$resources = iterator_to_array($response->iterateAllElements());
Expand All @@ -236,7 +241,10 @@ public function listLocalInventoriesTest()
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
$this->assertSame('/google.shopping.merchant.inventories.v1.LocalInventoryService/ListLocalInventories', $actualFuncCall);
$this->assertSame(
'/google.shopping.merchant.inventories.v1.LocalInventoryService/ListLocalInventories',
$actualFuncCall
);
$actualValue = $actualRequestObject->getParent();
$this->assertProtobufEquals($formattedParent, $actualValue);
$this->assertTrue($transport->isExhausted());
Expand All @@ -253,17 +261,19 @@ public function listLocalInventoriesExceptionTest()
$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);
$expectedExceptionMessage = json_encode(
[
'message' => 'internal error',
'code' => Code::DATA_LOSS,
'status' => 'DATA_LOSS',
'details' => [],
],
JSON_PRETTY_PRINT
);
$transport->addResponse(null, $status);
// Mock request
$formattedParent = $gapicClient->productName('[ACCOUNT]', '[PRODUCT]');
$request = (new ListLocalInventoriesRequest())
->setParent($formattedParent);
$request = (new ListLocalInventoriesRequest())->setParent($formattedParent);
try {
$gapicClient->listLocalInventories($request);
// If the $gapicClient method call did not throw, fail the test
Expand All @@ -290,14 +300,16 @@ public function deleteLocalInventoryAsyncTest()
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $gapicClient->localInventoryName('[ACCOUNT]', '[PRODUCT]', '[STORE_CODE]');
$request = (new DeleteLocalInventoryRequest())
->setName($formattedName);
$request = (new DeleteLocalInventoryRequest())->setName($formattedName);
$gapicClient->deleteLocalInventoryAsync($request)->wait();
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();
$actualRequestObject = $actualRequests[0]->getRequestObject();
$this->assertSame('/google.shopping.merchant.inventories.v1.LocalInventoryService/DeleteLocalInventory', $actualFuncCall);
$this->assertSame(
'/google.shopping.merchant.inventories.v1.LocalInventoryService/DeleteLocalInventory',
$actualFuncCall
);
$actualValue = $actualRequestObject->getName();
$this->assertProtobufEquals($formattedName, $actualValue);
$this->assertTrue($transport->isExhausted());
Expand Down
Loading
Loading