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