Completed
Push — master ( 22ee83...d51193 )
by
unknown
03:10
created

ProductGroup::deleteSelf()   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-genereated.
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 getProductSets(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
      '/product_sets',
81
      new ProductSet(),
82
      'EDGE',
83
      ProductSet::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 getProducts(array $fields = array(), array $params = array(), $pending = false) {
92
    $this->assureId();
93
94
    $param_types = array(
95
    );
96
    $enums = array(
97
    );
98
99
    $request = new ApiRequest(
100
      $this->api,
101
      $this->data['id'],
102
      RequestInterface::METHOD_GET,
103
      '/products',
104
      new ProductItem(),
105
      'EDGE',
106
      ProductItem::getFieldsEnum()->getValues(),
107
      new TypeChecker($param_types, $enums)
108
    );
109
    $request->addParams($params);
110
    $request->addFields($fields);
111
    return $pending ? $request : $request->execute();
112
  }
113
114
  public function createProduct(array $fields = array(), array $params = array(), $pending = false) {
115
    $this->assureId();
116
117
    $param_types = array(
118
      'additional_image_urls' => 'list<string>',
119
      'android_app_name' => 'string',
120
      'android_class' => 'string',
121
      'android_package' => 'string',
122
      'android_url' => 'string',
123
      'availability' => 'availability_enum',
124
      'brand' => 'string',
125
      'category' => 'string',
126
      'checkout_url' => 'string',
127
      'color' => 'string',
128
      'condition' => 'condition_enum',
129
      'currency' => 'string',
130
      'custom_data' => 'map',
131
      'custom_label_0' => 'string',
132
      'custom_label_1' => 'string',
133
      'custom_label_2' => 'string',
134
      'custom_label_3' => 'string',
135
      'custom_label_4' => 'string',
136
      'description' => 'string',
137
      'expiration_date' => 'string',
138
      'gender' => 'gender_enum',
139
      'gtin' => 'string',
140
      'image_url' => 'string',
141
      'inventory' => 'unsigned int',
142
      'ios_app_name' => 'string',
143
      'ios_app_store_id' => 'unsigned int',
144
      'ios_url' => 'string',
145
      'ipad_app_name' => 'string',
146
      'ipad_app_store_id' => 'unsigned int',
147
      'ipad_url' => 'string',
148
      'iphone_app_name' => 'string',
149
      'iphone_app_store_id' => 'unsigned int',
150
      'iphone_url' => 'string',
151
      'manufacturer_part_number' => 'string',
152
      'material' => 'string',
153
      'name' => 'string',
154
      'ordering_index' => 'unsigned int',
155
      'pattern' => 'string',
156
      'price' => 'unsigned int',
157
      'product_type' => 'string',
158
      'retailer_id' => 'string',
159
      'sale_price' => 'unsigned int',
160
      'sale_price_end_date' => 'datetime',
161
      'sale_price_start_date' => 'datetime',
162
      'short_description' => 'string',
163
      'size' => 'string',
164
      'start_date' => 'string',
165
      'url' => 'string',
166
      'visibility' => 'visibility_enum',
167
      'windows_phone_app_id' => 'unsigned int',
168
      'windows_phone_app_name' => 'string',
169
      'windows_phone_url' => 'string',
170
    );
171
    $enums = array(
172
      'availability_enum' => ProductItemAvailabilityValues::getInstance()->getValues(),
173
      'condition_enum' => ProductItemConditionValues::getInstance()->getValues(),
174
      'gender_enum' => ProductItemGenderValues::getInstance()->getValues(),
175
      'visibility_enum' => ProductItemVisibilityValues::getInstance()->getValues(),
176
    );
177
178
    $request = new ApiRequest(
179
      $this->api,
180
      $this->data['id'],
181
      RequestInterface::METHOD_POST,
182
      '/products',
183
      new ProductItem(),
184
      'EDGE',
185
      ProductItem::getFieldsEnum()->getValues(),
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 deleteSelf(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_DELETE,
205
      '/',
206
      new AbstractCrudObject(),
207
      'NODE',
208
      array(),
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 getSelf(array $fields = array(), array $params = array(), $pending = false) {
217
    $this->assureId();
218
219
    $param_types = array(
220
    );
221
    $enums = array(
222
    );
223
224
    $request = new ApiRequest(
225
      $this->api,
226
      $this->data['id'],
227
      RequestInterface::METHOD_GET,
228
      '/',
229
      new ProductGroup(),
230
      'NODE',
231
      ProductGroup::getFieldsEnum()->getValues(),
232
      new TypeChecker($param_types, $enums)
233
    );
234
    $request->addParams($params);
235
    $request->addFields($fields);
236
    return $pending ? $request : $request->execute();
237
  }
238
239
  public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
240
    $this->assureId();
241
242
    $param_types = array(
243
      'variants' => 'list<Object>',
244
    );
245
    $enums = array(
246
    );
247
248
    $request = new ApiRequest(
249
      $this->api,
250
      $this->data['id'],
251
      RequestInterface::METHOD_POST,
252
      '/',
253
      new ProductGroup(),
254
      'NODE',
255
      ProductGroup::getFieldsEnum()->getValues(),
256
      new TypeChecker($param_types, $enums)
257
    );
258
    $request->addParams($params);
259
    $request->addFields($fields);
260
    return $pending ? $request : $request->execute();
261
  }
262
263
}
264