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

User::getPromotableDomains()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
rs 9.2
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\UserFields;
32
use FacebookAds\Object\Values\BusinessSurveyBusinessTypeValues;
33
use FacebookAds\Object\Values\BusinessVerticalValues;
34
use FacebookAds\Object\Values\UserInstallTypeValues;
35
36
/**
37
 * This class is auto-genereated.
38
 *
39
 * For any issues or feature requests related to this class, please let us know
40
 * on github and we'll fix in our codegen framework. We'll not be able to accept
41
 * pull request for this class.
42
 *
43
 */
44
45
class User extends AbstractCrudObject {
46
47
  /**
48
   * @return UserFields
49
   */
50
  public static function getFieldsEnum() {
51
    return UserFields::getInstance();
52
  }
53
54
  protected static function getReferencedEnums() {
55
    $ref_enums = array();
56
    $ref_enums['InstallType'] = UserInstallTypeValues::getInstance()->getValues();
57
    return $ref_enums;
58
  }
59
60
61
  public function getAccounts(array $fields = array(), array $params = array(), $pending = false) {
62
    $this->assureId();
63
64
    $param_types = array(
65
      'business_id' => 'string',
66
      'is_business' => 'bool',
67
      'is_place' => 'bool',
68
      'is_promotable' => 'bool',
69
    );
70
    $enums = array(
71
    );
72
73
    $request = new ApiRequest(
74
      $this->api,
75
      $this->data['id'],
76
      RequestInterface::METHOD_GET,
77
      '/accounts',
78
      new AbstractCrudObject(),
79
      'EDGE',
80
      array(),
81
      new TypeChecker($param_types, $enums)
82
    );
83
    $request->addParams($params);
84
    $request->addFields($fields);
85
    return $pending ? $request : $request->execute();
86
  }
87
88
  public function getAdAccountGroups(array $fields = array(), array $params = array(), $pending = false) {
89
    $this->assureId();
90
91
    $param_types = array(
92
    );
93
    $enums = array(
94
    );
95
96
    $request = new ApiRequest(
97
      $this->api,
98
      $this->data['id'],
99
      RequestInterface::METHOD_GET,
100
      '/adaccountgroups',
101
      new AdAccountGroup(),
102
      'EDGE',
103
      AdAccountGroup::getFieldsEnum()->getValues(),
104
      new TypeChecker($param_types, $enums)
105
    );
106
    $request->addParams($params);
107
    $request->addFields($fields);
108
    return $pending ? $request : $request->execute();
109
  }
110
111
  public function createAdAccountGroup(array $fields = array(), array $params = array(), $pending = false) {
112
    $this->assureId();
113
114
    $param_types = array(
115
      'accounts' => 'map',
116
      'id' => 'int',
117
      'name' => 'string',
118
      'redownload' => 'bool',
119
      'users' => 'map',
120
    );
121
    $enums = array(
122
    );
123
124
    $request = new ApiRequest(
125
      $this->api,
126
      $this->data['id'],
127
      RequestInterface::METHOD_POST,
128
      '/adaccountgroups',
129
      new AdAccountGroup(),
130
      'EDGE',
131
      AdAccountGroup::getFieldsEnum()->getValues(),
132
      new TypeChecker($param_types, $enums)
133
    );
134
    $request->addParams($params);
135
    $request->addFields($fields);
136
    return $pending ? $request : $request->execute();
137
  }
138
139
  public function getAdAccounts(array $fields = array(), array $params = array(), $pending = false) {
140
    $this->assureId();
141
142
    $param_types = array(
143
    );
144
    $enums = array(
145
    );
146
147
    $request = new ApiRequest(
148
      $this->api,
149
      $this->data['id'],
150
      RequestInterface::METHOD_GET,
151
      '/adaccounts',
152
      new AdAccount(),
153
      'EDGE',
154
      AdAccount::getFieldsEnum()->getValues(),
155
      new TypeChecker($param_types, $enums)
156
    );
157
    $request->addParams($params);
158
    $request->addFields($fields);
159
    return $pending ? $request : $request->execute();
160
  }
161
162
  public function createBusinesse(array $fields = array(), array $params = array(), $pending = false) {
163
    $this->assureId();
164
165
    $param_types = array(
166
      'id' => 'int',
167
      'name' => 'string',
168
      'primary_page' => 'string',
169
      'sales_rep_email' => 'string',
170
      'survey_business_type' => 'survey_business_type_enum',
171
      'survey_num_assets' => 'unsigned int',
172
      'survey_num_people' => 'unsigned int',
173
      'timezone_id' => 'unsigned int',
174
      'vertical' => 'vertical_enum',
175
    );
176
    $enums = array(
177
      'survey_business_type_enum' => BusinessSurveyBusinessTypeValues::getInstance()->getValues(),
178
      'vertical_enum' => BusinessVerticalValues::getInstance()->getValues(),
179
    );
180
181
    $request = new ApiRequest(
182
      $this->api,
183
      $this->data['id'],
184
      RequestInterface::METHOD_POST,
185
      '/businesses',
186
      new AbstractCrudObject(),
187
      'EDGE',
188
      array(),
189
      new TypeChecker($param_types, $enums)
190
    );
191
    $request->addParams($params);
192
    $request->addFields($fields);
193
    return $pending ? $request : $request->execute();
194
  }
195
196
  public function getLeadGenForms(array $fields = array(), array $params = array(), $pending = false) {
197
    $this->assureId();
198
199
    $param_types = array(
200
      'query' => 'string',
201
    );
202
    $enums = array(
203
    );
204
205
    $request = new ApiRequest(
206
      $this->api,
207
      $this->data['id'],
208
      RequestInterface::METHOD_GET,
209
      '/leadgen_forms',
210
      new LeadgenForm(),
211
      'EDGE',
212
      LeadgenForm::getFieldsEnum()->getValues(),
213
      new TypeChecker($param_types, $enums)
214
    );
215
    $request->addParams($params);
216
    $request->addFields($fields);
217
    return $pending ? $request : $request->execute();
218
  }
219
220
  public function getPromotableDomains(array $fields = array(), array $params = array(), $pending = false) {
221
    $this->assureId();
222
223
    $param_types = array(
224
    );
225
    $enums = array(
226
    );
227
228
    $request = new ApiRequest(
229
      $this->api,
230
      $this->data['id'],
231
      RequestInterface::METHOD_GET,
232
      '/promotable_domains',
233
      new Domain(),
234
      'EDGE',
235
      Domain::getFieldsEnum()->getValues(),
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 getPromotableEvents(array $fields = array(), array $params = array(), $pending = false) {
244
    $this->assureId();
245
246
    $param_types = array(
247
      'is_page_event' => 'bool',
248
    );
249
    $enums = array(
250
    );
251
252
    $request = new ApiRequest(
253
      $this->api,
254
      $this->data['id'],
255
      RequestInterface::METHOD_GET,
256
      '/promotable_events',
257
      new Event(),
258
      'EDGE',
259
      Event::getFieldsEnum()->getValues(),
260
      new TypeChecker($param_types, $enums)
261
    );
262
    $request->addParams($params);
263
    $request->addFields($fields);
264
    return $pending ? $request : $request->execute();
265
  }
266
267
  public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
268
    $this->assureId();
269
270
    $param_types = array(
271
    );
272
    $enums = array(
273
    );
274
275
    $request = new ApiRequest(
276
      $this->api,
277
      $this->data['id'],
278
      RequestInterface::METHOD_GET,
279
      '/',
280
      new User(),
281
      'NODE',
282
      User::getFieldsEnum()->getValues(),
283
      new TypeChecker($param_types, $enums)
284
    );
285
    $request->addParams($params);
286
    $request->addFields($fields);
287
    return $pending ? $request : $request->execute();
288
  }
289
290
}
291