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