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