Completed
Push — master ( 53bee2...ad5da8 )
by
unknown
04:44
created

ProductCatalog::getProductFeeds()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 2
eloc 16
nc 2
nop 3
1
<?php
2
/**
3
 * Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
4
 *
5
 * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
 * use, copy, modify, and distribute this software in source code or binary
7
 * form for use in connection with the web services and APIs provided by
8
 * Facebook.
9
 *
10
 * As with any software that integrates with the Facebook platform, your use
11
 * of this software is subject to the Facebook Developer Principles and
12
 * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
 * shall be included in all copies or substantial portions of the software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 * DEALINGS IN THE SOFTWARE.
22
 *
23
 */
24
25
namespace FacebookAds\Object;
26
27
use FacebookAds\ApiRequest;
28
use FacebookAds\Cursor;
29
use FacebookAds\Http\RequestInterface;
30
use FacebookAds\TypeChecker;
31
use FacebookAds\Object\Fields\ProductCatalogFields;
32
use FacebookAds\Object\Values\AdVideoContentCategoryValues;
33
use FacebookAds\Object\Values\AdVideoSwapModeValues;
34
use FacebookAds\Object\Values\AdVideoUnpublishedContentTypeValues;
35
use FacebookAds\Object\Values\AdVideoUploadPhaseValues;
36
use FacebookAds\Object\Values\ProductCatalogHotelRoomsBatchStandardValues;
37
use FacebookAds\Object\Values\ProductCatalogPricingVariablesBatchStandardValues;
38
use FacebookAds\Object\Values\ProductCatalogVerticalValues;
39
use FacebookAds\Object\Values\ProductFeedDelimiterValues;
40
use FacebookAds\Object\Values\ProductFeedEncodingValues;
41
use FacebookAds\Object\Values\ProductFeedQuotedFieldsModeValues;
42
use FacebookAds\Object\Values\ProductItemAvailabilityValues;
43
use FacebookAds\Object\Values\ProductItemConditionValues;
44
use FacebookAds\Object\Values\ProductItemGenderValues;
45
use FacebookAds\Object\Values\ProductItemVisibilityValues;
46
47
/**
48
 * This class is auto-genereated.
49
 *
50
 * For any issues or feature requests related to this class, please let us know
51
 * on github and we'll fix in our codegen framework. We'll not be able to accept
52
 * pull request for this class.
53
 *
54
 */
