Failed Conditions
Push — master ( 81ead6...837ea5 )
by
unknown
13:08
created

OffsitePixel::updateSelf()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 28
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 28
rs 8.8571
cc 2
eloc 22
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\OffsitePixelFields;
32
use FacebookAds\Object\Values\OffsitePixelTagValues;
33
34
/**
35
 * This class is auto-genereated.
36
 *
37
 * For any issues or feature requests related to this class, please let us know
38
 * on github and we'll fix in our codegen framework. We'll not be able to accept
39
 * pull request for this class.
40
 *
41
 */
42
43
class OffsitePixel extends AbstractCrudObject {
44
45
  protected function getEndpoint() {
46
    return 'offsitepixels';
47
  }
48
49
  /**
50
   * @return OffsitePixelFields
51
   */
52
  public static function getFieldsEnum() {
53
    return OffsitePixelFields::getInstance();
54
  }
55
56
  protected static function getReferencedEnums() {
57
    $ref_enums = array();
58
    $ref_enums['Tag'] = OffsitePixelTagValues::getInstance()->getValues();
59
    return $ref_enums;
60
  }
61
62
63
  public function deleteAdAccounts(array $fields = array(), array $params = array(), $pending = false) {
64
    $this->assureId();
65
66
    $param_types = array(
67
      'adaccounts' => 'list<string>',
68
    );
69
    $enums = array(
70
    );
71
72
    $request = new ApiRequest(
73
      $this->api,
74
      $this->data['id'],
75
      RequestInterface::METHOD_DELETE,
76
      '/adaccounts',
77
      new AdAccount(),
78
      'EDGE',
79
      AdAccount::getFieldsEnum()->getValues(),
80
      new TypeChecker($param_types, $enums)
81
    );
82
    $request->addParams($params);
83
    $request->addFields($fields);
84
    return $pending ? $request : $request->execute();
85
  }
86
87
  public function getAdAccounts(array $fields = array(), array $params = array(), $pending = false) {
88
    $this->assureId();
89
90
    $param_types = array(
91
    );
92
    $enums = array(
93
    );
94
95
    $request = new ApiRequest(
96
      $this->api,
97
      $this->data['id'],
98
      RequestInterface::METHOD_GET,
99
      '/adaccounts',
100
      new AdAccount(),
101
      'EDGE',
102
      AdAccount::getFieldsEnum()->getValues(),
103
      new TypeChecker($param_types, $enums)
104
    );
105
    $request->addParams($params);
106
    $request->addFields($fields);
107
    return $pending ? $request : $request->execute();
108
  }
109
110
  public function createAdAccount(array $fields = array(), array $params = array(), $pending = false) {
111
    $this->assureId();
112
113
    $param_types = array(
114
      'adaccounts' => 'list<string>',
115
    );
116
    $enums = array(
117
    );
118
119
    $request = new ApiRequest(
120
      $this->api,
121
      $this->data['id'],
122
      RequestInterface::METHOD_POST,
123
      '/adaccounts',
124
      new AdAccount(),
125
      'EDGE',
126
      AdAccount::getFieldsEnum()->getValues(),
127
      new TypeChecker($param_types, $enums)
128
    );
129
    $request->addParams($params);
130
    $request->addFields($fields);
131
    return $pending ? $request : $request->execute();
132
  }
133
134
  public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
135
    $this->assureId();
136
137
    $param_types = array(
138
      'id' => 'string',
139
    );
140
    $enums = array(
141
    );
142
143
    $request = new ApiRequest(
144
      $this->api,
145
      $this->data['id'],
146
      RequestInterface::METHOD_DELETE,
147
      '/',
148
      new AbstractCrudObject(),
149
      'NODE',
150
      array(),
151
      new TypeChecker($param_types, $enums)
152
    );
153
    $request->addParams($params);
154
    $request->addFields($fields);
155
    return $pending ? $request : $request->execute();
156
  }
157
158
  public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
159
    $this->assureId();
160
161
    $param_types = array(
162
    );
163
    $enums = array(
164
    );
165
166
    $request = new ApiRequest(
167
      $this->api,
168
      $this->data['id'],
169
      RequestInterface::METHOD_GET,
170
      '/',
171
      new OffsitePixel(),
172
      'NODE',
173
      OffsitePixel::getFieldsEnum()->getValues(),
174
      new TypeChecker($param_types, $enums)
175
    );
176
    $request->addParams($params);
177
    $request->addFields($fields);
178
    return $pending ? $request : $request->execute();
179
  }
180
181
  public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
182
    $this->assureId();
183
184
    $param_types = array(
185
      'app_event' => 'string',
186
      'app_id_for_app_event_firing' => 'int',
187
      'id' => 'string',
188
      'name' => 'string',
189
      'tag' => 'tag_enum',
190
    );
191
    $enums = array(
192
      'tag_enum' => OffsitePixelTagValues::getInstance()->getValues(),
193
    );
194
195
    $request = new ApiRequest(
196
      $this->api,
197
      $this->data['id'],
198
      RequestInterface::METHOD_POST,
199
      '/',
200
      new AbstractCrudObject(),
201
      'NODE',
202
      array(),
203
      new TypeChecker($param_types, $enums)
204
    );
205
    $request->addParams($params);
206
    $request->addFields($fields);
207
    return $pending ? $request : $request->execute();
208
  }
209
210
}
211