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

User::getPromotableEvents()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
cc 2
eloc 17
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\UserFields;
32
use FacebookAds\Object\Values\ProfilePictureSourceTypeValues;
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 User extends AbstractCrudObject {
44
45
  /**
46
   * @return UserFields
47
   */
48
  public static function getFieldsEnum() {
49
    return UserFields::getInstance();
50
  }
51
52
  protected static function getReferencedEnums() {
53
    $ref_enums = array();
54
    return $ref_enums;
55
  }
56
57
58
  public function getAccounts(array $fields = array(), array $params = array(), $pending = false) {
59
    $this->assureId();
60
61
    $param_types = array(
62
      'business_id' => 'string',
63
      'is_business' => 'bool',
64
      'is_place' => 'bool',
65
      'is_promotable' => 'bool',
66
    );
67
    $enums = array(
68
    );
69
70
    $request = new ApiRequest(
71
      $this->api,
72
      $this->data['id'],
73
      RequestInterface::METHOD_GET,
74
      '/accounts',
75
      new AbstractCrudObject(),
76
      'EDGE',
77
      array(),
78
      new TypeChecker($param_types, $enums)
79
    );
80
    $request->addParams($params);
81
    $request->addFields($fields);
82
    return $pending ? $request : $request->execute();
83
  }
84
85
  public function getAdAccounts(array $fields = array(), array $params = array(), $pending = false) {
86
    $this->assureId();
87
88
    $param_types = array(
89
    );
90
    $enums = array(
91
    );
92
93
    $request = new ApiRequest(
94
      $this->api,
95
      $this->data['id'],
96
      RequestInterface::METHOD_GET,
97
      '/adaccounts',
98
      new AdAccount(),
99
      'EDGE',
100
      AdAccount::getFieldsEnum()->getValues(),
101
      new TypeChecker($param_types, $enums)
102
    );
103
    $request->addParams($params);
104
    $request->addFields($fields);
105
    return $pending ? $request : $request->execute();
106
  }
107
108
  public function getLeadGenForms(array $fields = array(), array $params = array(), $pending = false) {
109
    $this->assureId();
110
111
    $param_types = array(
112
      'query' => 'string',
113
    );
114
    $enums = array(
115
    );
116
117
    $request = new ApiRequest(
118
      $this->api,
119
      $this->data['id'],
120
      RequestInterface::METHOD_GET,
121
      '/leadgen_forms',
122
      new LeadgenForm(),
123
      'EDGE',
124
      LeadgenForm::getFieldsEnum()->getValues(),
125
      new TypeChecker($param_types, $enums)
126
    );
127
    $request->addParams($params);
128
    $request->addFields($fields);
129
    return $pending ? $request : $request->execute();
130
  }
131
132
  public function getPicture(array $fields = array(), array $params = array(), $pending = false) {
133
    $this->assureId();
134
135
    $param_types = array(
136
      'height' => 'int',
137
      'redirect' => 'bool',
138
      'type' => 'type_enum',
139
      'width' => 'int',
140
    );
141
    $enums = array(
142
      'type_enum' => ProfilePictureSourceTypeValues::getInstance()->getValues(),
143
    );
144
145
    $request = new ApiRequest(
146
      $this->api,
147
      $this->data['id'],
148
      RequestInterface::METHOD_GET,
149
      '/picture',
150
      new ProfilePictureSource(),
151
      'EDGE',
152
      ProfilePictureSource::getFieldsEnum()->getValues(),
153
      new TypeChecker($param_types, $enums)
154
    );
155
    $request->addParams($params);
156
    $request->addFields($fields);
157
    return $pending ? $request : $request->execute();
158
  }
159
160
  public function getPromotableDomains(array $fields = array(), array $params = array(), $pending = false) {
161
    $this->assureId();
162
163
    $param_types = array(
164
    );
165
    $enums = array(
166
    );
167
168
    $request = new ApiRequest(
169
      $this->api,
170
      $this->data['id'],
171
      RequestInterface::METHOD_GET,
172
      '/promotable_domains',
173
      new Domain(),
174
      'EDGE',
175
      Domain::getFieldsEnum()->getValues(),
176
      new TypeChecker($param_types, $enums)
177
    );
178
    $request->addParams($params);
179
    $request->addFields($fields);
180
    return $pending ? $request : $request->execute();
181
  }
182
183
  public function getPromotableEvents(array $fields = array(), array $params = array(), $pending = false) {
184
    $this->assureId();
185
186
    $param_types = array(
187
      'is_page_event' => 'bool',
188
    );
189
    $enums = array(
190
    );
191
192
    $request = new ApiRequest(
193
      $this->api,
194
      $this->data['id'],
195
      RequestInterface::METHOD_GET,
196
      '/promotable_events',
197
      new Event(),
198
      'EDGE',
199
      Event::getFieldsEnum()->getValues(),
200
      new TypeChecker($param_types, $enums)
201
    );
202
    $request->addParams($params);
203
    $request->addFields($fields);
204
    return $pending ? $request : $request->execute();
205
  }
206
207
  public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
208
    $this->assureId();
209
210
    $param_types = array(
211
    );
212
    $enums = array(
213
    );
214
215
    $request = new ApiRequest(
216
      $this->api,
217
      $this->data['id'],
218
      RequestInterface::METHOD_GET,
219
      '/',
220
      new User(),
221
      'NODE',
222
      User::getFieldsEnum()->getValues(),
223
      new TypeChecker($param_types, $enums)
224
    );
225
    $request->addParams($params);
226
    $request->addFields($fields);
227
    return $pending ? $request : $request->execute();
228
  }
229
230
}
231