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\Datafeed;
21use Google\Service\ShoppingContent\DatafeedsCustomBatchRequest;
22use Google\Service\ShoppingContent\DatafeedsCustomBatchResponse;
23use Google\Service\ShoppingContent\DatafeedsFetchNowResponse;
24use Google\Service\ShoppingContent\DatafeedsListResponse;
25
26/**
27 * The "datafeeds" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $contentService = new Google\Service\ShoppingContent(...);
31 *   $datafeeds = $contentService->datafeeds;
32 *  </code>
33 */
34class Datafeeds extends \Google\Service\Resource
35{
36  /**
37   * Deletes, fetches, gets, inserts and updates multiple datafeeds in a single
38   * request. (datafeeds.custombatch)
39   *
40   * @param DatafeedsCustomBatchRequest $postBody
41   * @param array $optParams Optional parameters.
42   * @return DatafeedsCustomBatchResponse
43   */
44  public function custombatch(DatafeedsCustomBatchRequest $postBody, $optParams = [])
45  {
46    $params = ['postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('custombatch', [$params], DatafeedsCustomBatchResponse::class);
49  }
50  /**
51   * Deletes a datafeed configuration from your Merchant Center account.
52   * (datafeeds.delete)
53   *
54   * @param string $merchantId The ID of the account that manages the datafeed.
55   * This account cannot be a multi-client account.
56   * @param string $datafeedId The ID of the datafeed.
57   * @param array $optParams Optional parameters.
58   */
59  public function delete($merchantId, $datafeedId, $optParams = [])
60  {
61    $params = ['merchantId' => $merchantId, 'datafeedId' => $datafeedId];
62    $params = array_merge($params, $optParams);
63    return $this->call('delete', [$params]);
64  }
65  /**
66   * Invokes a fetch for the datafeed in your Merchant Center account. If you need
67   * to call this method more than once per day, we recommend you use the Products
68   * service to update your product data. (datafeeds.fetchnow)
69   *
70   * @param string $merchantId The ID of the account that manages the datafeed.
71   * This account cannot be a multi-client account.
72   * @param string $datafeedId The ID of the datafeed to be fetched.
73   * @param array $optParams Optional parameters.
74   * @return DatafeedsFetchNowResponse
75   */
76  public function fetchnow($merchantId, $datafeedId, $optParams = [])
77  {
78    $params = ['merchantId' => $merchantId, 'datafeedId' => $datafeedId];
79    $params = array_merge($params, $optParams);
80    return $this->call('fetchnow', [$params], DatafeedsFetchNowResponse::class);
81  }
82  /**
83   * Retrieves a datafeed configuration from your Merchant Center account.
84   * (datafeeds.get)
85   *
86   * @param string $merchantId The ID of the account that manages the datafeed.
87   * This account cannot be a multi-client account.
88   * @param string $datafeedId The ID of the datafeed.
89   * @param array $optParams Optional parameters.
90   * @return Datafeed
91   */
92  public function get($merchantId, $datafeedId, $optParams = [])
93  {
94    $params = ['merchantId' => $merchantId, 'datafeedId' => $datafeedId];
95    $params = array_merge($params, $optParams);
96    return $this->call('get', [$params], Datafeed::class);
97  }
98  /**
99   * Registers a datafeed configuration with your Merchant Center account.
100   * (datafeeds.insert)
101   *
102   * @param string $merchantId The ID of the account that manages the datafeed.
103   * This account cannot be a multi-client account.
104   * @param Datafeed $postBody
105   * @param array $optParams Optional parameters.
106   * @return Datafeed
107   */
108  public function insert($merchantId, Datafeed $postBody, $optParams = [])
109  {
110    $params = ['merchantId' => $merchantId, 'postBody' => $postBody];
111    $params = array_merge($params, $optParams);
112    return $this->call('insert', [$params], Datafeed::class);
113  }
114  /**
115   * Lists the configurations for datafeeds in your Merchant Center account.
116   * (datafeeds.listDatafeeds)
117   *
118   * @param string $merchantId The ID of the account that manages the datafeeds.
119   * This account cannot be a multi-client account.
120   * @param array $optParams Optional parameters.
121   *
122   * @opt_param string maxResults The maximum number of products to return in the
123   * response, used for paging.
124   * @opt_param string pageToken The token returned by the previous request.
125   * @return DatafeedsListResponse
126   */
127  public function listDatafeeds($merchantId, $optParams = [])
128  {
129    $params = ['merchantId' => $merchantId];
130    $params = array_merge($params, $optParams);
131    return $this->call('list', [$params], DatafeedsListResponse::class);
132  }
133  /**
134   * Updates a datafeed configuration of your Merchant Center account. Any fields
135   * that are not provided are deleted from the resource. (datafeeds.update)
136   *
137   * @param string $merchantId The ID of the account that manages the datafeed.
138   * This account cannot be a multi-client account.
139   * @param string $datafeedId The ID of the datafeed.
140   * @param Datafeed $postBody
141   * @param array $optParams Optional parameters.
142   * @return Datafeed
143   */
144  public function update($merchantId, $datafeedId, Datafeed $postBody, $optParams = [])
145  {
146    $params = ['merchantId' => $merchantId, 'datafeedId' => $datafeedId, 'postBody' => $postBody];
147    $params = array_merge($params, $optParams);
148    return $this->call('update', [$params], Datafeed::class);
149  }
150}
151
152// Adding a class alias for backwards compatibility with the previous class name.
153class_alias(Datafeeds::class, 'Google_Service_ShoppingContent_Resource_Datafeeds');
154