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 |
|
---|
18 | namespace Google\Service\ShoppingContent\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ShoppingContent\ListPromotionResponse;
|
---|
21 | use Google\Service\ShoppingContent\Promotion;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "promotions" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $contentService = new Google\Service\ShoppingContent(...);
|
---|
28 | * $promotions = $contentService->promotions;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Promotions extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Inserts a promotion for your Merchant Center account. If the promotion
|
---|
35 | * already exists, then it updates the promotion instead. To [end or delete]
|
---|
36 | * (https://developers.google.com/shopping-
|
---|
37 | * content/guides/promotions#end_a_promotion) a promotion update the time period
|
---|
38 | * of the promotion to a time that has already passed. (promotions.create)
|
---|
39 | *
|
---|
40 | * @param string $merchantId Required. The ID of the account that contains the
|
---|
41 | * collection.
|
---|
42 | * @param Promotion $postBody
|
---|
43 | * @param array $optParams Optional parameters.
|
---|
44 | * @return Promotion
|
---|
45 | * @throws \Google\Service\Exception
|
---|
46 | */
|
---|
47 | public function create($merchantId, Promotion $postBody, $optParams = [])
|
---|
48 | {
|
---|
49 | $params = ['merchantId' => $merchantId, 'postBody' => $postBody];
|
---|
50 | $params = array_merge($params, $optParams);
|
---|
51 | return $this->call('create', [$params], Promotion::class);
|
---|
52 | }
|
---|
53 | /**
|
---|
54 | * Retrieves a promotion from your Merchant Center account. (promotions.get)
|
---|
55 | *
|
---|
56 | * @param string $merchantId Required. The ID of the account that contains the
|
---|
57 | * collection.
|
---|
58 | * @param string $id Required. REST ID of the promotion to retrieve.
|
---|
59 | * @param array $optParams Optional parameters.
|
---|
60 | * @return Promotion
|
---|
61 | * @throws \Google\Service\Exception
|
---|
62 | */
|
---|
63 | public function get($merchantId, $id, $optParams = [])
|
---|
64 | {
|
---|
65 | $params = ['merchantId' => $merchantId, 'id' => $id];
|
---|
66 | $params = array_merge($params, $optParams);
|
---|
67 | return $this->call('get', [$params], Promotion::class);
|
---|
68 | }
|
---|
69 | /**
|
---|
70 | * List all promotions from your Merchant Center account.
|
---|
71 | * (promotions.listPromotions)
|
---|
72 | *
|
---|
73 | * @param string $merchantId Required. The ID of the account that contains the
|
---|
74 | * collection.
|
---|
75 | * @param array $optParams Optional parameters.
|
---|
76 | *
|
---|
77 | * @opt_param string countryCode [CLDR country
|
---|
78 | * code](http://www.unicode.org/repos/cldr/tags/latest/common/main/en.xml) (for
|
---|
79 | * example, "US"), used as a filter on promotions target country.
|
---|
80 | * @opt_param string languageCode The two-letter ISO 639-1 language code
|
---|
81 | * associated with the promotions, used as a filter.
|
---|
82 | * @opt_param int pageSize The maximum number of promotions to return. The
|
---|
83 | * service may return fewer than this value. If unspecified, at most 50 labels
|
---|
84 | * will be returned. The maximum value is 1000; values above 1000 will be
|
---|
85 | * coerced to 1000.
|
---|
86 | * @opt_param string pageToken A page token, received from a previous
|
---|
87 | * `ListPromotion` call. Provide this to retrieve the subsequent page. When
|
---|
88 | * paginating, all other parameters provided to `ListPromotion` must match the
|
---|
89 | * call that provided the page token.
|
---|
90 | * @return ListPromotionResponse
|
---|
91 | * @throws \Google\Service\Exception
|
---|
92 | */
|
---|
93 | public function listPromotions($merchantId, $optParams = [])
|
---|
94 | {
|
---|
95 | $params = ['merchantId' => $merchantId];
|
---|
96 | $params = array_merge($params, $optParams);
|
---|
97 | return $this->call('list', [$params], ListPromotionResponse::class);
|
---|
98 | }
|
---|
99 | }
|
---|
100 |
|
---|
101 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
102 | class_alias(Promotions::class, 'Google_Service_ShoppingContent_Resource_Promotions');
|
---|