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

CustomConversion::createSharedAgency()   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\CustomConversionFields;
32
use FacebookAds\Object\Values\CustomConversionCustomEventTypeValues;
33
use FacebookAds\Object\Values\CustomConversionStatsResultAggregationValues;
34
35
/**
36
 * This class is auto-genereated.
37
 *
38
 * For any issues or feature requests related to this class, please let us know
39
 * on github and we'll fix in our codegen framework. We'll not be able to accept
40
 * pull request for this class.
41
 *
42
 */
43
44
class CustomConversion extends AbstractCrudObject {
45
46
  /**
47
   * @deprecated getEndpoint function is deprecated
48
   */
49
  protected function getEndpoint() {
50
    return 'customconversions';
51
  }
52
53
  /**
54
   * @return CustomConversionFields
55
   */
56
  public static function getFieldsEnum() {
57
    return CustomConversionFields::getInstance();
58
  }
59
60
  protected static function getReferencedEnums() {
61
    $ref_enums = array();
62
    $ref_enums['CustomEventType'] = CustomConversionCustomEventTypeValues::getInstance()->getValues();
63
    return $ref_enums;
64
  }
65
66
67
  public function getActivities(array $fields = array(), array $params = array(), $pending = false) {
68
    $this->assureId();
69
70
    $param_types = array(
71
      'end_time' => 'datetime',
72
      'event_type' => 'event_type_enum',
73
      'start_time' => 'datetime',
74
    );
75
    $enums = array(
76
      'event_type_enum' => array(
77
        'conversion_create',
78
        'conversion_delete',
79
        'conversion_update',
80
      ),
81
    );
82
83
    $request = new ApiRequest(
84
      $this->api,
85
      $this->data['id'],
86
      RequestInterface::METHOD_GET,
87
      '/activities',
88
      new AbstractCrudObject(),
89
      'EDGE',
90
      array(),
91
      new TypeChecker($param_types, $enums)
92
    );
93
    $request->addParams($params);
94
    $request->addFields($fields);
95
    return $pending ? $request : $request->execute();
96
  }
97
98
  public function deleteSharedAgencies(array $fields = array(), array $params = array(), $pending = false) {
99
    $this->assureId();
100
101
    $param_types = array(
102
      'business' => 'string',
103
    );
104
    $enums = array(
105
    );
106
107
    $request = new ApiRequest(
108
      $this->api,
109
      $this->data['id'],
110
      RequestInterface::METHOD_DELETE,
111
      '/shared_agencies',
112
      new AbstractCrudObject(),
113
      'EDGE',
114
      array(),
115
      new TypeChecker($param_types, $enums)
116
    );
117
    $request->addParams($params);
118
    $request->addFields($fields);
119
    return $pending ? $request : $request->execute();
120
  }
121
122
  public function createSharedAgency(array $fields = array(), array $params = array(), $pending = false) {
123
    $this->assureId();
124
125
    $param_types = array(
126
      'business' => 'string',
127
    );
128
    $enums = array(
129
    );
130
131
    $request = new ApiRequest(
132
      $this->api,
133
      $this->data['id'],
134
      RequestInterface::METHOD_POST,
135
      '/shared_agencies',
136
      new CustomConversion(),
137
      'EDGE',
138
      CustomConversion::getFieldsEnum()->getValues(),
139
      new TypeChecker($param_types, $enums)
140
    );
141
    $request->addParams($params);
142
    $request->addFields($fields);
143
    return $pending ? $request : $request->execute();
144
  }
145
146
  public function getStats(array $fields = array(), array $params = array(), $pending = false) {
147
    $this->assureId();
148
149
    $param_types = array(
150
      'aggregation' => 'aggregation_enum',
151
      'end_time' => 'datetime',
152
      'start_time' => 'datetime',
153
    );
154
    $enums = array(
155
      'aggregation_enum' => CustomConversionStatsResultAggregationValues::getInstance()->getValues(),
156
    );
157
158
    $request = new ApiRequest(
159
      $this->api,
160
      $this->data['id'],
161
      RequestInterface::METHOD_GET,
162
      '/stats',
163
      new CustomConversionStatsResult(),
164
      'EDGE',
165
      CustomConversionStatsResult::getFieldsEnum()->getValues(),
166
      new TypeChecker($param_types, $enums)
167
    );
168
    $request->addParams($params);
169
    $request->addFields($fields);
170
    return $pending ? $request : $request->execute();
171
  }
172
173
  public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
174
    $this->assureId();
175
176
    $param_types = array(
177
    );
178
    $enums = array(
179
    );
180
181
    $request = new ApiRequest(
182
      $this->api,
183
      $this->data['id'],
184
      RequestInterface::METHOD_DELETE,
185
      '/',
186
      new AbstractCrudObject(),
187
      'NODE',
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 getSelf(array $fields = array(), array $params = array(), $pending = false) {
197
    $this->assureId();
198
199
    $param_types = array(
200
    );
201
    $enums = array(
202
    );
203
204
    $request = new ApiRequest(
205
      $this->api,
206
      $this->data['id'],
207
      RequestInterface::METHOD_GET,
208
      '/',
209
      new CustomConversion(),
210
      'NODE',
211
      CustomConversion::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 updateSelf(array $fields = array(), array $params = array(), $pending = false) {
220
    $this->assureId();
221
222
    $param_types = array(
223
      'default_conversion_value' => 'float',
224
      'description' => 'string',
225
      'name' => 'string',
226
    );
227
    $enums = array(
228
    );
229
230
    $request = new ApiRequest(
231
      $this->api,
232
      $this->data['id'],
233
      RequestInterface::METHOD_POST,
234
      '/',
235
      new CustomConversion(),
236
      'NODE',
237
      CustomConversion::getFieldsEnum()->getValues(),
238
      new TypeChecker($param_types, $enums)
239
    );
240
    $request->addParams($params);
241
    $request->addFields($fields);
242
    return $pending ? $request : $request->execute();
243
  }
244
245
}
246