| 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\CustomAudienceFields; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | use FacebookAds\Object\Values\CustomAudienceClaimObjectiveValues; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | use FacebookAds\Object\Values\CustomAudienceContentTypeValues; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | use FacebookAds\Object\Values\CustomAudienceFieldsValues; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | use FacebookAds\Object\Values\CustomAudienceSubtypeValues; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | use FacebookAds\Object\Values\CustomAudienceTypes; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | use FacebookAds\Object\CustomAudienceNormalizers\EmailNormalizer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | use FacebookAds\Object\CustomAudienceNormalizers\HashNormalizer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  * This class is auto-genereated. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  * For any issues or feature requests related to this class, please let us know | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  * on github and we'll fix in our codegen framework. We'll not be able to accept | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  * pull request for this class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | class CustomAudience extends AbstractCrudObject { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |   /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |    * @deprecated getEndpoint function is deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |    */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |   protected function getEndpoint() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     return 'customaudiences'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |   /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |    * @return CustomAudienceFields | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |    */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |   public static function getFieldsEnum() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     return CustomAudienceFields::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |   } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |   protected static function getReferencedEnums() { | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |     $ref_enums = array(); | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |     $ref_enums['ClaimObjective'] = CustomAudienceClaimObjectiveValues::getInstance()->getValues(); | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |     $ref_enums['ContentType'] = CustomAudienceContentTypeValues::getInstance()->getValues(); | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |     $ref_enums['Subtype'] = CustomAudienceSubtypeValues::getInstance()->getValues(); | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |     $ref_enums['Fields'] = CustomAudienceFieldsValues::getInstance()->getValues(); | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |     return $ref_enums; | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |   public function deleteAdAccounts(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |       'adaccounts' => 'list<string>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |       RequestInterface::METHOD_DELETE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |       '/adaccounts', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |       new AbstractCrudObject(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |       array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |   public function getAdAccounts(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |       'permissions' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |       RequestInterface::METHOD_GET, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |       '/adaccounts', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |       new AdAccount(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |       AdAccount::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |   public function createAdAccount(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |       'adaccounts' => 'list<string>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |       'permissions' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |       'replace' => 'bool', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |       RequestInterface::METHOD_POST, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |       '/adaccounts', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |       new AdAccount(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |       AdAccount::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |   public function getAds(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |       'effective_status' => 'list<string>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |       'status' => 'list<string>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |       RequestInterface::METHOD_GET, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |       '/ads', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |       new Ad(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |       Ad::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |   public function getPrefills(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |       RequestInterface::METHOD_GET, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |       '/prefills', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |       new CustomAudiencePrefillState(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |       CustomAudiencePrefillState::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |   public function getSessions(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |       'session_id' => 'unsigned int', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |       RequestInterface::METHOD_GET, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |       '/sessions', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |       new CustomAudienceSession(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |       CustomAudienceSession::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |   public function deleteUsers(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |       'namespace' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |       'payload' => 'Object', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |       'session' => 'Object', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |       RequestInterface::METHOD_DELETE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |       '/users', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |       new AbstractCrudObject(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |       array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |   public function createUser(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |       'namespace' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |       'payload' => 'Object', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |       'session' => 'Object', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |       RequestInterface::METHOD_POST, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |       '/users', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |       new User(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |       'EDGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |       User::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |   public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |       RequestInterface::METHOD_DELETE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |       '/', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |       new AbstractCrudObject(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |       'NODE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |       array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |   public function getSelf(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |       RequestInterface::METHOD_GET, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |       '/', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |       new CustomAudience(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |       'NODE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |       CustomAudience::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |   public function updateSelf(array $fields = array(), array $params = array(), $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |     $this->assureId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |     $param_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |       'claim_objective' => 'claim_objective_enum', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |       'content_type' => 'content_type_enum', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |       'description' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |       'event_source_group' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |       'lookalike_spec' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |       'name' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |       'opt_out_link' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |       'product_set_id' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |       'retention_days' => 'unsigned int', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |       'rule' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |       'rule_aggregation' => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     $enums = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |       'claim_objective_enum' => CustomAudienceClaimObjectiveValues::getInstance()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |       'content_type_enum' => CustomAudienceContentTypeValues::getInstance()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |     $request = new ApiRequest( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |       $this->api, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |       $this->data['id'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |       RequestInterface::METHOD_POST, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |       '/', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |       new CustomAudience(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |       'NODE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |       CustomAudience::getFieldsEnum()->getValues(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |       new TypeChecker($param_types, $enums) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |     $request->addParams($params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |     $request->addFields($fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |     return $pending ? $request : $request->execute(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |   public function addUsers( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |     array $users, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |     $type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |     array $app_ids = array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |     $is_hashed = false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |     $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |     $params = $this->formatParams($users, $type, $app_ids, $is_hashed); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |     return $this->createUser(array(), $params, $pending); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |   public function removeUsers( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |     array $users, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |     $type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |     array $app_ids = array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |     $is_hashed = false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |     $pending = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |     $params = $this->formatParams($users, $type, $app_ids, $is_hashed); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |     return $this->deleteUsers(array(), $params, $pending); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |   } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |   /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |    * Take users and format them correctly for the request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |    * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |    * @param array $users | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |    * @param string $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |    * @param array $app_ids | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |    * @param bool $is_hashed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |    * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |    */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |   protected function formatParams( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |     array $users, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |     $type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |     array $app_ids = array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |     $is_hashed = false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |     if ($type == CustomAudienceTypes::EMAIL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |       || $type == CustomAudienceTypes::PHONE) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |       $normalizer = new EmailNormalizer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |       $hash_normalizer = new HashNormalizer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |       foreach ($users as &$user) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |         if ($type == CustomAudienceTypes::EMAIL) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |           $user = $normalizer->normalize(CustomAudienceTypes::EMAIL, $user); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |         if (!$is_hashed) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |           $user = $hash_normalizer->normalize( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |             CustomAudienceTypes::EMAIL, $user); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |       } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |     $payload = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |       'schema' => $type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |       'data' => $users, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |     if ($type === CustomAudienceTypes::ID) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |       if (empty($app_ids)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |         throw new \InvalidArgumentException( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |           "Custom audiences with type ".CustomAudienceTypes::ID." require" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |           ."at least one app_id"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |       } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |       $payload['app_ids'] = $app_ids; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |     return array('payload' => $payload); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |   } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 425 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 426 |  |  |  |