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-generated. |
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 getHomeListings(array $fields = array(), array $params = array(), $pending = false) { |
244
|
|
|
$this->assureId(); |
245
|
|
|
|
246
|
|
|
$param_types = array( |
247
|
|
|
'bulk_pagination' => 'bool', |
248
|
|
|
'filter' => 'Object', |
249
|
|
|
); |
250
|
|
|
$enums = array( |
251
|
|
|
); |
252
|
|
|
|
253
|
|
|
$request = new ApiRequest( |
254
|
|
|
$this->api, |
255
|
|
|
$this->data['id'], |
256
|
|
|
RequestInterface::METHOD_GET, |
257
|
|
|
'/home_listings', |
258
|
|
|
new AbstractCrudObject(), |
259
|
|
|
'EDGE', |
260
|
|
|
array(), |
261
|
|
|
new TypeChecker($param_types, $enums) |
262
|
|
|
); |
263
|
|
|
$request->addParams($params); |
264
|
|
|
$request->addFields($fields); |
265
|
|
|
return $pending ? $request : $request->execute(); |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
public function createHomeListing(array $fields = array(), array $params = array(), $pending = false) { |
269
|
|
|
$this->assureId(); |
270
|
|
|
|
271
|
|
|
$param_types = array( |
272
|
|
|
'address' => 'Object', |
273
|
|
|
'availability' => 'string', |
274
|
|
|
'currency' => 'string', |
275
|
|
|
'description' => 'string', |
276
|
|
|
'home_listing_id' => 'string', |
277
|
|
|
'images' => 'list<Object>', |
278
|
|
|
'listing_type' => 'string', |
279
|
|
|
'name' => 'string', |
280
|
|
|
'num_baths' => 'float', |
281
|
|
|
'num_beds' => 'float', |
282
|
|
|
'num_units' => 'float', |
283
|
|
|
'price' => 'float', |
284
|
|
|
'property_type' => 'string', |
285
|
|
|
'url' => 'string', |
286
|
|
|
'year_built' => 'unsigned int', |
287
|
|
|
); |
288
|
|
|
$enums = array( |
289
|
|
|
); |
290
|
|
|
|
291
|
|
|
$request = new ApiRequest( |
292
|
|
|
$this->api, |
293
|
|
|
$this->data['id'], |
294
|
|
|
RequestInterface::METHOD_POST, |
295
|
|
|
'/home_listings', |
296
|
|
|
new AbstractCrudObject(), |
297
|
|
|
'EDGE', |
298
|
|
|
array(), |
299
|
|
|
new TypeChecker($param_types, $enums) |
300
|
|
|
); |
301
|
|
|
$request->addParams($params); |
302
|
|
|
$request->addFields($fields); |
303
|
|
|
return $pending ? $request : $request->execute(); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
public function getHotelRoomsBatch(array $fields = array(), array $params = array(), $pending = false) { |
307
|
|
|
$this->assureId(); |
308
|
|
|
|
309
|
|
|
$param_types = array( |
310
|
|
|
'handle' => 'string', |
311
|
|
|
); |
312
|
|
|
$enums = array( |
313
|
|
|
); |
314
|
|
|
|
315
|
|
|
$request = new ApiRequest( |
316
|
|
|
$this->api, |
317
|
|
|
$this->data['id'], |
318
|
|
|
RequestInterface::METHOD_GET, |
319
|
|
|
'/hotel_rooms_batch', |
320
|
|
|
new ProductCatalogHotelRoomsBatch(), |
321
|
|
|
'EDGE', |
322
|
|
|
ProductCatalogHotelRoomsBatch::getFieldsEnum()->getValues(), |
323
|
|
|
new TypeChecker($param_types, $enums) |
324
|
|
|
); |
325
|
|
|
$request->addParams($params); |
326
|
|
|
$request->addFields($fields); |
327
|
|
|
return $pending ? $request : $request->execute(); |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
public function createHotelRoomsBatch(array $fields = array(), array $params = array(), $pending = false) { |
331
|
|
|
$this->assureId(); |
332
|
|
|
|
333
|
|
|
$param_types = array( |
334
|
|
|
'file' => 'file', |
335
|
|
|
'password' => 'string', |
336
|
|
|
'standard' => 'standard_enum', |
337
|
|
|
'update_only' => 'bool', |
338
|
|
|
'url' => 'string', |
339
|
|
|
'username' => 'string', |
340
|
|
|
); |
341
|
|
|
$enums = array( |
342
|
|
|
'standard_enum' => ProductCatalogHotelRoomsBatchStandardValues::getInstance()->getValues(), |
343
|
|
|
); |
344
|
|
|
|
345
|
|
|
$request = new ApiRequest( |
346
|
|
|
$this->api, |
347
|
|
|
$this->data['id'], |
348
|
|
|
RequestInterface::METHOD_POST, |
349
|
|
|
'/hotel_rooms_batch', |
350
|
|
|
new ProductCatalogHotelRoomsBatch(), |
351
|
|
|
'EDGE', |
352
|
|
|
ProductCatalogHotelRoomsBatch::getFieldsEnum()->getValues(), |
353
|
|
|
new TypeChecker($param_types, $enums) |
354
|
|
|
); |
355
|
|
|
$request->addParams($params); |
356
|
|
|
$request->addFields($fields); |
357
|
|
|
return $pending ? $request : $request->execute(); |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
public function getHotels(array $fields = array(), array $params = array(), $pending = false) { |
361
|
|
|
$this->assureId(); |
362
|
|
|
|
363
|
|
|
$param_types = array( |
364
|
|
|
'bulk_pagination' => 'bool', |
365
|
|
|
'filter' => 'Object', |
366
|
|
|
); |
367
|
|
|
$enums = array( |
368
|
|
|
); |
369
|
|
|
|
370
|
|
|
$request = new ApiRequest( |
371
|
|
|
$this->api, |
372
|
|
|
$this->data['id'], |
373
|
|
|
RequestInterface::METHOD_GET, |
374
|
|
|
'/hotels', |
375
|
|
|
new Hotel(), |
376
|
|
|
'EDGE', |
377
|
|
|
Hotel::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 createHotel(array $fields = array(), array $params = array(), $pending = false) { |
386
|
|
|
$this->assureId(); |
387
|
|
|
|
388
|
|
|
$param_types = array( |
389
|
|
|
'address' => 'Object', |
390
|
|
|
'applinks' => 'Object', |
391
|
|
|
'brand' => 'string', |
392
|
|
|
'description' => 'string', |
393
|
|
|
'guest_ratings' => 'list<Object>', |
394
|
|
|
'hotel_id' => 'string', |
395
|
|
|
'images' => 'list<Object>', |
396
|
|
|
'name' => 'string', |
397
|
|
|
'phone' => 'string', |
398
|
|
|
'star_rating' => 'float', |
399
|
|
|
'url' => 'string', |
400
|
|
|
); |
401
|
|
|
$enums = array( |
402
|
|
|
); |
403
|
|
|
|
404
|
|
|
$request = new ApiRequest( |
405
|
|
|
$this->api, |
406
|
|
|
$this->data['id'], |
407
|
|
|
RequestInterface::METHOD_POST, |
408
|
|
|
'/hotels', |
409
|
|
|
new Hotel(), |
410
|
|
|
'EDGE', |
411
|
|
|
Hotel::getFieldsEnum()->getValues(), |
412
|
|
|
new TypeChecker($param_types, $enums) |
413
|
|
|
); |
414
|
|
|
$request->addParams($params); |
415
|
|
|
$request->addFields($fields); |
416
|
|
|
return $pending ? $request : $request->execute(); |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
public function getPricingVariablesBatch(array $fields = array(), array $params = array(), $pending = false) { |
420
|
|
|
$this->assureId(); |
421
|
|
|
|
422
|
|
|
$param_types = array( |
423
|
|
|
'handle' => 'string', |
424
|
|
|
); |
425
|
|
|
$enums = array( |
426
|
|
|
); |
427
|
|
|
|
428
|
|
|
$request = new ApiRequest( |
429
|
|
|
$this->api, |
430
|
|
|
$this->data['id'], |
431
|
|
|
RequestInterface::METHOD_GET, |
432
|
|
|
'/pricing_variables_batch', |
433
|
|
|
new ProductCatalogPricingVariablesBatch(), |
434
|
|
|
'EDGE', |
435
|
|
|
ProductCatalogPricingVariablesBatch::getFieldsEnum()->getValues(), |
436
|
|
|
new TypeChecker($param_types, $enums) |
437
|
|
|
); |
438
|
|
|
$request->addParams($params); |
439
|
|
|
$request->addFields($fields); |
440
|
|
|
return $pending ? $request : $request->execute(); |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
public function createPricingVariablesBatch(array $fields = array(), array $params = array(), $pending = false) { |
444
|
|
|
$this->assureId(); |
445
|
|
|
|
446
|
|
|
$param_types = array( |
447
|
|
|
'file' => 'file', |
448
|
|
|
'password' => 'string', |
449
|
|
|
'standard' => 'standard_enum', |
450
|
|
|
'update_only' => 'bool', |
451
|
|
|
'url' => 'string', |
452
|
|
|
'username' => 'string', |
453
|
|
|
); |
454
|
|
|
$enums = array( |
455
|
|
|
'standard_enum' => ProductCatalogPricingVariablesBatchStandardValues::getInstance()->getValues(), |
456
|
|
|
); |
457
|
|
|
|
458
|
|
|
$request = new ApiRequest( |
459
|
|
|
$this->api, |
460
|
|
|
$this->data['id'], |
461
|
|
|
RequestInterface::METHOD_POST, |
462
|
|
|
'/pricing_variables_batch', |
463
|
|
|
new ProductCatalogPricingVariablesBatch(), |
464
|
|
|
'EDGE', |
465
|
|
|
ProductCatalogPricingVariablesBatch::getFieldsEnum()->getValues(), |
466
|
|
|
new TypeChecker($param_types, $enums) |
467
|
|
|
); |
468
|
|
|
$request->addParams($params); |
469
|
|
|
$request->addFields($fields); |
470
|
|
|
return $pending ? $request : $request->execute(); |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
public function getProductFeeds(array $fields = array(), array $params = array(), $pending = false) { |
474
|
|
|
$this->assureId(); |
475
|
|
|
|
476
|
|
|
$param_types = array( |
477
|
|
|
); |
478
|
|
|
$enums = array( |
479
|
|
|
); |
480
|
|
|
|
481
|
|
|
$request = new ApiRequest( |
482
|
|
|
$this->api, |
483
|
|
|
$this->data['id'], |
484
|
|
|
RequestInterface::METHOD_GET, |
485
|
|
|
'/product_feeds', |
486
|
|
|
new ProductFeed(), |
487
|
|
|
'EDGE', |
488
|
|
|
ProductFeed::getFieldsEnum()->getValues(), |
489
|
|
|
new TypeChecker($param_types, $enums) |
490
|
|
|
); |
491
|
|
|
$request->addParams($params); |
492
|
|
|
$request->addFields($fields); |
493
|
|
|
return $pending ? $request : $request->execute(); |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
public function createProductFeed(array $fields = array(), array $params = array(), $pending = false) { |
497
|
|
|
$this->assureId(); |
498
|
|
|
|
499
|
|
|
$param_types = array( |
500
|
|
|
'country' => 'string', |
501
|
|
|
'default_currency' => 'string', |
502
|
|
|
'deletion_enabled' => 'bool', |
503
|
|
|
'delimiter' => 'delimiter_enum', |
504
|
|
|
'encoding' => 'encoding_enum', |
505
|
|
|
'file_name' => 'string', |
506
|
|
|
'name' => 'string', |
507
|
|
|
'quoted_fields_mode' => 'quoted_fields_mode_enum', |
508
|
|
|
'rules' => 'list<string>', |
509
|
|
|
'schedule' => 'string', |
510
|
|
|
'update_schedule' => 'string', |
511
|
|
|
); |
512
|
|
|
$enums = array( |
513
|
|
|
'delimiter_enum' => ProductFeedDelimiterValues::getInstance()->getValues(), |
514
|
|
|
'encoding_enum' => ProductFeedEncodingValues::getInstance()->getValues(), |
515
|
|
|
'quoted_fields_mode_enum' => ProductFeedQuotedFieldsModeValues::getInstance()->getValues(), |
516
|
|
|
); |
517
|
|
|
|
518
|
|
|
$request = new ApiRequest( |
519
|
|
|
$this->api, |
520
|
|
|
$this->data['id'], |
521
|
|
|
RequestInterface::METHOD_POST, |
522
|
|
|
'/product_feeds', |
523
|
|
|
new ProductFeed(), |
524
|
|
|
'EDGE', |
525
|
|
|
ProductFeed::getFieldsEnum()->getValues(), |
526
|
|
|
new TypeChecker($param_types, $enums) |
527
|
|
|
); |
528
|
|
|
$request->addParams($params); |
529
|
|
|
$request->addFields($fields); |
530
|
|
|
return $pending ? $request : $request->execute(); |
531
|
|
|
} |
532
|
|
|
|
533
|
|
|
public function getProductGroups(array $fields = array(), array $params = array(), $pending = false) { |
534
|
|
|
$this->assureId(); |
535
|
|
|
|
536
|
|
|
$param_types = array( |
537
|
|
|
); |
538
|
|
|
$enums = array( |
539
|
|
|
); |
540
|
|
|
|
541
|
|
|
$request = new ApiRequest( |
542
|
|
|
$this->api, |
543
|
|
|
$this->data['id'], |
544
|
|
|
RequestInterface::METHOD_GET, |
545
|
|
|
'/product_groups', |
546
|
|
|
new ProductGroup(), |
547
|
|
|
'EDGE', |
548
|
|
|
ProductGroup::getFieldsEnum()->getValues(), |
549
|
|
|
new TypeChecker($param_types, $enums) |
550
|
|
|
); |
551
|
|
|
$request->addParams($params); |
552
|
|
|
$request->addFields($fields); |
553
|
|
|
return $pending ? $request : $request->execute(); |
554
|
|
|
} |
555
|
|
|
|
556
|
|
|
public function createProductGroup(array $fields = array(), array $params = array(), $pending = false) { |
557
|
|
|
$this->assureId(); |
558
|
|
|
|
559
|
|
|
$param_types = array( |
560
|
|
|
'retailer_id' => 'string', |
561
|
|
|
'variants' => 'list<Object>', |
562
|
|
|
); |
563
|
|
|
$enums = array( |
564
|
|
|
); |
565
|
|
|
|
566
|
|
|
$request = new ApiRequest( |
567
|
|
|
$this->api, |
568
|
|
|
$this->data['id'], |
569
|
|
|
RequestInterface::METHOD_POST, |
570
|
|
|
'/product_groups', |
571
|
|
|
new ProductGroup(), |
572
|
|
|
'EDGE', |
573
|
|
|
ProductGroup::getFieldsEnum()->getValues(), |
574
|
|
|
new TypeChecker($param_types, $enums) |
575
|
|
|
); |
576
|
|
|
$request->addParams($params); |
577
|
|
|
$request->addFields($fields); |
578
|
|
|
return $pending ? $request : $request->execute(); |
579
|
|
|
} |
580
|
|
|
|
581
|
|
|
public function getProductSets(array $fields = array(), array $params = array(), $pending = false) { |
582
|
|
|
$this->assureId(); |
583
|
|
|
|
584
|
|
|
$param_types = array( |
585
|
|
|
'ancestor_id' => 'string', |
586
|
|
|
'has_children' => 'bool', |
587
|
|
|
'parent_id' => 'string', |
588
|
|
|
'retailer_id' => 'string', |
589
|
|
|
); |
590
|
|
|
$enums = array( |
591
|
|
|
); |
592
|
|
|
|
593
|
|
|
$request = new ApiRequest( |
594
|
|
|
$this->api, |
595
|
|
|
$this->data['id'], |
596
|
|
|
RequestInterface::METHOD_GET, |
597
|
|
|
'/product_sets', |
598
|
|
|
new ProductSet(), |
599
|
|
|
'EDGE', |
600
|
|
|
ProductSet::getFieldsEnum()->getValues(), |
601
|
|
|
new TypeChecker($param_types, $enums) |
602
|
|
|
); |
603
|
|
|
$request->addParams($params); |
604
|
|
|
$request->addFields($fields); |
605
|
|
|
return $pending ? $request : $request->execute(); |
606
|
|
|
} |
607
|
|
|
|
608
|
|
|
public function createProductSet(array $fields = array(), array $params = array(), $pending = false) { |
609
|
|
|
$this->assureId(); |
610
|
|
|
|
611
|
|
|
$param_types = array( |
612
|
|
|
'filter' => 'Object', |
613
|
|
|
'name' => 'string', |
614
|
|
|
); |
615
|
|
|
$enums = array( |
616
|
|
|
); |
617
|
|
|
|
618
|
|
|
$request = new ApiRequest( |
619
|
|
|
$this->api, |
620
|
|
|
$this->data['id'], |
621
|
|
|
RequestInterface::METHOD_POST, |
622
|
|
|
'/product_sets', |
623
|
|
|
new ProductSet(), |
624
|
|
|
'EDGE', |
625
|
|
|
ProductSet::getFieldsEnum()->getValues(), |
626
|
|
|
new TypeChecker($param_types, $enums) |
627
|
|
|
); |
628
|
|
|
$request->addParams($params); |
629
|
|
|
$request->addFields($fields); |
630
|
|
|
return $pending ? $request : $request->execute(); |
631
|
|
|
} |
632
|
|
|
|
633
|
|
|
public function getProductSetsBatch(array $fields = array(), array $params = array(), $pending = false) { |
634
|
|
|
$this->assureId(); |
635
|
|
|
|
636
|
|
|
$param_types = array( |
637
|
|
|
'handle' => 'string', |
638
|
|
|
); |
639
|
|
|
$enums = array( |
640
|
|
|
); |
641
|
|
|
|
642
|
|
|
$request = new ApiRequest( |
643
|
|
|
$this->api, |
644
|
|
|
$this->data['id'], |
645
|
|
|
RequestInterface::METHOD_GET, |
646
|
|
|
'/product_sets_batch', |
647
|
|
|
new AbstractCrudObject(), |
648
|
|
|
'EDGE', |
649
|
|
|
array(), |
650
|
|
|
new TypeChecker($param_types, $enums) |
651
|
|
|
); |
652
|
|
|
$request->addParams($params); |
653
|
|
|
$request->addFields($fields); |
654
|
|
|
return $pending ? $request : $request->execute(); |
655
|
|
|
} |
656
|
|
|
|
657
|
|
|
public function getProducts(array $fields = array(), array $params = array(), $pending = false) { |
658
|
|
|
$this->assureId(); |
659
|
|
|
|
660
|
|
|
$param_types = array( |
661
|
|
|
'bulk_pagination' => 'bool', |
662
|
|
|
'filter' => 'Object', |
663
|
|
|
); |
664
|
|
|
$enums = array( |
665
|
|
|
); |
666
|
|
|
|
667
|
|
|
$request = new ApiRequest( |
668
|
|
|
$this->api, |
669
|
|
|
$this->data['id'], |
670
|
|
|
RequestInterface::METHOD_GET, |
671
|
|
|
'/products', |
672
|
|
|
new ProductItem(), |
673
|
|
|
'EDGE', |
674
|
|
|
ProductItem::getFieldsEnum()->getValues(), |
675
|
|
|
new TypeChecker($param_types, $enums) |
676
|
|
|
); |
677
|
|
|
$request->addParams($params); |
678
|
|
|
$request->addFields($fields); |
679
|
|
|
return $pending ? $request : $request->execute(); |
680
|
|
|
} |
681
|
|
|
|
682
|
|
|
public function createProduct(array $fields = array(), array $params = array(), $pending = false) { |
683
|
|
|
$this->assureId(); |
684
|
|
|
|
685
|
|
|
$param_types = array( |
686
|
|
|
'additional_image_urls' => 'list<string>', |
687
|
|
|
'android_app_name' => 'string', |
688
|
|
|
'android_class' => 'string', |
689
|
|
|
'android_package' => 'string', |
690
|
|
|
'android_url' => 'string', |
691
|
|
|
'availability' => 'availability_enum', |
692
|
|
|
'brand' => 'string', |
693
|
|
|
'category' => 'string', |
694
|
|
|
'checkout_url' => 'string', |
695
|
|
|
'color' => 'string', |
696
|
|
|
'condition' => 'condition_enum', |
697
|
|
|
'currency' => 'string', |
698
|
|
|
'custom_data' => 'map', |
699
|
|
|
'custom_label_0' => 'string', |
700
|
|
|
'custom_label_1' => 'string', |
701
|
|
|
'custom_label_2' => 'string', |
702
|
|
|
'custom_label_3' => 'string', |
703
|
|
|
'custom_label_4' => 'string', |
704
|
|
|
'description' => 'string', |
705
|
|
|
'expiration_date' => 'string', |
706
|
|
|
'gender' => 'gender_enum', |
707
|
|
|
'gtin' => 'string', |
708
|
|
|
'image_url' => 'string', |
709
|
|
|
'inventory' => 'unsigned int', |
710
|
|
|
'ios_app_name' => 'string', |
711
|
|
|
'ios_app_store_id' => 'unsigned int', |
712
|
|
|
'ios_url' => 'string', |
713
|
|
|
'ipad_app_name' => 'string', |
714
|
|
|
'ipad_app_store_id' => 'unsigned int', |
715
|
|
|
'ipad_url' => 'string', |
716
|
|
|
'iphone_app_name' => 'string', |
717
|
|
|
'iphone_app_store_id' => 'unsigned int', |
718
|
|
|
'iphone_url' => 'string', |
719
|
|
|
'manufacturer_part_number' => 'string', |
720
|
|
|
'material' => 'string', |
721
|
|
|
'name' => 'string', |
722
|
|
|
'ordering_index' => 'unsigned int', |
723
|
|
|
'pattern' => 'string', |
724
|
|
|
'price' => 'unsigned int', |
725
|
|
|
'product_type' => 'string', |
726
|
|
|
'retailer_id' => 'string', |
727
|
|
|
'retailer_product_group_id' => 'string', |
728
|
|
|
'sale_price' => 'unsigned int', |
729
|
|
|
'sale_price_end_date' => 'datetime', |
730
|
|
|
'sale_price_start_date' => 'datetime', |
731
|
|
|
'short_description' => 'string', |
732
|
|
|
'size' => 'string', |
733
|
|
|
'start_date' => 'string', |
734
|
|
|
'url' => 'string', |
735
|
|
|
'visibility' => 'visibility_enum', |
736
|
|
|
'windows_phone_app_id' => 'string', |
737
|
|
|
'windows_phone_app_name' => 'string', |
738
|
|
|
'windows_phone_url' => 'string', |
739
|
|
|
); |
740
|
|
|
$enums = array( |
741
|
|
|
'availability_enum' => ProductItemAvailabilityValues::getInstance()->getValues(), |
742
|
|
|
'condition_enum' => ProductItemConditionValues::getInstance()->getValues(), |
743
|
|
|
'gender_enum' => ProductItemGenderValues::getInstance()->getValues(), |
744
|
|
|
'visibility_enum' => ProductItemVisibilityValues::getInstance()->getValues(), |
745
|
|
|
); |
746
|
|
|
|
747
|
|
|
$request = new ApiRequest( |
748
|
|
|
$this->api, |
749
|
|
|
$this->data['id'], |
750
|
|
|
RequestInterface::METHOD_POST, |
751
|
|
|
'/products', |
752
|
|
|
new ProductItem(), |
753
|
|
|
'EDGE', |
754
|
|
|
ProductItem::getFieldsEnum()->getValues(), |
755
|
|
|
new TypeChecker($param_types, $enums) |
756
|
|
|
); |
757
|
|
|
$request->addParams($params); |
758
|
|
|
$request->addFields($fields); |
759
|
|
|
return $pending ? $request : $request->execute(); |
760
|
|
|
} |
761
|
|
|
|
762
|
|
|
public function createVideo(array $fields = array(), array $params = array(), $pending = false) { |
763
|
|
|
$this->assureId(); |
764
|
|
|
|
765
|
|
|
$param_types = array( |
766
|
|
|
'content_category' => 'content_category_enum', |
767
|
|
|
'description' => 'string', |
768
|
|
|
'embeddable' => 'bool', |
769
|
|
|
'file_size' => 'unsigned int', |
770
|
|
|
'file_url' => 'string', |
771
|
|
|
'fov' => 'unsigned int', |
772
|
|
|
'guide' => 'list<list<unsigned int>>', |
773
|
|
|
'guide_enabled' => 'bool', |
774
|
|
|
'initial_heading' => 'unsigned int', |
775
|
|
|
'initial_pitch' => 'unsigned int', |
776
|
|
|
'original_fov' => 'unsigned int', |
777
|
|
|
'original_projection_type' => 'original_projection_type_enum', |
778
|
|
|
'referenced_sticker_id' => 'string', |
779
|
|
|
'replace_video_id' => 'string', |
780
|
|
|
'slideshow_spec' => 'map', |
781
|
|
|
'source' => 'string', |
782
|
|
|
'spherical' => 'bool', |
783
|
|
|
'start_offset' => 'unsigned int', |
784
|
|
|
'swap_mode' => 'swap_mode_enum', |
785
|
|
|
'thumb' => 'file', |
786
|
|
|
'title' => 'string', |
787
|
|
|
'unpublished_content_type' => 'unpublished_content_type_enum', |
788
|
|
|
'upload_phase' => 'upload_phase_enum', |
789
|
|
|
'upload_session_id' => 'string', |
790
|
|
|
'video_file_chunk' => 'string', |
791
|
|
|
); |
792
|
|
|
$enums = array( |
793
|
|
|
'content_category_enum' => array( |
794
|
|
|
'BEAUTY_FASHION', |
795
|
|
|
'BUSINESS', |
796
|
|
|
'CARS_TRUCKS', |
797
|
|
|
'COMEDY', |
798
|
|
|
'CUTE_ANIMALS', |
799
|
|
|
'ENTERTAINMENT', |
800
|
|
|
'FAMILY', |
801
|
|
|
'FOOD_HEALTH', |
802
|
|
|
'HOME', |
803
|
|
|
'LIFESTYLE', |
804
|
|
|
'MUSIC', |
805
|
|
|
'NEWS', |
806
|
|
|
'POLITICS', |
807
|
|
|
'SCIENCE', |
808
|
|
|
'SPORTS', |
809
|
|
|
'TECHNOLOGY', |
810
|
|
|
'VIDEO_GAMING', |
811
|
|
|
'OTHER', |
812
|
|
|
), |
813
|
|
|
'original_projection_type_enum' => array( |
814
|
|
|
'equirectangular', |
815
|
|
|
'cubemap', |
816
|
|
|
'equiangular_cubemap', |
817
|
|
|
), |
818
|
|
|
'swap_mode_enum' => array( |
819
|
|
|
'replace', |
820
|
|
|
), |
821
|
|
|
'unpublished_content_type_enum' => array( |
822
|
|
|
'SCHEDULED', |
823
|
|
|
'DRAFT', |
824
|
|
|
'ADS_POST', |
825
|
|
|
), |
826
|
|
|
'upload_phase_enum' => array( |
827
|
|
|
'start', |
828
|
|
|
'transfer', |
829
|
|
|
'finish', |
830
|
|
|
'cancel', |
831
|
|
|
), |
832
|
|
|
); |
833
|
|
|
|
834
|
|
|
$request = new ApiRequest( |
835
|
|
|
$this->api, |
836
|
|
|
$this->data['id'], |
837
|
|
|
RequestInterface::METHOD_POST, |
838
|
|
|
'/videos', |
839
|
|
|
new AbstractCrudObject(), |
840
|
|
|
'EDGE', |
841
|
|
|
array(), |
842
|
|
|
new TypeChecker($param_types, $enums) |
843
|
|
|
); |
844
|
|
|
$request->addParams($params); |
845
|
|
|
$request->addFields($fields); |
846
|
|
|
return $pending ? $request : $request->execute(); |
847
|
|
|
} |
848
|
|
|
|
849
|
|
|
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) { |
850
|
|
|
$this->assureId(); |
851
|
|
|
|
852
|
|
|
$param_types = array( |
853
|
|
|
); |
854
|
|
|
$enums = array( |
855
|
|
|
); |
856
|
|
|
|
857
|
|
|
$request = new ApiRequest( |
858
|
|
|
$this->api, |
859
|
|
|
$this->data['id'], |
860
|
|
|
RequestInterface::METHOD_DELETE, |
861
|
|
|
'/', |
862
|
|
|
new AbstractCrudObject(), |
863
|
|
|
'NODE', |
864
|
|
|
array(), |
865
|
|
|
new TypeChecker($param_types, $enums) |
866
|
|
|
); |
867
|
|
|
$request->addParams($params); |
868
|
|
|
$request->addFields($fields); |
869
|
|
|
return $pending ? $request : $request->execute(); |
870
|
|
|
} |
871
|
|
|
|
872
|
|
|
public function getSelf(array $fields = array(), array $params = array(), $pending = false) { |
873
|
|
|
$this->assureId(); |
874
|
|
|
|
875
|
|
|
$param_types = array( |
876
|
|
|
); |
877
|
|
|
$enums = array( |
878
|
|
|
); |
879
|
|
|
|
880
|
|
|
$request = new ApiRequest( |
881
|
|
|
$this->api, |
882
|
|
|
$this->data['id'], |
883
|
|
|
RequestInterface::METHOD_GET, |
884
|
|
|
'/', |
885
|
|
|
new ProductCatalog(), |
886
|
|
|
'NODE', |
887
|
|
|
ProductCatalog::getFieldsEnum()->getValues(), |
888
|
|
|
new TypeChecker($param_types, $enums) |
889
|
|
|
); |
890
|
|
|
$request->addParams($params); |
891
|
|
|
$request->addFields($fields); |
892
|
|
|
return $pending ? $request : $request->execute(); |
893
|
|
|
} |
894
|
|
|
|
895
|
|
|
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) { |
896
|
|
|
$this->assureId(); |
897
|
|
|
|
898
|
|
|
$param_types = array( |
899
|
|
|
'da_display_settings' => 'Object', |
900
|
|
|
'default_image_url' => 'string', |
901
|
|
|
'fallback_image_url' => 'string', |
902
|
|
|
'flight_catalog_settings' => 'map', |
903
|
|
|
'name' => 'string', |
904
|
|
|
); |
905
|
|
|
$enums = array( |
906
|
|
|
); |
907
|
|
|
|
908
|
|
|
$request = new ApiRequest( |
909
|
|
|
$this->api, |
910
|
|
|
$this->data['id'], |
911
|
|
|
RequestInterface::METHOD_POST, |
912
|
|
|
'/', |
913
|
|
|
new ProductCatalog(), |
914
|
|
|
'NODE', |
915
|
|
|
ProductCatalog::getFieldsEnum()->getValues(), |
916
|
|
|
new TypeChecker($param_types, $enums) |
917
|
|
|
); |
918
|
|
|
$request->addParams($params); |
919
|
|
|
$request->addFields($fields); |
920
|
|
|
return $pending ? $request : $request->execute(); |
921
|
|
|
} |
922
|
|
|
|
923
|
|
|
/** |
924
|
|
|
* @param int $user_id |
925
|
|
|
* @param string $role |
926
|
|
|
*/ |
927
|
|
|
public function addUserPermission($user_id, $role) { |
928
|
|
|
$params = array( |
929
|
|
|
'user' => $user_id, |
930
|
|
|
'role' => $role, |
931
|
|
|
); |
932
|
|
|
$this->getApi()->call( |
933
|
|
|
'/'.$this->assureId().'/userpermissions', |
934
|
|
|
RequestInterface::METHOD_POST, |
935
|
|
|
$params); |
936
|
|
|
} |
937
|
|
|
|
938
|
|
|
/** |
939
|
|
|
* @param int $user_id |
940
|
|
|
*/ |
941
|
|
|
public function deleteUserPermission($user_id) { |
942
|
|
|
$params = array( |
943
|
|
|
'user' => $user_id, |
944
|
|
|
); |
945
|
|
|
$this->getApi()->call( |
946
|
|
|
'/'.$this->assureId().'/userpermissions', |
947
|
|
|
RequestInterface::METHOD_DELETE, |
948
|
|
|
$params); |
949
|
|
|
} |
950
|
|
|
} |
951
|
|
|
|