1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\ShoppingContent\Resource; 19 20use Google\Service\ShoppingContent\Product; 21use Google\Service\ShoppingContent\ProductsCustomBatchRequest; 22use Google\Service\ShoppingContent\ProductsCustomBatchResponse; 23use Google\Service\ShoppingContent\ProductsListResponse; 24 25/** 26 * The "products" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $contentService = new Google\Service\ShoppingContent(...); 30 * $products = $contentService->products; 31 * </code> 32 */ 33class Products extends \Google\Service\Resource 34{ 35 /** 36 * Retrieves, inserts, and deletes multiple products in a single request. 37 * (products.custombatch) 38 * 39 * @param ProductsCustomBatchRequest $postBody 40 * @param array $optParams Optional parameters. 41 * @return ProductsCustomBatchResponse 42 */ 43 public function custombatch(ProductsCustomBatchRequest $postBody, $optParams = []) 44 { 45 $params = ['postBody' => $postBody]; 46 $params = array_merge($params, $optParams); 47 return $this->call('custombatch', [$params], ProductsCustomBatchResponse::class); 48 } 49 /** 50 * Deletes a product from your Merchant Center account. (products.delete) 51 * 52 * @param string $merchantId The ID of the account that contains the product. 53 * This account cannot be a multi-client account. 54 * @param string $productId The REST ID of the product. 55 * @param array $optParams Optional parameters. 56 * 57 * @opt_param string feedId The Content API Supplemental Feed ID. If present 58 * then product deletion applies to the data in a supplemental feed. If absent, 59 * entire product will be deleted. 60 */ 61 public function delete($merchantId, $productId, $optParams = []) 62 { 63 $params = ['merchantId' => $merchantId, 'productId' => $productId]; 64 $params = array_merge($params, $optParams); 65 return $this->call('delete', [$params]); 66 } 67 /** 68 * Retrieves a product from your Merchant Center account. (products.get) 69 * 70 * @param string $merchantId The ID of the account that contains the product. 71 * This account cannot be a multi-client account. 72 * @param string $productId The REST ID of the product. 73 * @param array $optParams Optional parameters. 74 * @return Product 75 */ 76 public function get($merchantId, $productId, $optParams = []) 77 { 78 $params = ['merchantId' => $merchantId, 'productId' => $productId]; 79 $params = array_merge($params, $optParams); 80 return $this->call('get', [$params], Product::class); 81 } 82 /** 83 * Uploads a product to your Merchant Center account. If an item with the same 84 * channel, contentLanguage, offerId, and targetCountry already exists, this 85 * method updates that entry. (products.insert) 86 * 87 * @param string $merchantId The ID of the account that contains the product. 88 * This account cannot be a multi-client account. 89 * @param Product $postBody 90 * @param array $optParams Optional parameters. 91 * 92 * @opt_param string feedId The Content API Supplemental Feed ID. If present 93 * then product insertion applies to the data in a supplemental feed. 94 * @return Product 95 */ 96 public function insert($merchantId, Product $postBody, $optParams = []) 97 { 98 $params = ['merchantId' => $merchantId, 'postBody' => $postBody]; 99 $params = array_merge($params, $optParams); 100 return $this->call('insert', [$params], Product::class); 101 } 102 /** 103 * Lists the products in your Merchant Center account. The response might 104 * contain fewer items than specified by maxResults. Rely on nextPageToken to 105 * determine if there are more items to be requested. (products.listProducts) 106 * 107 * @param string $merchantId The ID of the account that contains the products. 108 * This account cannot be a multi-client account. 109 * @param array $optParams Optional parameters. 110 * 111 * @opt_param string maxResults The maximum number of products to return in the 112 * response, used for paging. 113 * @opt_param string pageToken The token returned by the previous request. 114 * @return ProductsListResponse 115 */ 116 public function listProducts($merchantId, $optParams = []) 117 { 118 $params = ['merchantId' => $merchantId]; 119 $params = array_merge($params, $optParams); 120 return $this->call('list', [$params], ProductsListResponse::class); 121 } 122 /** 123 * Updates an existing product in your Merchant Center account. Only updates 124 * attributes provided in the request. (products.update) 125 * 126 * @param string $merchantId The ID of the account that contains the product. 127 * This account cannot be a multi-client account. 128 * @param string $productId The REST ID of the product for which to update. 129 * @param Product $postBody 130 * @param array $optParams Optional parameters. 131 * 132 * @opt_param string updateMask The comma-separated list of product attributes 133 * to be updated. Example: `"title,salePrice"`. Attributes specified in the 134 * update mask without a value specified in the body will be deleted from the 135 * product. Only top-level product attributes can be updated. If not defined, 136 * product attributes with set values will be updated and other attributes will 137 * stay unchanged. 138 * @return Product 139 */ 140 public function update($merchantId, $productId, Product $postBody, $optParams = []) 141 { 142 $params = ['merchantId' => $merchantId, 'productId' => $productId, 'postBody' => $postBody]; 143 $params = array_merge($params, $optParams); 144 return $this->call('update', [$params], Product::class); 145 } 146} 147 148// Adding a class alias for backwards compatibility with the previous class name. 149class_alias(Products::class, 'Google_Service_ShoppingContent_Resource_Products'); 150