Completed
Push — master ( d7fefc...bfea2c )
by
unknown
13:02
created

User::getLeadGenForms()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
cc 2
eloc 18
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
      'page_id' => 'string',
113
      'query' => 'string',
114
    );
115
    $enums = array(
116
    );
117
118
    $request = new ApiRequest(
119
      $this->api,
120
      $this->data['id'],
121
      RequestInterface::METHOD_GET,
122
      '/leadgen_forms',
123
      new LeadgenForm(),
124
      'EDGE',
125
      LeadgenForm::getFieldsEnum()->getValues(),
126
      new TypeChecker($param_types, $enums)
127
    );
128
    $request->addParams($params);
129
    $request->addFields($fields);
130
    return $pending ? $request : $request->execute();
131
  }
132
133
  public function getPicture(array $fields = array(), array $params = array(), $pending = false) {
134
    $this->assureId();
135
136
    $param_types = array(
137
      'height' => 'int',
138
      'redirect' => 'bool',
139
      'type' => 'type_enum',
140
      'width' => 'int',
141
    );
142
    $enums = array(
143
      'type_enum' => ProfilePictureSourceTypeValues::getInstance()->getValues(),
144
    );
145
146
    $request = new ApiRequest(
147
      $this->api,
148
      $this->data['id'],
149
      RequestInterface::METHOD_GET,
150
      '/picture',
151
      new ProfilePictureSource(),
152
      'EDGE',
153
      ProfilePictureSource::getFieldsEnum()->getValues(),
154
      new TypeChecker($param_types, $enums)
155
    );
156
    $request->addParams($params);
157
    $request->addFields($fields);
158
    return $pending ? $request : $request->execute();
159
  }
160
161
  public function getPromotableDomains(array $fields = array(), array $params = array(), $pending = false) {
162
    $this->assureId();
163
164
    $param_types = array(
165
    );
166
    $enums = array(
167
    );
168
169
    $request = new ApiRequest(
170
      $this->api,
171
      $this->data['id'],
172
      RequestInterface::METHOD_GET,
173
      '/promotable_domains',
174
      new Domain(),
175
      'EDGE',
176
      Domain::getFieldsEnum()->getValues(),
177
      new TypeChecker($param_types, $enums)
178
    );
179
    $request->addParams($params);
180
    $request->addFields($fields);
181
    return $pending ? $request : $request->execute();
182
  }
183
184
  public function getPromotableEvents(array $fields = array(), array $params = array(), $pending = false) {
185
    $this->assureId();
186
187
    $param_types = array(
188
      'include_past_events' => 'bool',
189
      'is_page_event' => 'bool',
190
      'page_id' => 'unsigned int',
191
    );
192
    $enums = array(
193
    );
194
195
    $request = new ApiRequest(
196
      $this->api,
197
      $this->data['id'],
198
      RequestInterface::METHOD_GET,
199
      '/promotable_events',
200
      new Event(),
201
      'EDGE',
202
      Event::getFieldsEnum()->getValues(),
203
      new TypeChecker($param_types, $enums)
204
    );
205
    $request->addParams($params);
206
    $request->addFields($fields);
207
    return $pending ? $request : $request->execute();
208
  }
209
210
  public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
211
    $this->assureId();
212
213
    $param_types = array(
214
    );
215
    $enums = array(
216
    );
217
218
    $request = new ApiRequest(
219
      $this->api,
220
      $this->data['id'],
221
      RequestInterface::METHOD_GET,
222
      '/',
223
      new User(),
224
      'NODE',
225
      User::getFieldsEnum()->getValues(),
226
      new TypeChecker($param_types, $enums)
227
    );
228
    $request->addParams($params);
229
    $request->addFields($fields);
230
    return $pending ? $request : $request->execute();
231
  }
232
233
}
234