Completed
Push — master ( c2e1e4...22c8ee )
by
unknown
04:32
created

ProductGroup::getProductSets()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 2
eloc 16
nc 2
nop 3
1
<?php
2
/**
3
 * Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
4
 *
5
 * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
 * use, copy, modify, and distribute this software in source code or binary
7
 * form for use in connection with the web services and APIs provided by
8
 * Facebook.
9
 *
10
 * As with any software that integrates with the Facebook platform, your use
11
 * of this software is subject to the Facebook Developer Principles and
12
 * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
 * shall be included in all copies or substantial portions of the software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 * DEALINGS IN THE SOFTWARE.
22
 *
23
 */
24
25
namespace FacebookAds\Object;
26
27
use FacebookAds\ApiRequest;
28
use FacebookAds\Cursor;
29
use FacebookAds\Http\RequestInterface;
30
use FacebookAds\TypeChecker;
31
use FacebookAds\Object\Fields\ProductGroupFields;
32
use FacebookAds\Object\Values\ProductItemAvailabilityValues;
33
use FacebookAds\Object\Values\ProductItemConditionValues;
34
use FacebookAds\Object\Values\ProductItemGenderValues;
35
use FacebookAds\Object\Values\ProductItemVisibilityValues;
36
37
/**
38
 * This class is auto-generated.
39
 *
40
 * For any issues or feature requests related to this class, please let us know
41
 * on github and we'll fix in our codegen framework. We'll not be able to accept
42
 * pull request for this class.
43
 *
44
 */
