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\Collection;
21use Google\Service\ShoppingContent\ListCollectionsResponse;
22
23/**
24 * The "collections" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $contentService = new Google\Service\ShoppingContent(...);
28 *   $collections = $contentService->collections;
29 *  </code>
30 */
31class Collections extends \Google\Service\Resource
32{
33  /**
34   * Uploads a collection to your Merchant Center account. If a collection with
35   * the same collectionId already exists, this method updates that entry. In each
36   * update, the collection is completely replaced by the fields in the body of
37   * the update request. (collections.create)
38   *
39   * @param string $merchantId Required. The ID of the account that contains the
40   * collection. This account cannot be a multi-client account.
41   * @param Collection $postBody
42   * @param array $optParams Optional parameters.
43   * @return Collection
44   */
45  public function create($merchantId, Collection $postBody, $optParams = [])
46  {
47    $params = ['merchantId' => $merchantId, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('create', [$params], Collection::class);
50  }
51  /**
52   * Deletes a collection from your Merchant Center account. (collections.delete)
53   *
54   * @param string $merchantId Required. The ID of the account that contains the
55   * collection. This account cannot be a multi-client account.
56   * @param string $collectionId Required. The collectionId of the collection.
57   * CollectionId is the same as the REST ID of the collection.
58   * @param array $optParams Optional parameters.
59   */
60  public function delete($merchantId, $collectionId, $optParams = [])
61  {
62    $params = ['merchantId' => $merchantId, 'collectionId' => $collectionId];
63    $params = array_merge($params, $optParams);
64    return $this->call('delete', [$params]);
65  }
66  /**
67   * Retrieves a collection from your Merchant Center account. (collections.get)
68   *
69   * @param string $merchantId Required. The ID of the account that contains the
70   * collection. This account cannot be a multi-client account.
71   * @param string $collectionId Required. The REST ID of the collection.
72   * @param array $optParams Optional parameters.
73   * @return Collection
74   */
75  public function get($merchantId, $collectionId, $optParams = [])
76  {
77    $params = ['merchantId' => $merchantId, 'collectionId' => $collectionId];
78    $params = array_merge($params, $optParams);
79    return $this->call('get', [$params], Collection::class);
80  }
81  /**
82   * Lists the collections in your Merchant Center account. The response might
83   * contain fewer items than specified by page_size. Rely on next_page_token to
84   * determine if there are more items to be requested.
85   * (collections.listCollections)
86   *
87   * @param string $merchantId Required. The ID of the account that contains the
88   * collection. This account cannot be a multi-client account.
89   * @param array $optParams Optional parameters.
90   *
91   * @opt_param int pageSize The maximum number of collections to return in the
92   * response, used for paging. Defaults to 50; values above 1000 will be coerced
93   * to 1000.
94   * @opt_param string pageToken Token (if provided) to retrieve the subsequent
95   * page. All other parameters must match the original call that provided the
96   * page token.
97   * @return ListCollectionsResponse
98   */
99  public function listCollections($merchantId, $optParams = [])
100  {
101    $params = ['merchantId' => $merchantId];
102    $params = array_merge($params, $optParams);
103    return $this->call('list', [$params], ListCollectionsResponse::class);
104  }
105}
106
107// Adding a class alias for backwards compatibility with the previous class name.
108class_alias(Collections::class, 'Google_Service_ShoppingContent_Resource_Collections');
109