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

CustomConversion   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 121
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 11
c 2
b 0
f 1
lcom 1
cbo 8
dl 0
loc 121
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getEndpoint() 0 3 1
A getFieldsEnum() 0 3 1
A getReferencedEnums() 0 5 1
B getStats() 0 26 2
A deleteSelf() 0 23 2
A getSelf() 0 22 2
B updateSelf() 0 25 2
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\AdsPixelStatsResultAggregationValues;
33
use FacebookAds\Object\Values\CustomConversionCustomEventTypeValues;
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
  protected function getEndpoint() {
47
    return 'customconversions';
48
  }
49
50
  /**
51
   * @return CustomConversionFields
52
   */
53
  public static function getFieldsEnum() {
54
    return CustomConversionFields::getInstance();
55
  }
56
57
  protected static function getReferencedEnums() {
58
    $ref_enums = array();
59
    $ref_enums['CustomEventType'] = CustomConversionCustomEventTypeValues::getInstance()->getValues();
60
    return $ref_enums;
61
  }
62
63
64
  public function getStats(array $fields = array(), array $params = array(), $pending = false) {
65
    $this->assureId();
66
67
    $param_types = array(
68
      'aggregation' => 'aggregation_enum',
69
      'end_time' => 'datetime',
70
      'start_time' => 'datetime',
71
    );
72
    $enums = array(
73
      'aggregation_enum' => AdsPixelStatsResultAggregationValues::getInstance()->getValues(),
74
    );
75
76
    $request = new ApiRequest(
77
      $this->api,
78
      $this->data['id'],
79
      RequestInterface::METHOD_GET,
80
      '/stats',
81
      new AdsPixelStatsResult(),
82
      'EDGE',
83
      AdsPixelStatsResult::getFieldsEnum()->getValues(),
84
      new TypeChecker($param_types, $enums)
85
    );
86
    $request->addParams($params);
87
    $request->addFields($fields);
88
    return $pending ? $request : $request->execute();
89
  }
90
91
  public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
92
    $this->assureId();
93
94
    $param_types = array(
95
      'id' => 'string',
96
    );
97
    $enums = array(
98
    );
99
100
    $request = new ApiRequest(
101
      $this->api,
102
      $this->data['id'],
103
      RequestInterface::METHOD_DELETE,
104
      '/',
105
      new AbstractCrudObject(),
106
      'NODE',
107
      array(),
108
      new TypeChecker($param_types, $enums)
109
    );
110
    $request->addParams($params);
111
    $request->addFields($fields);
112
    return $pending ? $request : $request->execute();
113
  }
114
115
  public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
116
    $this->assureId();
117
118
    $param_types = array(
119
    );
120
    $enums = array(
121
    );
122
123
    $request = new ApiRequest(
124
      $this->api,
125
      $this->data['id'],
126
      RequestInterface::METHOD_GET,
127
      '/',
128
      new CustomConversion(),
129
      'NODE',
130
      CustomConversion::getFieldsEnum()->getValues(),
131
      new TypeChecker($param_types, $enums)
132
    );
133
    $request->addParams($params);
134
    $request->addFields($fields);
135
    return $pending ? $request : $request->execute();
136
  }
137
138
  public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
139
    $this->assureId();
140
141
    $param_types = array(
142
      'default_conversion_value' => 'float',
143
      'description' => 'string',
144
      'name' => 'string',
145
    );
146
    $enums = array(
147
    );
148
149
    $request = new ApiRequest(
150
      $this->api,
151
      $this->data['id'],
152
      RequestInterface::METHOD_POST,
153
      '/',
154
      new AbstractCrudObject(),
155
      'NODE',
156
      array(),
157
      new TypeChecker($param_types, $enums)
158
    );
159
    $request->addParams($params);
160
    $request->addFields($fields);
161
    return $pending ? $request : $request->execute();
162
  }
163
164
}
165