45
46
class ProductGroup extends AbstractCrudObject {
47
48
  /**
49
   * @deprecated getEndpoint function is deprecated
50
   */
51
  protected function getEndpoint() {
52
    return 'product_groups';
53
  }
54
55
  /**
56
   * @return ProductGroupFields
57
   */
58
  public static function getFieldsEnum() {
59
    return ProductGroupFields::getInstance();
60
  }
61
62
  protected static function getReferencedEnums() {
63
    $ref_enums = array();
64
    return $ref_enums;
65
  }
66
67
68
  public function getProducts(array $fields = array(), array $params = array(), $pending = false) {
69
    $this->assureId();
70
71
    $param_types = array(
72
    );
73
    $enums = array(
74
    );
75
76
    $request = new ApiRequest(
77
      $this->api,
78
      $this->data['id'],
79
      RequestInterface::METHOD_GET,
80
      '/products',
81
      new ProductItem(),
82
      'EDGE',
83
      ProductItem::getFieldsEnum()->getValues(),
84
      new TypeChecker($param_types, $enums)
85
    );
86
    $request->addParams($params);
87
    $request->addFields($fields);
88
    return $pending ? $request : $request->execute();
89
  }
90
91
  public function createProduct(array $fields = array(), array $params = array(), $pending = false) {
92
    $this->assureId();
93
94
    $param_types = array(
95
      'additional_image_urls' => 'list<string>',
96
      'android_app_name' => 'string',
97
      'android_class' => 'string',
98
      'android_package' => 'string',
99
      'android_url' => 'string',
100
      'availability' => 'availability_enum',
101
      'brand' => 'string',
102
      'category' => 'string',
103
      'checkout_url' => 'string',
104
      'color' => 'string',
105
      'condition' => 'condition_enum',
106
      'currency' => 'string',
107
      'custom_data' => 'map',
108
      'custom_label_0' => 'string',
109
      'custom_label_1' => 'string',
110
      'custom_label_2' => 'string',
111
      'custom_label_3' => 'string',
112
      'custom_label_4' => 'string',
113
      'description' => 'string',
114
      'expiration_date' => 'string',
115
      'gender' => 'gender_enum',
116
      'gtin' => 'string',
117
      'image_url' => 'string',
118
      'inventory' => 'unsigned int',
119
      'ios_app_name' => 'string',
120
      'ios_app_store_id' => 'unsigned int',
121
      'ios_url' => 'string',
122
      'ipad_app_name' => 'string',
123
      'ipad_app_store_id' => 'unsigned int',
124
      'ipad_url' => 'string',
125
      'iphone_app_name' => 'string',
126
      'iphone_app_store_id' => 'unsigned int',
127
      'iphone_url' => 'string',
128
      'manufacturer_part_number' => 'string',
129
      'material' => 'string',
130
      'name' => 'string',
131
      'ordering_index' => 'unsigned int',
132
      'pattern' => 'string',
133
      'price' => 'unsigned int',
134
      'product_type' => 'string',
135
      'retailer_id' => 'string',
136
      'sale_price' => 'unsigned int',
137
      'sale_price_end_date' => 'datetime',
138
      'sale_price_start_date' => 'datetime',
139
      'short_description' => 'string',
140
      'size' => 'string',
141
      'start_date' => 'string',
142
      'url' => 'string',
143
      'visibility' => 'visibility_enum',
144
      'windows_phone_app_id' => 'string',
145
      'windows_phone_app_name' => 'string',
146
      'windows_phone_url' => 'string',
147
    );
148
    $enums = array(
149
      'availability_enum' => ProductItemAvailabilityValues::getInstance()->getValues(),
150
      'condition_enum' => ProductItemConditionValues::getInstance()->getValues(),
151
      'gender_enum' => ProductItemGenderValues::getInstance()->getValues(),
152
      'visibility_enum' => ProductItemVisibilityValues::getInstance()->getValues(),
153
    );
154
155
    $request = new ApiRequest(
156
      $this->api,
157
      $this->data['id'],
158
      RequestInterface::METHOD_POST,
159
      '/products',
160
      new ProductItem(),
161
      'EDGE',
162
      ProductItem::getFieldsEnum()->getValues(),
163
      new TypeChecker($param_types, $enums)
164
    );
165
    $request->addParams($params);
166
    $request->addFields($fields);
167
    return $pending ? $request : $request->execute();
168
  }
169
170
  public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
171
    $this->assureId();
172
173
    $param_types = array(
174
    );
175
    $enums = array(
176
    );
177
178
    $request = new ApiRequest(
179
      $this->api,
180
      $this->data['id'],
181
      RequestInterface::METHOD_DELETE,
182
      '/',
183
      new AbstractCrudObject(),
184
      'NODE',
185
      array(),
186
      new TypeChecker($param_types, $enums)
187
    );
188
    $request->addParams($params);
189
    $request->addFields($fields);
190
    return $pending ? $request : $request->execute();
191
  }
192
193
  public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
194
    $this->assureId();
195
196
    $param_types = array(
197
    );
198
    $enums = array(
199
    );
200
201
    $request = new ApiRequest(
202
      $this->api,
203
      $this->data['id'],
204
      RequestInterface::METHOD_GET,
205
      '/',
206
      new ProductGroup(),
207
      'NODE',
208
      ProductGroup::getFieldsEnum()->getValues(),
209
      new TypeChecker($param_types, $enums)
210
    );
211
    $request->addParams($params);
212
    $request->addFields($fields);
213
    return $pending ? $request : $request->execute();
214
  }
215
216
  public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
217
    $this->assureId();
218
219
    $param_types = array(
220
      'variants' => 'list<Object>',
221
    );
222
    $enums = array(
223
    );
224
225
    $request = new ApiRequest(
226
      $this->api,
227
      $this->data['id'],
228
      RequestInterface::METHOD_POST,
229
      '/',
230
      new ProductGroup(),
231
      'NODE',
232
      ProductGroup::getFieldsEnum()->getValues(),
233
      new TypeChecker($param_types, $enums)
234
    );
235
    $request->addParams($params);
236
    $request->addFields($fields);
237
    return $pending ? $request : $request->execute();
238
  }
239
240
}
241