55
56
class ProductCatalog extends AbstractCrudObject {
57
58
  protected function getEndpoint() {
59
    return 'product_catalogs';
60
  }
61
62
  /**
63
   * @return ProductCatalogFields
64
   */
65
  public static function getFieldsEnum() {
66
    return ProductCatalogFields::getInstance();
67
  }
68
69
  protected static function getReferencedEnums() {
70
    $ref_enums = array();
71
    $ref_enums['Vertical'] = ProductCatalogVerticalValues::getInstance()->getValues();
72
    return $ref_enums;
73
  }
74
75
76
  public function getAgencies(array $fields = array(), array $params = array(), $pending = false) {
77
    $this->assureId();
78
79
    $param_types = array(
80
    );
81
    $enums = array(
82
    );
83
84
    $request = new ApiRequest(
85
      $this->api,
86
      $this->data['id'],
87
      RequestInterface::METHOD_GET,
88
      '/agencies',
89
      new Business(),
90
      'EDGE',
91
      Business::getFieldsEnum()->getValues(),
92
      new TypeChecker($param_types, $enums)
93
    );
94
    $request->addParams($params);
95
    $request->addFields($fields);
96
    return $pending ? $request : $request->execute();
97
  }
98
99
  public function getDestinations(array $fields = array(), array $params = array(), $pending = false) {
100
    $this->assureId();
101
102
    $param_types = array(
103
      'bulk_pagination' => 'bool',
104
      'filter' => 'Object',
105
    );
106
    $enums = array(
107
    );
108
109
    $request = new ApiRequest(
110
      $this->api,
111
      $this->data['id'],
112
      RequestInterface::METHOD_GET,
113
      '/destinations',
114
      new AbstractCrudObject(),
115
      'EDGE',
116
      array(),
117
      new TypeChecker($param_types, $enums)
118
    );
119
    $request->addParams($params);
120
    $request->addFields($fields);
121
    return $pending ? $request : $request->execute();
122
  }
123
124
  public function deleteExternalEventSources(array $fields = array(), array $params = array(), $pending = false) {
125
    $this->assureId();
126
127
    $param_types = array(
128
      'external_event_sources' => 'list<string>',
129
    );
130
    $enums = array(
131
    );
132
133
    $request = new ApiRequest(
134
      $this->api,
135
      $this->data['id'],
136
      RequestInterface::METHOD_DELETE,
137
      '/external_event_sources',
138
      new AbstractCrudObject(),
139
      'EDGE',
140
      array(),
141
      new TypeChecker($param_types, $enums)
142
    );
143
    $request->addParams($params);
144
    $request->addFields($fields);
145
    return $pending ? $request : $request->execute();
146
  }
147
148
  public function getExternalEventSources(array $fields = array(), array $params = array(), $pending = false) {
149
    $this->assureId();
150
151
    $param_types = array(
152
    );
153
    $enums = array(
154
    );
155
156
    $request = new ApiRequest(
157
      $this->api,
158
      $this->data['id'],
159
      RequestInterface::METHOD_GET,
160
      '/external_event_sources',
161
      new ExternalEventSource(),
162
      'EDGE',
163
      ExternalEventSource::getFieldsEnum()->getValues(),
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 createExternalEventSource(array $fields = array(), array $params = array(), $pending = false) {
172
    $this->assureId();
173
174
    $param_types = array(
175
      'external_event_sources' => 'list<string>',
176
    );
177
    $enums = array(
178
    );
179
180
    $request = new ApiRequest(
181
      $this->api,
182
      $this->data['id'],
183
      RequestInterface::METHOD_POST,
184
      '/external_event_sources',
185
      new ExternalEventSource(),
186
      'EDGE',
187
      ExternalEventSource::getFieldsEnum()->getValues(),
188
      new TypeChecker($param_types, $enums)
189
    );
190
    $request->addParams($params);
191
    $request->addFields($fields);
192
    return $pending ? $request : $request->execute();
193
  }
194
195
  public function getHotelRoomsBatch(array $fields = array(), array $params = array(), $pending = false) {
196
    $this->assureId();
197
198
    $param_types = array(
199
      'handle' => 'string',
200
    );
201
    $enums = array(
202
    );
203
204
    $request = new ApiRequest(
205
      $this->api,
206
      $this->data['id'],
207
      RequestInterface::METHOD_GET,
208
      '/hotel_rooms_batch',
209
      new ProductCatalogHotelRoomsBatch(),
210
      'EDGE',
211
      ProductCatalogHotelRoomsBatch::getFieldsEnum()->getValues(),
212
      new TypeChecker($param_types, $enums)
213
    );
214
    $request->addParams($params);
215
    $request->addFields($fields);
216
    return $pending ? $request : $request->execute();
217
  }
218
219
  public function createHotelRoomsBatch(array $fields = array(), array $params = array(), $pending = false) {
220
    $this->assureId();
221
222
    $param_types = array(
223
      'file' => 'file',
224
      'password' => 'string',
225
      'standard' => 'standard_enum',
226
      'update_only' => 'bool',
227
      'url' => 'string',
228
      'username' => 'string',
229
    );
230
    $enums = array(
231
      'standard_enum' => ProductCatalogHotelRoomsBatchStandardValues::getInstance()->getValues(),
232
    );
233
234
    $request = new ApiRequest(
235
      $this->api,
236
      $this->data['id'],
237
      RequestInterface::METHOD_POST,
238
      '/hotel_rooms_batch',
239
      new ProductCatalogHotelRoomsBatch(),
240
      'EDGE',
241
      ProductCatalogHotelRoomsBatch::getFieldsEnum()->getValues(),
242
      new TypeChecker($param_types, $enums)
243
    );
244
    $request->addParams($params);
245
    $request->addFields($fields);
246
    return $pending ? $request : $request->execute();
247
  }
248
249
  public function getHotels(array $fields = array(), array $params = array(), $pending = false) {
250
    $this->assureId();
251
252
    $param_types = array(
253
      'bulk_pagination' => 'bool',
254
      'filter' => 'Object',
255
    );
256
    $enums = array(
257
    );
258
259
    $request = new ApiRequest(
260
      $this->api,
261
      $this->data['id'],
262
      RequestInterface::METHOD_GET,
263
      '/hotels',
264
      new Hotel(),
265
      'EDGE',
266
      Hotel::getFieldsEnum()->getValues(),
267
      new TypeChecker($param_types, $enums)
268
    );
269
    $request->addParams($params);
270
    $request->addFields($fields);
271
    return $pending ? $request : $request->execute();
272
  }
273
274
  public function createHotel(array $fields = array(), array $params = array(), $pending = false) {
275
    $this->assureId();
276
277
    $param_types = array(
278
      'address' => 'Object',
279
      'applinks' => 'Object',
280
      'brand' => 'string',
281
      'description' => 'string',
282
      'guest_ratings' => 'list<Object>',
283
      'hotel_id' => 'string',
284
      'images' => 'list<Object>',
285
      'name' => 'string',
286
      'phone' => 'string',
287
      'star_rating' => 'float',
288
      'url' => 'string',
289
    );
290
    $enums = array(
291
    );
292
293
    $request = new ApiRequest(
294
      $this->api,
295
      $this->data['id'],
296
      RequestInterface::METHOD_POST,
297
      '/hotels',
298
      new Hotel(),
299
      'EDGE',
300
      Hotel::getFieldsEnum()->getValues(),
301
      new TypeChecker($param_types, $enums)
302
    );
303
    $request->addParams($params);
304
    $request->addFields($fields);
305
    return $pending ? $request : $request->execute();
306
  }
307
308
  public function getPricingVariablesBatch(array $fields = array(), array $params = array(), $pending = false) {
309
    $this->assureId();
310
311
    $param_types = array(
312
      'handle' => 'string',
313
    );
314
    $enums = array(
315
    );
316
317
    $request = new ApiRequest(
318
      $this->api,
319
      $this->data['id'],
320
      RequestInterface::METHOD_GET,
321
      '/pricing_variables_batch',
322
      new ProductCatalogPricingVariablesBatch(),
323
      'EDGE',
324
      ProductCatalogPricingVariablesBatch::getFieldsEnum()->getValues(),
325
      new TypeChecker($param_types, $enums)
326
    );
327
    $request->addParams($params);
328
    $request->addFields($fields);
329
    return $pending ? $request : $request->execute();
330
  }
331
332
  public function createPricingVariablesBatch(array $fields = array(), array $params = array(), $pending = false) {
333
    $this->assureId();
334
335
    $param_types = array(
336
      'file' => 'file',
337
      'password' => 'string',
338
      'standard' => 'standard_enum',
339
      'update_only' => 'bool',
340
      'url' => 'string',
341
      'username' => 'string',
342
    );
343
    $enums = array(
344
      'standard_enum' => ProductCatalogPricingVariablesBatchStandardValues::getInstance()->getValues(),
345
    );
346
347
    $request = new ApiRequest(
348
      $this->api,
349
      $this->data['id'],
350
      RequestInterface::METHOD_POST,
351
      '/pricing_variables_batch',
352
      new ProductCatalogPricingVariablesBatch(),
353
      'EDGE',
354
      ProductCatalogPricingVariablesBatch::getFieldsEnum()->getValues(),
355
      new TypeChecker($param_types, $enums)
356
    );
357
    $request->addParams($params);
358
    $request->addFields($fields);
359
    return $pending ? $request : $request->execute();
360
  }
361
362
  public function getProductFeeds(array $fields = array(), array $params = array(), $pending = false) {
363
    $this->assureId();
364
365
    $param_types = array(
366
    );
367
    $enums = array(
368
    );
369
370
    $request = new ApiRequest(
371
      $this->api,
372
      $this->data['id'],
373
      RequestInterface::METHOD_GET,
374
      '/product_feeds',
375
      new ProductFeed(),
376
      'EDGE',
377
      ProductFeed::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 createProductFeed(array $fields = array(), array $params = array(), $pending = false) {
386
    $this->assureId();
387
388
    $param_types = array(
389
      'country' => 'string',
390
      'default_currency' => 'string',
391
      'deletion_enabled' => 'bool',
392
      'delimiter' => 'delimiter_enum',
393
      'encoding' => 'encoding_enum',
394
      'file_name' => 'string',
395
      'name' => 'string',
396
      'quoted_fields_mode' => 'quoted_fields_mode_enum',
397
      'schedule' => 'string',
398
    );
399
    $enums = array(
400
      'delimiter_enum' => ProductFeedDelimiterValues::getInstance()->getValues(),
401
      'encoding_enum' => ProductFeedEncodingValues::getInstance()->getValues(),
402
      'quoted_fields_mode_enum' => ProductFeedQuotedFieldsModeValues::getInstance()->getValues(),
403
    );
404
405
    $request = new ApiRequest(
406
      $this->api,
407
      $this->data['id'],
408
      RequestInterface::METHOD_POST,
409
      '/product_feeds',
410
      new ProductFeed(),
411
      'EDGE',
412
      ProductFeed::getFieldsEnum()->getValues(),
413
      new TypeChecker($param_types, $enums)
414
    );
415
    $request->addParams($params);
416
    $request->addFields($fields);
417
    return $pending ? $request : $request->execute();
418
  }
419
420
  public function getProductGroups(array $fields = array(), array $params = array(), $pending = false) {
421
    $this->assureId();
422
423
    $param_types = array(
424
    );
425
    $enums = array(
426
    );
427
428
    $request = new ApiRequest(
429
      $this->api,
430
      $this->data['id'],
431
      RequestInterface::METHOD_GET,
432
      '/product_groups',
433
      new ProductGroup(),
434
      'EDGE',
435
      ProductGroup::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 createProductGroup(array $fields = array(), array $params = array(), $pending = false) {
444
    $this->assureId();
445
446
    $param_types = array(
447
      'retailer_id' => 'string',
448
      'variants' => 'list<Object>',
449
    );
450
    $enums = array(
451
    );
452
453
    $request = new ApiRequest(
454
      $this->api,
455
      $this->data['id'],
456
      RequestInterface::METHOD_POST,
457
      '/product_groups',
458
      new ProductGroup(),
459
      'EDGE',
460
      ProductGroup::getFieldsEnum()->getValues(),
461
      new TypeChecker($param_types, $enums)
462
    );
463
    $request->addParams($params);
464
    $request->addFields($fields);
465
    return $pending ? $request : $request->execute();
466
  }
467
468
  public function getProductSets(array $fields = array(), array $params = array(), $pending = false) {
469
    $this->assureId();
470
471
    $param_types = array(
472
      'ancestor_id' => 'string',
473
      'has_children' => 'bool',
474
      'parent_id' => 'string',
475
      'retailer_id' => 'string',
476
    );
477
    $enums = array(
478
    );
479
480
    $request = new ApiRequest(
481
      $this->api,
482
      $this->data['id'],
483
      RequestInterface::METHOD_GET,
484
      '/product_sets',
485
      new ProductSet(),
486
      'EDGE',
487
      ProductSet::getFieldsEnum()->getValues(),
488
      new TypeChecker($param_types, $enums)
489
    );
490
    $request->addParams($params);
491
    $request->addFields($fields);
492
    return $pending ? $request : $request->execute();
493
  }
494
495
  public function createProductSet(array $fields = array(), array $params = array(), $pending = false) {
496
    $this->assureId();
497
498
    $param_types = array(
499
      'filter' => 'Object',
500
      'name' => 'string',
501
    );
502
    $enums = array(
503
    );
504
505
    $request = new ApiRequest(
506
      $this->api,
507
      $this->data['id'],
508
      RequestInterface::METHOD_POST,
509
      '/product_sets',
510
      new ProductSet(),
511
      'EDGE',
512
      ProductSet::getFieldsEnum()->getValues(),
513
      new TypeChecker($param_types, $enums)
514
    );
515
    $request->addParams($params);
516
    $request->addFields($fields);
517
    return $pending ? $request : $request->execute();
518
  }
519
520
  public function getProductSetsBatch(array $fields = array(), array $params = array(), $pending = false) {
521
    $this->assureId();
522
523
    $param_types = array(
524
      'handle' => '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_batch',
534
      new AbstractCrudObject(),
535
      'EDGE',
536
      array(),
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 getProducts(array $fields = array(), array $params = array(), $pending = false) {
545
    $this->assureId();
546
547
    $param_types = array(
548
      'bulk_pagination' => 'bool',
549
      'filter' => 'Object',
550
    );
551
    $enums = array(
552
    );
553
554
    $request = new ApiRequest(
555
      $this->api,
556
      $this->data['id'],
557
      RequestInterface::METHOD_GET,
558
      '/products',
559
      new ProductItem(),
560
      'EDGE',
561
      ProductItem::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 createProduct(array $fields = array(), array $params = array(), $pending = false) {
570
    $this->assureId();
571
572
    $param_types = array(
573
      'additional_image_urls' => 'list<string>',
574
      'android_app_name' => 'string',
575
      'android_class' => 'string',
576
      'android_package' => 'string',
577
      'android_url' => 'string',
578
      'availability' => 'availability_enum',
579
      'brand' => 'string',
580
      'category' => 'string',
581
      'checkout_url' => 'string',
582
      'color' => 'string',
583
      'condition' => 'condition_enum',
584
      'currency' => 'string',
585
      'custom_data' => 'map',
586
      'custom_label_0' => 'string',
587
      'custom_label_1' => 'string',
588
      'custom_label_2' => 'string',
589
      'custom_label_3' => 'string',
590
      'custom_label_4' => 'string',
591
      'description' => 'string',
592
      'expiration_date' => 'string',
593
      'gender' => 'gender_enum',
594
      'gtin' => 'string',
595
      'image_url' => 'string',
596
      'inventory' => 'unsigned int',
597
      'ios_app_name' => 'string',
598
      'ios_app_store_id' => 'unsigned int',
599
      'ios_url' => 'string',
600
      'ipad_app_name' => 'string',
601
      'ipad_app_store_id' => 'unsigned int',
602
      'ipad_url' => 'string',
603
      'iphone_app_name' => 'string',
604
      'iphone_app_store_id' => 'unsigned int',
605
      'iphone_url' => 'string',
606
      'manufacturer_part_number' => 'string',
607
      'name' => 'string',
608
      'ordering_index' => 'unsigned int',
609
      'pattern' => 'string',
610
      'price' => 'unsigned int',
611
      'product_type' => 'string',
612
      'retailer_id' => 'string',
613
      'retailer_product_group_id' => 'string',
614
      'sale_price' => 'unsigned int',
615
      'sale_price_end_date' => 'datetime',
616
      'sale_price_start_date' => 'datetime',
617
      'short_description' => 'string',
618
      'size' => 'string',
619
      'start_date' => 'string',
620
      'url' => 'string',
621
      'visibility' => 'visibility_enum',
622
      'windows_phone_app_id' => 'unsigned int',
623
      'windows_phone_app_name' => 'string',
624
      'windows_phone_url' => 'string',
625
    );
626
    $enums = array(
627
      'availability_enum' => ProductItemAvailabilityValues::getInstance()->getValues(),
628
      'condition_enum' => ProductItemConditionValues::getInstance()->getValues(),
629
      'gender_enum' => ProductItemGenderValues::getInstance()->getValues(),
630
      'visibility_enum' => ProductItemVisibilityValues::getInstance()->getValues(),
631
    );
632
633
    $request = new ApiRequest(
634
      $this->api,
635
      $this->data['id'],
636
      RequestInterface::METHOD_POST,
637
      '/products',
638
      new ProductItem(),
639
      'EDGE',
640
      ProductItem::getFieldsEnum()->getValues(),
641
      new TypeChecker($param_types, $enums)
642
    );
643
    $request->addParams($params);
644
    $request->addFields($fields);
645
    return $pending ? $request : $request->execute();
646
  }
647
648
  public function createVideo(array $fields = array(), array $params = array(), $pending = false) {
649
    $this->assureId();
650
651
    $param_types = array(
652
      'content_category' => 'content_category_enum',
653
      'description' => 'string',
654
      'embeddable' => 'bool',
655
      'file_size' => 'unsigned int',
656
      'file_url' => 'string',
657
      'referenced_sticker_id' => 'string',
658
      'replace_video_id' => 'string',
659
      'slideshow_spec' => 'map',
660
      'source' => 'string',
661
      'start_offset' => 'unsigned int',
662
      'swap_mode' => 'swap_mode_enum',
663
      'thumb' => 'file',
664
      'title' => 'string',
665
      'unpublished_content_type' => 'unpublished_content_type_enum',
666
      'upload_phase' => 'upload_phase_enum',
667
      'upload_session_id' => 'string',
668
      'video_file_chunk' => 'string',
669
    );
670
    $enums = array(
671
      'content_category_enum' => array(
672
        'BEAUTY_FASHION',
673
        'BUSINESS',
674
        'CARS_TRUCKS',
675
        'COMEDY',
676
        'CUTE_ANIMALS',
677
        'ENTERTAINMENT',
678
        'FAMILY',
679
        'FOOD_HEALTH',
680
        'HOME',
681
        'LIFESTYLE',
682
        'MUSIC',
683
        'NEWS',
684
        'POLITICS',
685
        'SCIENCE',
686
        'SPORTS',
687
        'TECHNOLOGY',
688
        'VIDEO_GAMING',
689
        'OTHER',
690
      ),
691
      'swap_mode_enum' => array(
692
        'replace',
693
      ),
694
      'unpublished_content_type_enum' => array(
695
        'SCHEDULED',
696
        'DRAFT',
697
        'ADS_POST',
698
      ),
699
      'upload_phase_enum' => array(
700
        'start',
701
        'transfer',
702
        'finish',
703
        'cancel',
704
      ),
705
    );
706
707
    $request = new ApiRequest(
708
      $this->api,
709
      $this->data['id'],
710
      RequestInterface::METHOD_POST,
711
      '/videos',
712
      new AbstractCrudObject(),
713
      'EDGE',
714
      array(),
715
      new TypeChecker($param_types, $enums)
716
    );
717
    $request->addParams($params);
718
    $request->addFields($fields);
719
    return $pending ? $request : $request->execute();
720
  }
721
722
  public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
723
    $this->assureId();
724
725
    $param_types = array(
726
    );
727
    $enums = array(
728
    );
729
730
    $request = new ApiRequest(
731
      $this->api,
732
      $this->data['id'],
733
      RequestInterface::METHOD_DELETE,
734
      '/',
735
      new AbstractCrudObject(),
736
      'NODE',
737
      array(),
738
      new TypeChecker($param_types, $enums)
739
    );
740
    $request->addParams($params);
741
    $request->addFields($fields);
742
    return $pending ? $request : $request->execute();
743
  }
744
745
  public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
746
    $this->assureId();
747
748
    $param_types = array(
749
    );
750
    $enums = array(
751
    );
752
753
    $request = new ApiRequest(
754
      $this->api,
755
      $this->data['id'],
756
      RequestInterface::METHOD_GET,
757
      '/',
758
      new ProductCatalog(),
759
      'NODE',
760
      ProductCatalog::getFieldsEnum()->getValues(),
761
      new TypeChecker($param_types, $enums)
762
    );
763
    $request->addParams($params);
764
    $request->addFields($fields);
765
    return $pending ? $request : $request->execute();
766
  }
767
768
  public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
769
    $this->assureId();
770
771
    $param_types = array(
772
      'name' => 'string',
773
    );
774
    $enums = array(
775
    );
776
777
    $request = new ApiRequest(
778
      $this->api,
779
      $this->data['id'],
780
      RequestInterface::METHOD_POST,
781
      '/',
782
      new ProductCatalog(),
783
      'NODE',
784
      ProductCatalog::getFieldsEnum()->getValues(),
785
      new TypeChecker($param_types, $enums)
786
    );
787
    $request->addParams($params);
788
    $request->addFields($fields);
789
    return $pending ? $request : $request->execute();
790
  }
791
792
  /**
793
   * @deprecated use createExternalEventSource instead
794
   */
795
  public function setExternalEventSources(array $pixel_ids, $pending = false) {
796
    $params = array(
797
      'external_event_sources' => $pixel_ids,
798
    );
799
    return $this->createExternalEventSource(array(), $params, $pending);
800
  }
801
802
  /**
803
   * @deprecated use deleteExternalEventSources instead
804
   */
805
  public function removeExternalEventSources(array $pixel_ids, $pending = false) {
806
    $params = array(
807
      'external_event_sources' => $pixel_ids,
808
    );
809
    return $this->deleteExternalEventSources(array(), $params, $pending);
810
  }
811
812
  /**
813
   * @param int $user_id
814
   * @param string $role
815
   */
816
  public function addUserPermission($user_id, $role) {
817
    $params = array(
818
      'user' => $user_id,
819
      'role' => $role,
820
    );
821
    $this->getApi()->call(
822
      '/'.$this->assureId().'/userpermissions',
823
      RequestInterface::METHOD_POST,
824
      $params);
825
  }
826
827
  /**
828
   * @param int $user_id
829
   */
830
  public function deleteUserPermission($user_id) {
831
    $params = array(
832
      'user' => $user_id,
833
    );
834
    $this->getApi()->call(
835
      '/'.$this->assureId().'/userpermissions',
836
      RequestInterface::METHOD_DELETE,
837
      $params);
838
  }
839
}
840