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\ProductCatalogFields; |
32
|
|
|
use FacebookAds\Object\Values\AdVideoContentCategoryValues; |
33
|
|
|
use FacebookAds\Object\Values\AdVideoUnpublishedContentTypeValues; |
34
|
|
|
use FacebookAds\Object\Values\AdVideoUploadPhaseValues; |
35
|
|
|
use FacebookAds\Object\Values\ProductCatalogHotelRoomsBatchStandardValues; |
36
|
|
|
use FacebookAds\Object\Values\ProductCatalogPricingVariablesBatchStandardValues; |
37
|
|
|
use FacebookAds\Object\Values\ProductCatalogVerticalValues; |
38
|
|
|
use FacebookAds\Object\Values\ProductFeedDelimiterValues; |
39
|
|
|
use FacebookAds\Object\Values\ProductFeedEncodingValues; |
40
|
|
|
use FacebookAds\Object\Values\ProductFeedQuotedFieldsModeValues; |
41
|
|
|
use FacebookAds\Object\Values\ProductItemAvailabilityValues; |
42
|
|
|
use FacebookAds\Object\Values\ProductItemConditionValues; |
43
|
|
|
use FacebookAds\Object\Values\ProductItemGenderValues; |
44
|
|
|
use FacebookAds\Object\Values\ProductItemVisibilityValues; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* This class is auto-genereated. |
48
|
|
|
* |
49
|
|
|
* For any issues or feature requests related to this class, please let us know |
50
|
|
|
* on github and we'll fix in our codegen framework. We'll not be able to accept |
51
|
|
|
* pull request for this class. |
52
|
|
|
* |
53
|
|
|
*/ |
54
|
|
|
|
55
|
|
|
class ProductCatalog extends AbstractCrudObject { |
56
|
|
|
|
57
|
|
|
protected function getEndpoint() { |
58
|
|
|
return 'product_catalogs'; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return ProductCatalogFields |
63
|
|
|
*/ |
64
|
|
|
public static function getFieldsEnum() { |
65
|
|
|
return ProductCatalogFields::getInstance(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
protected static function getReferencedEnums() { |
69
|
|
|
$ref_enums = array(); |
70
|
|
|
$ref_enums['Vertical'] = ProductCatalogVerticalValues::getInstance()->getValues(); |
71
|
|
|
return $ref_enums; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
public function getAgencies(array $fields = array(), array $params = array(), $pending = false) { |
76
|
|
|
$this->assureId(); |
77
|
|
|
|
78
|
|
|
$param_types = array( |
79
|
|
|
); |
80
|
|
|
$enums = array( |
81
|
|
|
); |
82
|
|
|
|
83
|
|
|
$request = new ApiRequest( |
84
|
|
|
$this->api, |
85
|
|
|
$this->data['id'], |
86
|
|
|
RequestInterface::METHOD_GET, |
87
|
|
|
'/agencies', |
88
|
|
|
new Business(), |
89
|
|
|
'EDGE', |
90
|
|
|
Business::getFieldsEnum()->getValues(), |
91
|
|
|
new TypeChecker($param_types, $enums) |
92
|
|
|
); |
93
|
|
|
$request->addParams($params); |
94
|
|
|
$request->addFields($fields); |
95
|
|
|
return $pending ? $request : $request->execute(); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getExternalEventSources(array $fields = array(), array $params = array(), $pending = false) { |
99
|
|
|
$this->assureId(); |
100
|
|
|
|
101
|
|
|
$param_types = array( |
102
|
|
|
); |
103
|
|
|
$enums = array( |
104
|
|
|
); |
105
|
|
|
|
106
|
|
|
$request = new ApiRequest( |
107
|
|
|
$this->api, |
108
|
|
|
$this->data['id'], |
109
|
|
|
RequestInterface::METHOD_GET, |
110
|
|
|
'/external_event_sources', |
111
|
|
|
new ExternalEventSource(), |
112
|
|
|
'EDGE', |
113
|
|
|
ExternalEventSource::getFieldsEnum()->getValues(), |
114
|
|
|
new TypeChecker($param_types, $enums) |
115
|
|
|
); |
116
|
|
|
$request->addParams($params); |
117
|
|
|
$request->addFields($fields); |
118
|
|
|
return $pending ? $request : $request->execute(); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function createExternalEventSource(array $fields = array(), array $params = array(), $pending = false) { |
122
|
|
|
$this->assureId(); |
123
|
|
|
|
124
|
|
|
$param_types = array( |
125
|
|
|
'external_event_sources' => 'list<string>', |
126
|
|
|
); |
127
|
|
|
$enums = array( |
128
|
|
|
); |
129
|
|
|
|
130
|
|
|
$request = new ApiRequest( |
131
|
|
|
$this->api, |
132
|
|
|
$this->data['id'], |
133
|
|
|
RequestInterface::METHOD_POST, |
134
|
|
|
'/external_event_sources', |
135
|
|
|
new ExternalEventSource(), |
136
|
|
|
'EDGE', |
137
|
|
|
ExternalEventSource::getFieldsEnum()->getValues(), |
138
|
|
|
new TypeChecker($param_types, $enums) |
139
|
|
|
); |
140
|
|
|
$request->addParams($params); |
141
|
|
|
$request->addFields($fields); |
142
|
|
|
return $pending ? $request : $request->execute(); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function getHotelRoomsBatch(array $fields = array(), array $params = array(), $pending = false) { |
146
|
|
|
$this->assureId(); |
147
|
|
|
|
148
|
|
|
$param_types = array( |
149
|
|
|
'handle' => 'string', |
150
|
|
|
); |
151
|
|
|
$enums = array( |
152
|
|
|
); |
153
|
|
|
|
154
|
|
|
$request = new ApiRequest( |
155
|
|
|
$this->api, |
156
|
|
|
$this->data['id'], |
157
|
|
|
RequestInterface::METHOD_GET, |
158
|
|
|
'/hotel_rooms_batch', |
159
|
|
|
new ProductCatalogHotelRoomsBatch(), |
160
|
|
|
'EDGE', |
161
|
|
|
ProductCatalogHotelRoomsBatch::getFieldsEnum()->getValues(), |
162
|
|
|
new TypeChecker($param_types, $enums) |
163
|
|
|
); |
164
|
|
|
$request->addParams($params); |
165
|
|
|
$request->addFields($fields); |
166
|
|
|
return $pending ? $request : $request->execute(); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function createHotelRoomsBatch(array $fields = array(), array $params = array(), $pending = false) { |
170
|
|
|
$this->assureId(); |
171
|
|
|
|
172
|
|
|
$param_types = array( |
173
|
|
|
'file' => 'file', |
174
|
|
|
'standard' => 'standard_enum', |
175
|
|
|
'update_only' => 'bool', |
176
|
|
|
); |
177
|
|
|
$enums = array( |
178
|
|
|
'standard_enum' => ProductCatalogHotelRoomsBatchStandardValues::getInstance()->getValues(), |
179
|
|
|
); |
180
|
|
|
|
181
|
|
|
$request = new ApiRequest( |
182
|
|
|
$this->api, |
183
|
|
|
$this->data['id'], |
184
|
|
|
RequestInterface::METHOD_POST, |
185
|
|
|
'/hotel_rooms_batch', |
186
|
|
|
new ProductCatalogHotelRoomsBatch(), |
187
|
|
|
'EDGE', |
188
|
|
|
ProductCatalogHotelRoomsBatch::getFieldsEnum()->getValues(), |
189
|
|
|
new TypeChecker($param_types, $enums) |
190
|
|
|
); |
191
|
|
|
$request->addParams($params); |
192
|
|
|
$request->addFields($fields); |
193
|
|
|
return $pending ? $request : $request->execute(); |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
public function getHotels(array $fields = array(), array $params = array(), $pending = false) { |
197
|
|
|
$this->assureId(); |
198
|
|
|
|
199
|
|
|
$param_types = array( |
200
|
|
|
); |
201
|
|
|
$enums = array( |
202
|
|
|
); |
203
|
|
|
|
204
|
|
|
$request = new ApiRequest( |
205
|
|
|
$this->api, |
206
|
|
|
$this->data['id'], |
207
|
|
|
RequestInterface::METHOD_GET, |
208
|
|
|
'/hotels', |
209
|
|
|
new Hotel(), |
210
|
|
|
'EDGE', |
211
|
|
|
Hotel::getFieldsEnum()->getValues(), |
212
|
|
|
new TypeChecker($param_types, $enums) |
213
|
|
|
); |
214
|
|
|
$request->addParams($params); |
215
|
|
|
$request->addFields($fields); |
216
|
|
|
return $pending ? $request : $request->execute(); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
public function createHotel(array $fields = array(), array $params = array(), $pending = false) { |
220
|
|
|
$this->assureId(); |
221
|
|
|
|
222
|
|
|
$param_types = array( |
223
|
|
|
'address' => 'Object', |
224
|
|
|
'applinks' => 'Object', |
225
|
|
|
'brand' => 'string', |
226
|
|
|
'description' => 'string', |
227
|
|
|
'guest_ratings' => 'list<Object>', |
228
|
|
|
'hotel_id' => 'string', |
229
|
|
|
'images' => 'list<Object>', |
230
|
|
|
'name' => 'string', |
231
|
|
|
'phone' => 'string', |
232
|
|
|
'star_rating' => 'float', |
233
|
|
|
'url' => 'string', |
234
|
|
|
); |
235
|
|
|
$enums = array( |
236
|
|
|
); |
237
|
|
|
|
238
|
|
|
$request = new ApiRequest( |
239
|
|
|
$this->api, |
240
|
|
|
$this->data['id'], |
241
|
|
|
RequestInterface::METHOD_POST, |
242
|
|
|
'/hotels', |
243
|
|
|
new Hotel(), |
244
|
|
|
'EDGE', |
245
|
|
|
Hotel::getFieldsEnum()->getValues(), |
246
|
|
|
new TypeChecker($param_types, $enums) |
247
|
|
|
); |
248
|
|
|
$request->addParams($params); |
249
|
|
|
$request->addFields($fields); |
250
|
|
|
return $pending ? $request : $request->execute(); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
public function getPricingVariablesBatch(array $fields = array(), array $params = array(), $pending = false) { |
254
|
|
|
$this->assureId(); |
255
|
|
|
|
256
|
|
|
$param_types = array( |
257
|
|
|
'handle' => 'string', |
258
|
|
|
); |
259
|
|
|
$enums = array( |
260
|
|
|
); |
261
|
|
|
|
262
|
|
|
$request = new ApiRequest( |
263
|
|
|
$this->api, |
264
|
|
|
$this->data['id'], |
265
|
|
|
RequestInterface::METHOD_GET, |
266
|
|
|
'/pricing_variables_batch', |
267
|
|
|
new ProductCatalogPricingVariablesBatch(), |
268
|
|
|
'EDGE', |
269
|
|
|
ProductCatalogPricingVariablesBatch::getFieldsEnum()->getValues(), |
270
|
|
|
new TypeChecker($param_types, $enums) |
271
|
|
|
); |
272
|
|
|
$request->addParams($params); |
273
|
|
|
$request->addFields($fields); |
274
|
|
|
return $pending ? $request : $request->execute(); |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
public function createPricingVariablesBatch(array $fields = array(), array $params = array(), $pending = false) { |
278
|
|
|
$this->assureId(); |
279
|
|
|
|
280
|
|
|
$param_types = array( |
281
|
|
|
'file' => 'file', |
282
|
|
|
'standard' => 'standard_enum', |
283
|
|
|
'update_only' => 'bool', |
284
|
|
|
); |
285
|
|
|
$enums = array( |
286
|
|
|
'standard_enum' => ProductCatalogPricingVariablesBatchStandardValues::getInstance()->getValues(), |
287
|
|
|
); |
288
|
|
|
|
289
|
|
|
$request = new ApiRequest( |
290
|
|
|
$this->api, |
291
|
|
|
$this->data['id'], |
292
|
|
|
RequestInterface::METHOD_POST, |
293
|
|
|
'/pricing_variables_batch', |
294
|
|
|
new ProductCatalogPricingVariablesBatch(), |
295
|
|
|
'EDGE', |
296
|
|
|
ProductCatalogPricingVariablesBatch::getFieldsEnum()->getValues(), |
297
|
|
|
new TypeChecker($param_types, $enums) |
298
|
|
|
); |
299
|
|
|
$request->addParams($params); |
300
|
|
|
$request->addFields($fields); |
301
|
|
|
return $pending ? $request : $request->execute(); |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
public function getProductFeeds(array $fields = array(), array $params = array(), $pending = false) { |
305
|
|
|
$this->assureId(); |
306
|
|
|
|
307
|
|
|
$param_types = array( |
308
|
|
|
); |
309
|
|
|
$enums = array( |
310
|
|
|
); |
311
|
|
|
|
312
|
|
|
$request = new ApiRequest( |
313
|
|
|
$this->api, |
314
|
|
|
$this->data['id'], |
315
|
|
|
RequestInterface::METHOD_GET, |
316
|
|
|
'/product_feeds', |
317
|
|
|
new ProductFeed(), |
318
|
|
|
'EDGE', |
319
|
|
|
ProductFeed::getFieldsEnum()->getValues(), |
320
|
|
|
new TypeChecker($param_types, $enums) |
321
|
|
|
); |
322
|
|
|
$request->addParams($params); |
323
|
|
|
$request->addFields($fields); |
324
|
|
|
return $pending ? $request : $request->execute(); |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
public function createProductFeed(array $fields = array(), array $params = array(), $pending = false) { |
328
|
|
|
$this->assureId(); |
329
|
|
|
|
330
|
|
|
$param_types = array( |
331
|
|
|
'country' => 'string', |
332
|
|
|
'default_currency' => 'string', |
333
|
|
|
'deletion_enabled' => 'bool', |
334
|
|
|
'delimiter' => 'delimiter_enum', |
335
|
|
|
'encoding' => 'encoding_enum', |
336
|
|
|
'file_name' => 'string', |
337
|
|
|
'name' => 'string', |
338
|
|
|
'quoted_fields_mode' => 'quoted_fields_mode_enum', |
339
|
|
|
'schedule' => 'string', |
340
|
|
|
); |
341
|
|
|
$enums = array( |
342
|
|
|
'delimiter_enum' => ProductFeedDelimiterValues::getInstance()->getValues(), |
343
|
|
|
'encoding_enum' => ProductFeedEncodingValues::getInstance()->getValues(), |
344
|
|
|
'quoted_fields_mode_enum' => ProductFeedQuotedFieldsModeValues::getInstance()->getValues(), |
345
|
|
|
); |
346
|
|
|
|
347
|
|
|
$request = new ApiRequest( |
348
|
|
|
$this->api, |
349
|
|
|
$this->data['id'], |
350
|
|
|
RequestInterface::METHOD_POST, |
351
|
|
|
'/product_feeds', |
352
|
|
|
new ProductFeed(), |
353
|
|
|
'EDGE', |
354
|
|
|
ProductFeed::getFieldsEnum()->getValues(), |
355
|
|
|
new TypeChecker($param_types, $enums) |
356
|
|
|
); |
357
|
|
|
$request->addParams($params); |
358
|
|
|
$request->addFields($fields); |
359
|
|
|
return $pending ? $request : $request->execute(); |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
public function getProductGroups(array $fields = array(), array $params = array(), $pending = false) { |
363
|
|
|
$this->assureId(); |
364
|
|
|
|
365
|
|
|
$param_types = array( |
366
|
|
|
); |
367
|
|
|
$enums = array( |
368
|
|
|
); |
369
|
|
|
|
370
|
|
|
$request = new ApiRequest( |
371
|
|
|
$this->api, |
372
|
|
|
$this->data['id'], |
373
|
|
|
RequestInterface::METHOD_GET, |
374
|
|
|
'/product_groups', |
375
|
|
|
new ProductGroup(), |
376
|
|
|
'EDGE', |
377
|
|
|
ProductGroup::getFieldsEnum()->getValues(), |
378
|
|
|
new TypeChecker($param_types, $enums) |
379
|
|
|
); |
380
|
|
|
$request->addParams($params); |
381
|
|
|
$request->addFields($fields); |
382
|
|
|
return $pending ? $request : $request->execute(); |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
public function createProductGroup(array $fields = array(), array $params = array(), $pending = false) { |
386
|
|
|
$this->assureId(); |
387
|
|
|
|
388
|
|
|
$param_types = array( |
389
|
|
|
'retailer_id' => 'string', |
390
|
|
|
'variants' => 'list<Object>', |
391
|
|
|
); |
392
|
|
|
$enums = array( |
393
|
|
|
); |
394
|
|
|
|
395
|
|
|
$request = new ApiRequest( |
396
|
|
|
$this->api, |
397
|
|
|
$this->data['id'], |
398
|
|
|
RequestInterface::METHOD_POST, |
399
|
|
|
'/product_groups', |
400
|
|
|
new ProductGroup(), |
401
|
|
|
'EDGE', |
402
|
|
|
ProductGroup::getFieldsEnum()->getValues(), |
403
|
|
|
new TypeChecker($param_types, $enums) |
404
|
|
|
); |
405
|
|
|
$request->addParams($params); |
406
|
|
|
$request->addFields($fields); |
407
|
|
|
return $pending ? $request : $request->execute(); |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
public function getProductSets(array $fields = array(), array $params = array(), $pending = false) { |
411
|
|
|
$this->assureId(); |
412
|
|
|
|
413
|
|
|
$param_types = array( |
414
|
|
|
'ancestor_id' => 'string', |
415
|
|
|
'has_children' => 'bool', |
416
|
|
|
'parent_id' => 'string', |
417
|
|
|
'retailer_id' => 'string', |
418
|
|
|
); |
419
|
|
|
$enums = array( |
420
|
|
|
); |
421
|
|
|
|
422
|
|
|
$request = new ApiRequest( |
423
|
|
|
$this->api, |
424
|
|
|
$this->data['id'], |
425
|
|
|
RequestInterface::METHOD_GET, |
426
|
|
|
'/product_sets', |
427
|
|
|
new ProductSet(), |
428
|
|
|
'EDGE', |
429
|
|
|
ProductSet::getFieldsEnum()->getValues(), |
430
|
|
|
new TypeChecker($param_types, $enums) |
431
|
|
|
); |
432
|
|
|
$request->addParams($params); |
433
|
|
|
$request->addFields($fields); |
434
|
|
|
return $pending ? $request : $request->execute(); |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
public function createProductSet(array $fields = array(), array $params = array(), $pending = false) { |
438
|
|
|
$this->assureId(); |
439
|
|
|
|
440
|
|
|
$param_types = array( |
441
|
|
|
'filter' => 'Object', |
442
|
|
|
'name' => 'string', |
443
|
|
|
); |
444
|
|
|
$enums = array( |
445
|
|
|
); |
446
|
|
|
|
447
|
|
|
$request = new ApiRequest( |
448
|
|
|
$this->api, |
449
|
|
|
$this->data['id'], |
450
|
|
|
RequestInterface::METHOD_POST, |
451
|
|
|
'/product_sets', |
452
|
|
|
new ProductSet(), |
453
|
|
|
'EDGE', |
454
|
|
|
ProductSet::getFieldsEnum()->getValues(), |
455
|
|
|
new TypeChecker($param_types, $enums) |
456
|
|
|
); |
457
|
|
|
$request->addParams($params); |
458
|
|
|
$request->addFields($fields); |
459
|
|
|
return $pending ? $request : $request->execute(); |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
public function getProductSetsBatch(array $fields = array(), array $params = array(), $pending = false) { |
463
|
|
|
$this->assureId(); |
464
|
|
|
|
465
|
|
|
$param_types = array( |
466
|
|
|
'handle' => 'string', |
467
|
|
|
); |
468
|
|
|
$enums = array( |
469
|
|
|
); |
470
|
|
|
|
471
|
|
|
$request = new ApiRequest( |
472
|
|
|
$this->api, |
473
|
|
|
$this->data['id'], |
474
|
|
|
RequestInterface::METHOD_GET, |
475
|
|
|
'/product_sets_batch', |
476
|
|
|
new AbstractCrudObject(), |
477
|
|
|
'EDGE', |
478
|
|
|
array(), |
479
|
|
|
new TypeChecker($param_types, $enums) |
480
|
|
|
); |
481
|
|
|
$request->addParams($params); |
482
|
|
|
$request->addFields($fields); |
483
|
|
|
return $pending ? $request : $request->execute(); |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
public function getProducts(array $fields = array(), array $params = array(), $pending = false) { |
487
|
|
|
$this->assureId(); |
488
|
|
|
|
489
|
|
|
$param_types = array( |
490
|
|
|
'filter' => 'Object', |
491
|
|
|
); |
492
|
|
|
$enums = array( |
493
|
|
|
); |
494
|
|
|
|
495
|
|
|
$request = new ApiRequest( |
496
|
|
|
$this->api, |
497
|
|
|
$this->data['id'], |
498
|
|
|
RequestInterface::METHOD_GET, |
499
|
|
|
'/products', |
500
|
|
|
new ProductItem(), |
501
|
|
|
'EDGE', |
502
|
|
|
ProductItem::getFieldsEnum()->getValues(), |
503
|
|
|
new TypeChecker($param_types, $enums) |
504
|
|
|
); |
505
|
|
|
$request->addParams($params); |
506
|
|
|
$request->addFields($fields); |
507
|
|
|
return $pending ? $request : $request->execute(); |
508
|
|
|
} |
509
|
|
|
|
510
|
|
|
public function createProduct(array $fields = array(), array $params = array(), $pending = false) { |
511
|
|
|
$this->assureId(); |
512
|
|
|
|
513
|
|
|
$param_types = array( |
514
|
|
|
'additional_image_urls' => 'list<string>', |
515
|
|
|
'android_app_name' => 'string', |
516
|
|
|
'android_class' => 'string', |
517
|
|
|
'android_package' => 'string', |
518
|
|
|
'android_url' => 'string', |
519
|
|
|
'availability' => 'availability_enum', |
520
|
|
|
'brand' => 'string', |
521
|
|
|
'category' => 'string', |
522
|
|
|
'checkout_url' => 'string', |
523
|
|
|
'color' => 'string', |
524
|
|
|
'condition' => 'condition_enum', |
525
|
|
|
'currency' => 'string', |
526
|
|
|
'custom_data' => 'map', |
527
|
|
|
'custom_label_0' => 'string', |
528
|
|
|
'custom_label_1' => 'string', |
529
|
|
|
'custom_label_2' => 'string', |
530
|
|
|
'custom_label_3' => 'string', |
531
|
|
|
'custom_label_4' => 'string', |
532
|
|
|
'description' => 'string', |
533
|
|
|
'expiration_date' => 'string', |
534
|
|
|
'gender' => 'gender_enum', |
535
|
|
|
'gtin' => 'string', |
536
|
|
|
'image_url' => 'string', |
537
|
|
|
'inventory' => 'unsigned int', |
538
|
|
|
'ios_app_name' => 'string', |
539
|
|
|
'ios_app_store_id' => 'unsigned int', |
540
|
|
|
'ios_url' => 'string', |
541
|
|
|
'ipad_app_name' => 'string', |
542
|
|
|
'ipad_app_store_id' => 'unsigned int', |
543
|
|
|
'ipad_url' => 'string', |
544
|
|
|
'iphone_app_name' => 'string', |
545
|
|
|
'iphone_app_store_id' => 'unsigned int', |
546
|
|
|
'iphone_url' => 'string', |
547
|
|
|
'manufacturer_part_number' => 'string', |
548
|
|
|
'name' => 'string', |
549
|
|
|
'ordering_index' => 'unsigned int', |
550
|
|
|
'pattern' => 'string', |
551
|
|
|
'price' => 'unsigned int', |
552
|
|
|
'product_type' => 'string', |
553
|
|
|
'retailer_id' => 'string', |
554
|
|
|
'retailer_product_group_id' => 'string', |
555
|
|
|
'sale_price' => 'unsigned int', |
556
|
|
|
'sale_price_end_date' => 'datetime', |
557
|
|
|
'sale_price_start_date' => 'datetime', |
558
|
|
|
'short_description' => 'string', |
559
|
|
|
'size' => 'string', |
560
|
|
|
'start_date' => 'string', |
561
|
|
|
'url' => 'string', |
562
|
|
|
'visibility' => 'visibility_enum', |
563
|
|
|
'windows_phone_app_id' => 'unsigned int', |
564
|
|
|
'windows_phone_app_name' => 'string', |
565
|
|
|
'windows_phone_url' => 'string', |
566
|
|
|
); |
567
|
|
|
$enums = array( |
568
|
|
|
'availability_enum' => ProductItemAvailabilityValues::getInstance()->getValues(), |
569
|
|
|
'condition_enum' => ProductItemConditionValues::getInstance()->getValues(), |
570
|
|
|
'gender_enum' => ProductItemGenderValues::getInstance()->getValues(), |
571
|
|
|
'visibility_enum' => ProductItemVisibilityValues::getInstance()->getValues(), |
572
|
|
|
); |
573
|
|
|
|
574
|
|
|
$request = new ApiRequest( |
575
|
|
|
$this->api, |
576
|
|
|
$this->data['id'], |
577
|
|
|
RequestInterface::METHOD_POST, |
578
|
|
|
'/products', |
579
|
|
|
new ProductItem(), |
580
|
|
|
'EDGE', |
581
|
|
|
ProductItem::getFieldsEnum()->getValues(), |
582
|
|
|
new TypeChecker($param_types, $enums) |
583
|
|
|
); |
584
|
|
|
$request->addParams($params); |
585
|
|
|
$request->addFields($fields); |
586
|
|
|
return $pending ? $request : $request->execute(); |
587
|
|
|
} |
588
|
|
|
|
589
|
|
|
public function createVideo(array $fields = array(), array $params = array(), $pending = false) { |
590
|
|
|
$this->assureId(); |
591
|
|
|
|
592
|
|
|
$param_types = array( |
593
|
|
|
'content_category' => 'content_category_enum', |
594
|
|
|
'description' => 'string', |
595
|
|
|
'embeddable' => 'bool', |
596
|
|
|
'file_size' => 'unsigned int', |
597
|
|
|
'file_url' => 'string', |
598
|
|
|
'referenced_sticker_id' => 'string', |
599
|
|
|
'slideshow_spec' => 'map', |
600
|
|
|
'source' => 'string', |
601
|
|
|
'start_offset' => 'unsigned int', |
602
|
|
|
'thumb' => 'file', |
603
|
|
|
'title' => 'string', |
604
|
|
|
'unpublished_content_type' => 'unpublished_content_type_enum', |
605
|
|
|
'upload_phase' => 'upload_phase_enum', |
606
|
|
|
'upload_session_id' => 'string', |
607
|
|
|
'video_file_chunk' => 'string', |
608
|
|
|
); |
609
|
|
|
$enums = array( |
610
|
|
|
'content_category_enum' => array( |
611
|
|
|
'BEAUTY_FASHION', |
612
|
|
|
'BUSINESS', |
613
|
|
|
'CARS_TRUCKS', |
614
|
|
|
'COMEDY', |
615
|
|
|
'CUTE_ANIMALS', |
616
|
|
|
'ENTERTAINMENT', |
617
|
|
|
'FAMILY', |
618
|
|
|
'FOOD_HEALTH', |
619
|
|
|
'HOME', |
620
|
|
|
'LIFESTYLE', |
621
|
|
|
'MUSIC', |
622
|
|
|
'NEWS', |
623
|
|
|
'POLITICS', |
624
|
|
|
'SCIENCE', |
625
|
|
|
'SPORTS', |
626
|
|
|
'TECHNOLOGY', |
627
|
|
|
'VIDEO_GAMING', |
628
|
|
|
'OTHER', |
629
|
|
|
), |
630
|
|
|
'unpublished_content_type_enum' => array( |
631
|
|
|
'SCHEDULED', |
632
|
|
|
'DRAFT', |
633
|
|
|
'ADS_POST', |
634
|
|
|
), |
635
|
|
|
'upload_phase_enum' => array( |
636
|
|
|
'start', |
637
|
|
|
'transfer', |
638
|
|
|
'finish', |
639
|
|
|
'cancel', |
640
|
|
|
), |
641
|
|
|
); |
642
|
|
|
|
643
|
|
|
$request = new ApiRequest( |
644
|
|
|
$this->api, |
645
|
|
|
$this->data['id'], |
646
|
|
|
RequestInterface::METHOD_POST, |
647
|
|
|
'/videos', |
648
|
|
|
new AbstractCrudObject(), |
649
|
|
|
'EDGE', |
650
|
|
|
array(), |
651
|
|
|
new TypeChecker($param_types, $enums) |
652
|
|
|
); |
653
|
|
|
$request->addParams($params); |
654
|
|
|
$request->addFields($fields); |
655
|
|
|
return $pending ? $request : $request->execute(); |
656
|
|
|
} |
657
|
|
|
|
658
|
|
|
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) { |
659
|
|
|
$this->assureId(); |
660
|
|
|
|
661
|
|
|
$param_types = array( |
662
|
|
|
); |
663
|
|
|
$enums = array( |
664
|
|
|
); |
665
|
|
|
|
666
|
|
|
$request = new ApiRequest( |
667
|
|
|
$this->api, |
668
|
|
|
$this->data['id'], |
669
|
|
|
RequestInterface::METHOD_DELETE, |
670
|
|
|
'/', |
671
|
|
|
new AbstractCrudObject(), |
672
|
|
|
'NODE', |
673
|
|
|
array(), |
674
|
|
|
new TypeChecker($param_types, $enums) |
675
|
|
|
); |
676
|
|
|
$request->addParams($params); |
677
|
|
|
$request->addFields($fields); |
678
|
|
|
return $pending ? $request : $request->execute(); |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
public function getSelf(array $fields = array(), array $params = array(), $pending = false) { |
682
|
|
|
$this->assureId(); |
683
|
|
|
|
684
|
|
|
$param_types = array( |
685
|
|
|
); |
686
|
|
|
$enums = array( |
687
|
|
|
); |
688
|
|
|
|
689
|
|
|
$request = new ApiRequest( |
690
|
|
|
$this->api, |
691
|
|
|
$this->data['id'], |
692
|
|
|
RequestInterface::METHOD_GET, |
693
|
|
|
'/', |
694
|
|
|
new ProductCatalog(), |
695
|
|
|
'NODE', |
696
|
|
|
ProductCatalog::getFieldsEnum()->getValues(), |
697
|
|
|
new TypeChecker($param_types, $enums) |
698
|
|
|
); |
699
|
|
|
$request->addParams($params); |
700
|
|
|
$request->addFields($fields); |
701
|
|
|
return $pending ? $request : $request->execute(); |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) { |
705
|
|
|
$this->assureId(); |
706
|
|
|
|
707
|
|
|
$param_types = array( |
708
|
|
|
'name' => 'string', |
709
|
|
|
); |
710
|
|
|
$enums = array( |
711
|
|
|
); |
712
|
|
|
|
713
|
|
|
$request = new ApiRequest( |
714
|
|
|
$this->api, |
715
|
|
|
$this->data['id'], |
716
|
|
|
RequestInterface::METHOD_POST, |
717
|
|
|
'/', |
718
|
|
|
new ProductCatalog(), |
719
|
|
|
'NODE', |
720
|
|
|
ProductCatalog::getFieldsEnum()->getValues(), |
721
|
|
|
new TypeChecker($param_types, $enums) |
722
|
|
|
); |
723
|
|
|
$request->addParams($params); |
724
|
|
|
$request->addFields($fields); |
725
|
|
|
return $pending ? $request : $request->execute(); |
726
|
|
|
} |
727
|
|
|
|
728
|
|
|
/** |
729
|
|
|
* @deprecated use createExternalEventSource instead |
730
|
|
|
*/ |
731
|
|
|
public function setExternalEventSources(array $pixel_ids, $pending = false) { |
732
|
|
|
$params = array( |
733
|
|
|
'external_event_sources' => $pixel_ids, |
734
|
|
|
); |
735
|
|
|
return $this->createExternalEventSource(array(), $params, $pending); |
736
|
|
|
} |
737
|
|
|
|
738
|
|
|
/** |
739
|
|
|
* @deprecated use deleteExternalEventSources instead |
740
|
|
|
*/ |
741
|
|
|
public function removeExternalEventSources(array $pixel_ids, $pending = false) { |
742
|
|
|
$params = array( |
743
|
|
|
'external_event_sources' => $pixel_ids, |
744
|
|
|
); |
745
|
|
|
return $this->deleteExternalEventSources(array(), $params, $pending); |
|
|
|
|
746
|
|
|
} |
747
|
|
|
|
748
|
|
|
/** |
749
|
|
|
* @param int $user_id |
750
|
|
|
* @param string $role |
751
|
|
|
*/ |
752
|
|
|
public function addUserPermission($user_id, $role) { |
753
|
|
|
$params = array( |
754
|
|
|
'user' => $user_id, |
755
|
|
|
'role' => $role, |
756
|
|
|
); |
757
|
|
|
$this->getApi()->call( |
758
|
|
|
'/'.$this->assureId().'/userpermissions', |
759
|
|
|
RequestInterface::METHOD_POST, |
760
|
|
|
$params); |
761
|
|
|
} |
762
|
|
|
|
763
|
|
|
/** |
764
|
|
|
* @param int $user_id |
765
|
|
|
*/ |
766
|
|
|
public function deleteUserPermission($user_id) { |
767
|
|
|
$params = array( |
768
|
|
|
'user' => $user_id, |
769
|
|
|
); |
770
|
|
|
$this->getApi()->call( |
771
|
|
|
'/'.$this->assureId().'/userpermissions', |
772
|
|
|
RequestInterface::METHOD_DELETE, |
773
|
|
|
$params); |
774
|
|
|
} |
775
|
|
|
} |
776
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.