update
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,15 +21,15 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds;
|
||||
|
||||
class AnonymousSession implements \PYS_PRO_GLOBAL\FacebookAds\SessionInterface
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getRequestParameters()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
class AnonymousSession implements SessionInterface {
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getRequestParameters() {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Client;
|
||||
@@ -30,193 +30,218 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Logger\LoggerInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Logger\NullLogger;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\CrashReporter;
|
||||
class Api
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = \PYS_PRO_GLOBAL\FacebookAds\ApiConfig::APIVersion;
|
||||
/**
|
||||
* @var Api
|
||||
*/
|
||||
protected static $instance;
|
||||
/**
|
||||
* @var SessionInterface
|
||||
*/
|
||||
private $session;
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $httpClient;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $defaultGraphVersion;
|
||||
/**
|
||||
* @param Client $http_client
|
||||
* @param SessionInterface $session A Facebook API session
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\Client $http_client, \PYS_PRO_GLOBAL\FacebookAds\SessionInterface $session)
|
||||
{
|
||||
$this->httpClient = $http_client;
|
||||
$this->session = $session;
|
||||
|
||||
class Api {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = ApiConfig::APIVersion;
|
||||
|
||||
/**
|
||||
* @var Api
|
||||
*/
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* @var SessionInterface
|
||||
*/
|
||||
private $session;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $httpClient;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $defaultGraphVersion;
|
||||
|
||||
/**
|
||||
* @param Client $http_client
|
||||
* @param SessionInterface $session A Facebook API session
|
||||
*/
|
||||
public function __construct(
|
||||
Client $http_client,
|
||||
SessionInterface $session) {
|
||||
$this->httpClient = $http_client;
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $app_id
|
||||
* @param string $app_secret
|
||||
* @param string $access_token
|
||||
* @return static
|
||||
*/
|
||||
public static function init($app_id, $app_secret, $access_token, $log_crash=true) {
|
||||
$session = new Session($app_id, $app_secret, $access_token);
|
||||
$api = new static(new Client(), $session);
|
||||
static::setInstance($api);
|
||||
if ($log_crash) {
|
||||
CrashReporter::enable();
|
||||
}
|
||||
/**
|
||||
* @param string $app_id
|
||||
* @param string $app_secret
|
||||
* @param string $access_token
|
||||
* @return static
|
||||
*/
|
||||
public static function init($app_id, $app_secret, $access_token, $log_crash = \true)
|
||||
{
|
||||
$session = new \PYS_PRO_GLOBAL\FacebookAds\Session($app_id, $app_secret, $access_token);
|
||||
$api = new static(new \PYS_PRO_GLOBAL\FacebookAds\Http\Client(), $session);
|
||||
static::setInstance($api);
|
||||
if ($log_crash) {
|
||||
\PYS_PRO_GLOBAL\FacebookAds\CrashReporter::enable();
|
||||
}
|
||||
return $api;
|
||||
return $api;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Api|null
|
||||
*/
|
||||
public static function instance() {
|
||||
return static::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Api $instance
|
||||
*/
|
||||
public static function setInstance(Api $instance) {
|
||||
static::$instance = $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SessionInterface $session
|
||||
* @return Api
|
||||
*/
|
||||
public function getCopyWithSession(SessionInterface $session) {
|
||||
$api = new self($this->getHttpClient(), $session);
|
||||
$api->setDefaultGraphVersion($this->getDefaultGraphVersion());
|
||||
$api->setLogger($this->getLogger());
|
||||
return $api;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function base64UrlEncode($string) {
|
||||
$str = strtr(base64_encode($string), '+/', '-_');
|
||||
$str = str_replace('=', '', $str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string $method
|
||||
* @param array $params
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function prepareRequest(
|
||||
$path,
|
||||
$method = RequestInterface::METHOD_GET,
|
||||
array $params = array()) {
|
||||
|
||||
$request = $this->getHttpClient()->createRequest();
|
||||
$request->setMethod($method);
|
||||
$request->setGraphVersion($this->getDefaultGraphVersion());
|
||||
$request->setPath($path);
|
||||
|
||||
if ($method === RequestInterface::METHOD_GET) {
|
||||
$params_ref = $request->getQueryParams();
|
||||
} else {
|
||||
$params_ref = $request->getBodyParams();
|
||||
}
|
||||
/**
|
||||
* @return Api|null
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return static::$instance;
|
||||
|
||||
if (!empty($params)) {
|
||||
$params_ref->enhance($params);
|
||||
}
|
||||
/**
|
||||
* @param Api $instance
|
||||
*/
|
||||
public static function setInstance(\PYS_PRO_GLOBAL\FacebookAds\Api $instance)
|
||||
{
|
||||
static::$instance = $instance;
|
||||
|
||||
$params_ref->enhance($this->getSession()->getRequestParameters());
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function executeRequest(RequestInterface $request) {
|
||||
$this->getLogger()->logRequest('debug', $request);
|
||||
$response = $request->execute();
|
||||
$this->getLogger()->logResponse('debug', $response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultGraphVersion() {
|
||||
if ($this->defaultGraphVersion === null) {
|
||||
$match = array();
|
||||
if (preg_match("/^\d+\.\d+/", static::VERSION, $match)) {
|
||||
$this->defaultGraphVersion = $match[0];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param SessionInterface $session
|
||||
* @return Api
|
||||
*/
|
||||
public function getCopyWithSession(\PYS_PRO_GLOBAL\FacebookAds\SessionInterface $session)
|
||||
{
|
||||
$api = new self($this->getHttpClient(), $session);
|
||||
$api->setDefaultGraphVersion($this->getDefaultGraphVersion());
|
||||
$api->setLogger($this->getLogger());
|
||||
return $api;
|
||||
|
||||
return $this->defaultGraphVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
*/
|
||||
public function setDefaultGraphVersion($version) {
|
||||
$this->defaultGraphVersion = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make graph api calls
|
||||
*
|
||||
* @param string $path Ads API endpoint
|
||||
* @param string $method Ads API request type
|
||||
* @param array $params Assoc of request parameters
|
||||
* @return ResponseInterface Graph API responses
|
||||
*/
|
||||
public function call(
|
||||
$path,
|
||||
$method = RequestInterface::METHOD_GET,
|
||||
array $params = array(),
|
||||
array $file_params = array()) {
|
||||
|
||||
$request = $this->prepareRequest($path, $method, $params);
|
||||
|
||||
if (!empty($file_params)) {
|
||||
foreach($file_params as $key => $value) {
|
||||
$request->getFileParams()->offsetSet($key, $value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function base64UrlEncode($string)
|
||||
{
|
||||
$str = \strtr(\base64_encode($string), '+/', '-_');
|
||||
$str = \str_replace('=', '', $str);
|
||||
return $str;
|
||||
}
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string $method
|
||||
* @param array $params
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function prepareRequest($path, $method = \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, array $params = array())
|
||||
{
|
||||
$request = $this->getHttpClient()->createRequest();
|
||||
$request->setMethod($method);
|
||||
$request->setGraphVersion($this->getDefaultGraphVersion());
|
||||
$request->setPath($path);
|
||||
if ($method === \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET) {
|
||||
$params_ref = $request->getQueryParams();
|
||||
} else {
|
||||
$params_ref = $request->getBodyParams();
|
||||
}
|
||||
if (!empty($params)) {
|
||||
$params_ref->enhance($params);
|
||||
}
|
||||
$params_ref->enhance($this->getSession()->getRequestParameters());
|
||||
return $request;
|
||||
}
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function executeRequest(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request)
|
||||
{
|
||||
$this->getLogger()->logRequest('debug', $request);
|
||||
$response = $request->execute();
|
||||
$this->getLogger()->logResponse('debug', $response);
|
||||
return $response;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultGraphVersion()
|
||||
{
|
||||
if ($this->defaultGraphVersion === null) {
|
||||
$match = array();
|
||||
if (\preg_match("/^\\d+\\.\\d+/", static::VERSION, $match)) {
|
||||
$this->defaultGraphVersion = $match[0];
|
||||
}
|
||||
}
|
||||
return $this->defaultGraphVersion;
|
||||
}
|
||||
/**
|
||||
* @param string $version
|
||||
*/
|
||||
public function setDefaultGraphVersion($version)
|
||||
{
|
||||
$this->defaultGraphVersion = $version;
|
||||
}
|
||||
/**
|
||||
* Make graph api calls
|
||||
*
|
||||
* @param string $path Ads API endpoint
|
||||
* @param string $method Ads API request type
|
||||
* @param array $params Assoc of request parameters
|
||||
* @return ResponseInterface Graph API responses
|
||||
*/
|
||||
public function call($path, $method = \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, array $params = array(), array $file_params = array())
|
||||
{
|
||||
$request = $this->prepareRequest($path, $method, $params);
|
||||
if (!empty($file_params)) {
|
||||
foreach ($file_params as $key => $value) {
|
||||
$request->getFileParams()->offsetSet($key, $value);
|
||||
}
|
||||
}
|
||||
return $this->executeRequest($request);
|
||||
}
|
||||
/**
|
||||
* @return SessionInterface
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
return $this->session;
|
||||
}
|
||||
/**
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function setLogger(\PYS_PRO_GLOBAL\FacebookAds\Logger\LoggerInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
/**
|
||||
* @return LoggerInterface
|
||||
*/
|
||||
public function getLogger()
|
||||
{
|
||||
if ($this->logger === null) {
|
||||
$this->logger = new \PYS_PRO_GLOBAL\FacebookAds\Logger\NullLogger();
|
||||
}
|
||||
return $this->logger;
|
||||
}
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getHttpClient()
|
||||
{
|
||||
return $this->httpClient;
|
||||
|
||||
return $this->executeRequest($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SessionInterface
|
||||
*/
|
||||
public function getSession() {
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger) {
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LoggerInterface
|
||||
*/
|
||||
public function getLogger() {
|
||||
if ($this->logger === null) {
|
||||
$this->logger = new NullLogger();
|
||||
}
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getHttpClient() {
|
||||
return $this->httpClient;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -23,10 +22,8 @@
|
||||
*
|
||||
*/
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds;
|
||||
|
||||
class ApiConfig
|
||||
{
|
||||
const APIVersion = '14.0';
|
||||
const SDKVersion = '14.0.0';
|
||||
const TYPE_CHECKER_STRICT_MODE = \false;
|
||||
class ApiConfig {
|
||||
const APIVersion = '16.0';
|
||||
const SDKVersion = '16.0.2';
|
||||
const TYPE_CHECKER_STRICT_MODE = false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,186 +21,199 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\AbstractObject;
|
||||
class ApiRequest
|
||||
{
|
||||
protected $api;
|
||||
protected $id;
|
||||
protected $method;
|
||||
protected $endpoint;
|
||||
protected $return_prototype;
|
||||
protected $accepted_fields;
|
||||
protected $param_checker;
|
||||
protected $api_type;
|
||||
protected $use_graph_video_endpoint;
|
||||
private $fields;
|
||||
private $params;
|
||||
private $file_params;
|
||||
private $allow_file_upload;
|
||||
private $file_counter;
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Api $api, $id, $method, $endpoint, $return_prototype = null, $api_type = null, $accepted_fields = array(), \PYS_PRO_GLOBAL\FacebookAds\TypeChecker $param_checker = null, $allow_file_upload = \false, $use_graph_video_endpoint = \false)
|
||||
{
|
||||
$this->fields = [];
|
||||
$this->params = [];
|
||||
$this->file_params = [];
|
||||
$this->file_counter = 0;
|
||||
$this->api = $api;
|
||||
$this->id = $id;
|
||||
$this->method = $method;
|
||||
$this->endpoint = $endpoint;
|
||||
$this->return_prototype = $return_prototype;
|
||||
$this->api_type = $api_type;
|
||||
$this->accepted_fields = $accepted_fields;
|
||||
$this->param_checker = $param_checker;
|
||||
$this->allow_file_upload = $allow_file_upload;
|
||||
$this->use_graph_video_endpoint = $use_graph_video_endpoint;
|
||||
}
|
||||
public function addParam($param, $value)
|
||||
{
|
||||
$extracted_value = $this->extractValue($value);
|
||||
if (!\PYS_PRO_GLOBAL\FacebookAds\ApiConfig::TYPE_CHECKER_STRICT_MODE || !$this->param_checker->isValidParam($param)) {
|
||||
if ($this->param_checker->isFileParam($param)) {
|
||||
$this->file_params[$param] = $extracted_value;
|
||||
} else {
|
||||
$this->params[$param] = $extracted_value;
|
||||
}
|
||||
|
||||
class ApiRequest {
|
||||
protected $api;
|
||||
protected $id;
|
||||
protected $method;
|
||||
protected $endpoint;
|
||||
protected $return_prototype;
|
||||
protected $accepted_fields;
|
||||
protected $param_checker;
|
||||
protected $api_type;
|
||||
protected $use_graph_video_endpoint;
|
||||
private $fields;
|
||||
private $params;
|
||||
private $file_params;
|
||||
private $allow_file_upload;
|
||||
private $file_counter;
|
||||
|
||||
public function __construct(
|
||||
Api $api,
|
||||
$id,
|
||||
$method,
|
||||
$endpoint,
|
||||
$return_prototype = null,
|
||||
$api_type = null,
|
||||
$accepted_fields = array(),
|
||||
TypeChecker $param_checker = null,
|
||||
$allow_file_upload = false,
|
||||
$use_graph_video_endpoint = false) {
|
||||
$this->fields = [];
|
||||
$this->params = [];
|
||||
$this->file_params = [];
|
||||
$this->file_counter = 0;
|
||||
$this->api = $api;
|
||||
$this->id = $id;
|
||||
$this->method = $method;
|
||||
$this->endpoint = $endpoint;
|
||||
$this->return_prototype = $return_prototype;
|
||||
$this->api_type = $api_type;
|
||||
$this->accepted_fields = $accepted_fields;
|
||||
$this->param_checker = $param_checker;
|
||||
$this->allow_file_upload = $allow_file_upload;
|
||||
$this->use_graph_video_endpoint = $use_graph_video_endpoint;
|
||||
}
|
||||
|
||||
public function addParam($param, $value) {
|
||||
$extracted_value = $this->extractValue($value);
|
||||
if (!ApiConfig::TYPE_CHECKER_STRICT_MODE
|
||||
|| !$this->param_checker->isValidParam($param)
|
||||
) {
|
||||
if ($this->param_checker->isFileParam($param)) {
|
||||
$this->file_params[$param] = $extracted_value;
|
||||
} else {
|
||||
$this->params[$param] = $extracted_value;
|
||||
}
|
||||
} else {
|
||||
if ($this->param_checker->isValidParamPair($param, $value)) {
|
||||
if ($this->param_checker->isFileParam($param)) {
|
||||
$this->file_params[$param] = $extracted_value;
|
||||
} else {
|
||||
if ($this->param_checker->isValidParamPair($param, $value)) {
|
||||
if ($this->param_checker->isFileParam($param)) {
|
||||
$this->file_params[$param] = $extracted_value;
|
||||
} else {
|
||||
$this->params[$param] = $extracted_value;
|
||||
}
|
||||
} elseif ($this->param_checker->isPrimitiveType($param)) {
|
||||
$param_type = $this->param_checker->getType($param);
|
||||
$this->params[$param] = $this->param_checker->convertStringToPrimType($param_type, $value);
|
||||
} else {
|
||||
throw new \LogicException('The value for ' . $param . ' is not compatible');
|
||||
}
|
||||
$this->params[$param] = $extracted_value;
|
||||
}
|
||||
return $this;
|
||||
} elseif ($this->param_checker->isPrimitiveType($param)) {
|
||||
$param_type = $this->param_checker->getType($param);
|
||||
$this->params[$param] = $this->param_checker->convertStringToPrimType(
|
||||
$param_type, $value);
|
||||
} else {
|
||||
throw new \LogicException('The value for '.$param.' is not compatible');
|
||||
}
|
||||
}
|
||||
public function addParams($params)
|
||||
{
|
||||
foreach ($params as $key => $value) {
|
||||
$this->addParam($key, $value);
|
||||
}
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addParams($params) {
|
||||
foreach ($params as $key => $value) {
|
||||
$this->addParam($key, $value);
|
||||
}
|
||||
public function removeParam($param)
|
||||
{
|
||||
if (\array_key_exists($param, $this->params)) {
|
||||
unset($this->params[$param]);
|
||||
} elseif (\array_key_exists($param, $this->params)) {
|
||||
unset($this->file_params[$param]);
|
||||
}
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeParam($param) {
|
||||
if (array_key_exists($param, $this->params)) {
|
||||
unset($this->params[$param]);
|
||||
} elseif (array_key_exists($param, $this->params)) {
|
||||
unset($this->file_params[$param]);
|
||||
}
|
||||
public function clearParams()
|
||||
{
|
||||
$this->params = [];
|
||||
$this->file_params = [];
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearParams() {
|
||||
$this->params = [];
|
||||
$this->file_params = [];
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getParams() {
|
||||
$all_params = array_merge($this->params, $this->file_params);
|
||||
return $all_params;
|
||||
}
|
||||
|
||||
public function addField($field) {
|
||||
if (ApiConfig::TYPE_CHECKER_STRICT_MODE
|
||||
&& !in_array($field, $this->accepted_fields)
|
||||
) {
|
||||
throw new \LogicException('Field '.$field.' is not supported');
|
||||
}
|
||||
public function getParams()
|
||||
{
|
||||
$all_params = \array_merge($this->params, $this->file_params);
|
||||
return $all_params;
|
||||
if (!(in_array($field, $this->fields))) {
|
||||
$this->fields[] = $field;
|
||||
}
|
||||
public function addField($field)
|
||||
{
|
||||
if (\PYS_PRO_GLOBAL\FacebookAds\ApiConfig::TYPE_CHECKER_STRICT_MODE && !\in_array($field, $this->accepted_fields)) {
|
||||
throw new \LogicException('Field ' . $field . ' is not supported');
|
||||
}
|
||||
if (!\in_array($field, $this->fields)) {
|
||||
$this->fields[] = $field;
|
||||
}
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addFields($fields) {
|
||||
foreach ($fields as $field) {
|
||||
$this->addField($field);
|
||||
}
|
||||
public function addFields($fields)
|
||||
{
|
||||
foreach ($fields as $field) {
|
||||
$this->addField($field);
|
||||
}
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeField($field) {
|
||||
if (in_array($field, $this->fields)) {
|
||||
$index_to_remove = array_search($field, $this->fields);
|
||||
unset($this->fields[$index_to_remove]);
|
||||
}
|
||||
public function removeField($field)
|
||||
{
|
||||
if (\in_array($field, $this->fields)) {
|
||||
$index_to_remove = \array_search($field, $this->fields);
|
||||
unset($this->fields[$index_to_remove]);
|
||||
}
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearFields() {
|
||||
$this->fields = [];
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFields() {
|
||||
return $this->fields;
|
||||
}
|
||||
|
||||
public function addFile($filename) {
|
||||
if (ApiConfig::TYPE_CHECKER_STRICT_MODE && !$this->allow_file_upload) {
|
||||
throw new \LogicException("This api cannot upload files");
|
||||
}
|
||||
public function clearFields()
|
||||
{
|
||||
$this->fields = [];
|
||||
return $this;
|
||||
$file_key = 'source'.$this->file_counter;
|
||||
if (file_exists($filename)) {
|
||||
$this->file_params[$file_key] = $filename;
|
||||
$this->file_counter++;
|
||||
}
|
||||
public function getFields()
|
||||
{
|
||||
return $this->fields;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the request
|
||||
*/
|
||||
public function execute() {
|
||||
$url_path = '/'.$this->id.$this->endpoint;
|
||||
$updated_params = $this->params;
|
||||
if (!empty($this->fields)) {
|
||||
$fields = implode(',', $this->fields);
|
||||
$updated_params['fields'] = $fields;
|
||||
}
|
||||
public function addFile($filename)
|
||||
{
|
||||
if (\PYS_PRO_GLOBAL\FacebookAds\ApiConfig::TYPE_CHECKER_STRICT_MODE && !$this->allow_file_upload) {
|
||||
throw new \LogicException("This api cannot upload files");
|
||||
}
|
||||
$file_key = 'source' . $this->file_counter;
|
||||
if (\file_exists($filename)) {
|
||||
$this->file_params[$file_key] = $filename;
|
||||
$this->file_counter++;
|
||||
}
|
||||
return $this;
|
||||
$response = $this->api->call(
|
||||
$url_path, $this->method, $updated_params, $this->file_params);
|
||||
if ($this->api_type === "EDGE" && $this->method === "GET") {
|
||||
return new Cursor($response, $this->return_prototype, $this->api);
|
||||
} else if ($this->method === "DELETE") {
|
||||
return $response;
|
||||
} else {
|
||||
return $this->createObject($response->getContent());
|
||||
}
|
||||
/**
|
||||
* Execute the request
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$url_path = '/' . $this->id . $this->endpoint;
|
||||
$updated_params = $this->params;
|
||||
if (!empty($this->fields)) {
|
||||
$fields = \implode(',', $this->fields);
|
||||
$updated_params['fields'] = $fields;
|
||||
}
|
||||
$response = $this->api->call($url_path, $this->method, $updated_params, $this->file_params);
|
||||
if ($this->api_type === "EDGE" && $this->method === "GET") {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Cursor($response, $this->return_prototype, $this->api);
|
||||
} else {
|
||||
if ($this->method === "DELETE") {
|
||||
return $response;
|
||||
} else {
|
||||
return $this->createObject($response->getContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function extractValue($value) {
|
||||
if ($this->param_checker->isAbstractObject($value)) {
|
||||
return $value->exportAllData();
|
||||
} else if (is_array($value)) {
|
||||
$extracted_value = [];
|
||||
foreach ($value as $key => $sub_value) {
|
||||
$extracted_value[$key] = $this->extractValue($sub_value);
|
||||
}
|
||||
return $extracted_value;
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
protected function extractValue($value)
|
||||
{
|
||||
if ($this->param_checker->isAbstractObject($value)) {
|
||||
return $value->exportAllData();
|
||||
} else {
|
||||
if (\is_array($value)) {
|
||||
$extracted_value = [];
|
||||
foreach ($value as $key => $sub_value) {
|
||||
$extracted_value[$key] = $this->extractValue($sub_value);
|
||||
}
|
||||
return $extracted_value;
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function createObject(array $object_data)
|
||||
{
|
||||
$object = clone $this->return_prototype;
|
||||
$object->setDataWithoutValidation($object_data);
|
||||
if ($object instanceof \PYS_PRO_GLOBAL\FacebookAds\AbstractCrudObject) {
|
||||
$object->setApi($this->api);
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
protected function createObject(array $object_data) {
|
||||
$object = clone $this->return_prototype;
|
||||
$object->setDataWithoutValidation($object_data);
|
||||
if ($object instanceof AbstractCrudObject) {
|
||||
$object->setApi($this->api);
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,166 +21,196 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Api;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Exception\Exception;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException;
|
||||
|
||||
/**
|
||||
* Class CrashReasons
|
||||
* @package FacebookAds
|
||||
* @package PYS_PRO_GLOBAL\FacebookAds
|
||||
*/
|
||||
class CrashReasons
|
||||
{
|
||||
class CrashReasons {
|
||||
const SDK = 'SDK';
|
||||
const API = 'API';
|
||||
}
|
||||
|
||||
/**
|
||||
* Class CrashReporter
|
||||
* @package FacebookAds
|
||||
* @package PYS_PRO_GLOBAL\FacebookAds
|
||||
*/
|
||||
class CrashReporter
|
||||
{
|
||||
const E_FATAL = \E_ERROR | \E_USER_ERROR | \E_PARSE | \E_CORE_ERROR | \E_COMPILE_ERROR | \E_RECOVERABLE_ERROR;
|
||||
class CrashReporter {
|
||||
const E_FATAL =
|
||||
E_ERROR |
|
||||
E_USER_ERROR |
|
||||
E_PARSE |
|
||||
E_CORE_ERROR |
|
||||
E_COMPILE_ERROR |
|
||||
E_RECOVERABLE_ERROR;
|
||||
|
||||
/**
|
||||
* @var CrashReporter
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
private static $handle;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $app_id;
|
||||
|
||||
/**
|
||||
* CrashReporter constructor.
|
||||
* @param int $app_id
|
||||
* @return void
|
||||
*/
|
||||
private function __construct($app_id)
|
||||
{
|
||||
private function __construct(
|
||||
$app_id
|
||||
) {
|
||||
$this->app_id = $app_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function enable()
|
||||
{
|
||||
public static function enable() {
|
||||
if (!static::$handle) {
|
||||
static::$handle = \fopen('php://stdout', 'w');
|
||||
static::$handle = fopen('php://stdout', 'w');
|
||||
}
|
||||
if (!static::$instance) {
|
||||
$api = \PYS_PRO_GLOBAL\FacebookAds\Api::instance();
|
||||
$api = Api::instance();
|
||||
if ($api == null) {
|
||||
self::log('Could not initialize API' . \PHP_EOL);
|
||||
self::log('Could not initialize API' . PHP_EOL);
|
||||
}
|
||||
static::$instance = new static($api->getSession()->getAppId());
|
||||
static::$instance->registerExceptionHandler();
|
||||
self::log('Enabled' . \PHP_EOL);
|
||||
self::log('Enabled' . PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function disable()
|
||||
{
|
||||
public static function disable() {
|
||||
if (static::$instance) {
|
||||
static::$instance = null;
|
||||
\restore_exception_handler();
|
||||
\restore_error_handler();
|
||||
restore_exception_handler();
|
||||
restore_error_handler();
|
||||
self::log('Disabled');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $handle
|
||||
*/
|
||||
public static function setLogger($handle)
|
||||
{
|
||||
if (\is_resource($handle)) {
|
||||
static::$handle = $handle;
|
||||
public static function setLogger($handle) {
|
||||
if(is_resource($handle)) {
|
||||
static::$handle = $handle;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerExceptionHandler()
|
||||
{
|
||||
$lastHandler = \set_exception_handler(function (\Throwable $e) use(&$lastHandler) {
|
||||
self::log('Exception detected!');
|
||||
$params = $this->buildParamsFromException($e);
|
||||
if ($params != null) {
|
||||
$this->sendReport(array('bizsdk_crash_report' => $params));
|
||||
}
|
||||
// restore the previous exception
|
||||
if (\is_callable($lastHandler)) {
|
||||
return \call_user_func_array($lastHandler, [$e]);
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
});
|
||||
$lastError = \set_error_handler(function ($errno, $errstr, $errfile, $errline) use(&$lastError) {
|
||||
if ($errno & self::E_FATAL && \strpos($errfile, 'FacebookAds') != \false) {
|
||||
self::log('Error detected!');
|
||||
$e = new \ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||
private function registerExceptionHandler() {
|
||||
$lastHandler = set_exception_handler(
|
||||
function (\Throwable $e) use (&$lastHandler) {
|
||||
self::log('Exception detected!');
|
||||
$params = $this->buildParamsFromException($e);
|
||||
if ($params != null) {
|
||||
$this->sendReport(array('bizsdk_crash_report' => $params));
|
||||
$this->sendReport(array(
|
||||
'bizsdk_crash_report' => $params
|
||||
));
|
||||
}
|
||||
// restore the previous exception
|
||||
if (is_callable($lastHandler)) {
|
||||
return call_user_func_array($lastHandler, [$e]);
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
if (\is_callable($lastError)) {
|
||||
return \call_user_func_array($lastError, [$errno, $errstr, $errfile, $errline]);
|
||||
} else {
|
||||
// fall through to the standard PHP error handler
|
||||
return \false;
|
||||
);
|
||||
|
||||
$lastError = set_error_handler(
|
||||
function ($errno, $errstr, $errfile, $errline) use (&$lastError) {
|
||||
if (($errno & self::E_FATAL) && strpos($errfile, 'PYS_PRO_GLOBAL\FacebookAds') != false) {
|
||||
self::log('Error detected!');
|
||||
$e = new \ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||
$params = $this->buildParamsFromException($e);
|
||||
if ($params != null) {
|
||||
$this->sendReport(array(
|
||||
'bizsdk_crash_report' => $params
|
||||
));
|
||||
}
|
||||
}
|
||||
if (is_callable($lastError)) {
|
||||
return call_user_func_array($lastError, [$errno, $errstr, $errfile, $errline]);
|
||||
} else {
|
||||
// fall through to the standard PHP error handler
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Throwable $e
|
||||
* @return array|null
|
||||
*/
|
||||
private function buildParamsFromException(\Throwable $e)
|
||||
{
|
||||
if (!($e instanceof \PYS_PRO_GLOBAL\FacebookAds\Exception\Exception || $e instanceof \ErrorException)) {
|
||||
private function buildParamsFromException(\Throwable $e) {
|
||||
if (!($e instanceof Exception || $e instanceof \ErrorException)) {
|
||||
return NULL;
|
||||
}
|
||||
$reason = \PYS_PRO_GLOBAL\FacebookAds\CrashReasons::SDK;
|
||||
if ($e instanceof \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException) {
|
||||
$reason = \PYS_PRO_GLOBAL\FacebookAds\CrashReasons::API;
|
||||
$reason = CrashReasons::SDK;
|
||||
if ($e instanceof RequestException) {
|
||||
$reason = CrashReasons::API;
|
||||
}
|
||||
$reason .= ' : ' . $e->getMessage();
|
||||
$callstack = \explode(\PHP_EOL, $e->getTraceAsString());
|
||||
return array('reason' => $reason, 'callstack' => $callstack, 'platform' => \phpversion());
|
||||
$callstack = explode(PHP_EOL, $e->getTraceAsString());
|
||||
return array(
|
||||
'reason' => $reason,
|
||||
'callstack' => $callstack,
|
||||
'platform' => phpversion()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
*/
|
||||
private function sendReport($params)
|
||||
{
|
||||
private function sendReport($params) {
|
||||
try {
|
||||
$session = new \PYS_PRO_GLOBAL\FacebookAds\AnonymousSession();
|
||||
$api = new \PYS_PRO_GLOBAL\FacebookAds\Api(\PYS_PRO_GLOBAL\FacebookAds\Api::instance()->getHttpClient(), $session);
|
||||
$request = $api->prepareRequest('/' . $this->app_id . '/instruments', \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, $params);
|
||||
$session = new AnonymousSession();
|
||||
$api = new Api(Api::instance()->getHttpClient(), $session);
|
||||
$request = $api->prepareRequest(
|
||||
'/' . $this->app_id . '/instruments',
|
||||
RequestInterface::METHOD_POST,
|
||||
$params
|
||||
);
|
||||
|
||||
$response = $api->executeRequest($request);
|
||||
$data = $response->getContent();
|
||||
if ($data && $data['success']) {
|
||||
self::log('Successfully sent report' . \PHP_EOL);
|
||||
self::log('Successfully sent report' . PHP_EOL);
|
||||
} else {
|
||||
self::log('Failed to send report' . \PHP_EOL);
|
||||
self::log('Failed to send report' . PHP_EOL);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
self::log('Exception on sending report' . \PHP_EOL);
|
||||
self::log('Exception on sending report' . PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $message
|
||||
*/
|
||||
private static function log($message)
|
||||
{
|
||||
$content = \sprintf("%s : %s%s", static::class, $message, \PHP_EOL);
|
||||
\fwrite(static::$handle, $content);
|
||||
private static function log($message) {
|
||||
$content = sprintf("%s : %s%s",static::class, $message, PHP_EOL);
|
||||
fwrite(static::$handle, $content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,469 +21,504 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Util;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject;
|
||||
class Cursor implements \Iterator, \Countable, \PYS_PRO_GLOBAL\arrayaccess
|
||||
{
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
protected $response;
|
||||
/**
|
||||
* @var Api
|
||||
*/
|
||||
protected $api;
|
||||
/**
|
||||
* @var AbstractObject[]
|
||||
*/
|
||||
protected $objects = array();
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $indexLeft;
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $indexRight;
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $position;
|
||||
/**
|
||||
* @var AbstractObject
|
||||
*/
|
||||
protected $objectPrototype;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $defaultUseImplicitFetch = \false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $useImplicitFetch;
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response, \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject $object_prototype, \PYS_PRO_GLOBAL\FacebookAds\Api $api = null)
|
||||
{
|
||||
$this->response = $response;
|
||||
$this->objectPrototype = $object_prototype;
|
||||
$this->api = $api !== null ? $api : \PYS_PRO_GLOBAL\FacebookAds\Api::instance();
|
||||
$this->appendResponse($response);
|
||||
|
||||
class Cursor implements \Iterator, \Countable, \ArrayAccess {
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* @var Api
|
||||
*/
|
||||
protected $api;
|
||||
|
||||
/**
|
||||
* @var AbstractObject[]
|
||||
*/
|
||||
protected $objects = array();
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $indexLeft;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $indexRight;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $position;
|
||||
|
||||
/**
|
||||
* @var AbstractObject
|
||||
*/
|
||||
protected $objectPrototype;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $defaultUseImplicitFetch = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $useImplicitFetch;
|
||||
|
||||
public function __construct(
|
||||
ResponseInterface $response,
|
||||
AbstractObject $object_prototype,
|
||||
Api $api = null) {
|
||||
$this->response = $response;
|
||||
$this->objectPrototype = $object_prototype;
|
||||
$this->api = $api !== null ? $api : Api::instance();
|
||||
$this->appendResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $object_data
|
||||
* @return AbstractObject
|
||||
*/
|
||||
protected function createObject(array $object_data) {
|
||||
$object = clone $this->objectPrototype;
|
||||
$object->setDataWithoutValidation($object_data);
|
||||
if ($object instanceof AbstractCrudObject) {
|
||||
$object->setApi($this->api);
|
||||
}
|
||||
/**
|
||||
* @param array $object_data
|
||||
* @return AbstractObject
|
||||
*/
|
||||
protected function createObject(array $object_data)
|
||||
{
|
||||
$object = clone $this->objectPrototype;
|
||||
$object->setDataWithoutValidation($object_data);
|
||||
if ($object instanceof \PYS_PRO_GLOBAL\FacebookAds\AbstractCrudObject) {
|
||||
$object->setApi($this->api);
|
||||
}
|
||||
return $object;
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function assureResponseData(ResponseInterface $response) {
|
||||
$content = $response->getContent();
|
||||
|
||||
// First, check if the content contains data
|
||||
if (isset($content['data']) && is_array($content['data'])) {
|
||||
$data = $content['data'];
|
||||
|
||||
// If data is an object wrap the object into an array
|
||||
if ($this->isJsonObject($data)) {
|
||||
$data = array($data);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function assureResponseData(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response)
|
||||
{
|
||||
$content = $response->getContent();
|
||||
// First, check if the content contains data
|
||||
if (isset($content['data']) && \is_array($content['data'])) {
|
||||
$data = $content['data'];
|
||||
// If data is an object wrap the object into an array
|
||||
if ($this->isJsonObject($data)) {
|
||||
$data = array($data);
|
||||
}
|
||||
return $data;
|
||||
|
||||
// Second, check if the content contains special entries
|
||||
if (isset($content['targetingsentencelines'])) {
|
||||
return $content['targetingsentencelines'];
|
||||
}
|
||||
if (isset($content['adaccounts'])) {
|
||||
return $content['adaccounts'];
|
||||
}
|
||||
if (isset($content['users'])) {
|
||||
return $content['users'];
|
||||
}
|
||||
|
||||
// Third, check if the content is an array of objects indexed by id
|
||||
$is_id_indexed_array = true;
|
||||
$objects = array();
|
||||
if (is_array($content) && count($content) >= 1) {
|
||||
foreach ($content as $key => $value) {
|
||||
if ($key === '__fb_trace_id__') {
|
||||
continue;
|
||||
}
|
||||
// Second, check if the content contains special entries
|
||||
if (isset($content['targetingsentencelines'])) {
|
||||
return $content['targetingsentencelines'];
|
||||
}
|
||||
if (isset($content['adaccounts'])) {
|
||||
return $content['adaccounts'];
|
||||
}
|
||||
if (isset($content['users'])) {
|
||||
return $content['users'];
|
||||
}
|
||||
// Third, check if the content is an array of objects indexed by id
|
||||
$is_id_indexed_array = \true;
|
||||
$objects = array();
|
||||
if (\is_array($content) && \count($content) >= 1) {
|
||||
foreach ($content as $key => $value) {
|
||||
if ($key === '__fb_trace_id__') {
|
||||
continue;
|
||||
}
|
||||
if ($value !== null && $this->isJsonObject($value) && isset($value['id']) && $value['id'] !== null && $value['id'] === $key) {
|
||||
$objects[] = $value;
|
||||
} else {
|
||||
$is_id_indexed_array = \false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($value !== null &&
|
||||
$this->isJsonObject($value) &&
|
||||
isset($value['id']) &&
|
||||
$value['id'] !== null &&
|
||||
$value['id'] === $key) {
|
||||
$objects[] = $value;
|
||||
} else {
|
||||
$is_id_indexed_array = \false;
|
||||
$is_id_indexed_array = false;
|
||||
break;
|
||||
}
|
||||
if ($is_id_indexed_array) {
|
||||
return $objects;
|
||||
}
|
||||
throw new \InvalidArgumentException("Malformed response data");
|
||||
}
|
||||
} else {
|
||||
$is_id_indexed_array = false;
|
||||
}
|
||||
private function isJsonObject($object)
|
||||
{
|
||||
if (!\is_array($object)) {
|
||||
return \false;
|
||||
}
|
||||
// Consider an empty array as not object
|
||||
if (empty($object)) {
|
||||
return \false;
|
||||
}
|
||||
// A json object is represented by a map instead of a pure list
|
||||
return \array_keys($object) !== \range(0, \count($object) - 1);
|
||||
if ($is_id_indexed_array) {
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
protected function prependResponse(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
$data = $this->assureResponseData($response);
|
||||
if (empty($data)) {
|
||||
return;
|
||||
}
|
||||
$left_index = $this->indexLeft;
|
||||
$count = \count($data);
|
||||
$position = $count - 1;
|
||||
for ($i = $left_index - 1; $i >= $left_index - $count; $i--) {
|
||||
$this->objects[$i] = $this->createObject($data[$position--]);
|
||||
--$this->indexLeft;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException("Malformed response data");
|
||||
}
|
||||
|
||||
private function isJsonObject($object) {
|
||||
if (!is_array($object)) {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
protected function appendResponse(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
$data = $this->assureResponseData($response);
|
||||
if (empty($data)) {
|
||||
return;
|
||||
}
|
||||
if ($this->indexRight === null) {
|
||||
$this->indexLeft = 0;
|
||||
$this->indexRight = -1;
|
||||
$this->position = 0;
|
||||
}
|
||||
$this->indexRight += \count($data);
|
||||
foreach ($data as $object_data) {
|
||||
$this->objects[] = $this->createObject($object_data);
|
||||
}
|
||||
|
||||
// Consider an empty array as not object
|
||||
if (empty($object)) {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function getDefaultUseImplicitFetch()
|
||||
{
|
||||
return static::$defaultUseImplicitFetch;
|
||||
|
||||
// A json object is represented by a map instead of a pure list
|
||||
return array_keys($object) !== range(0, count($object) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
protected function prependResponse(ResponseInterface $response) {
|
||||
$this->response = $response;
|
||||
$data = $this->assureResponseData($response);
|
||||
if (empty($data)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @param bool $use_implicit_fetch
|
||||
*/
|
||||
public static function setDefaultUseImplicitFetch($use_implicit_fetch)
|
||||
{
|
||||
static::$defaultUseImplicitFetch = $use_implicit_fetch;
|
||||
|
||||
$left_index = $this->indexLeft;
|
||||
$count = count($data);
|
||||
$position = $count - 1;
|
||||
for ($i = $left_index - 1; $i >= $left_index - $count; $i--) {
|
||||
$this->objects[$i] = $this->createObject($data[$position--]);
|
||||
--$this->indexLeft;
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseImplicitFetch()
|
||||
{
|
||||
return $this->useImplicitFetch !== null ? $this->useImplicitFetch : static::$defaultUseImplicitFetch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
protected function appendResponse(ResponseInterface $response) {
|
||||
$this->response = $response;
|
||||
$data = $this->assureResponseData($response);
|
||||
if (empty($data)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @param bool $use_implicit_fetch
|
||||
*/
|
||||
public function setUseImplicitFetch($use_implicit_fetch)
|
||||
{
|
||||
$this->useImplicitFetch = $use_implicit_fetch;
|
||||
|
||||
if ($this->indexRight === null) {
|
||||
$this->indexLeft = 0;
|
||||
$this->indexRight = -1;
|
||||
$this->position = 0;
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBefore()
|
||||
{
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
return isset($content['paging']['cursors']['before']) ? $content['paging']['cursors']['before'] : null;
|
||||
|
||||
$this->indexRight += count($data);
|
||||
|
||||
foreach ($data as $object_data) {
|
||||
$this->objects[] = $this->createObject($object_data);
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getAfter()
|
||||
{
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
return isset($content['paging']['cursors']['after']) ? $content['paging']['cursors']['after'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function getDefaultUseImplicitFetch() {
|
||||
return static::$defaultUseImplicitFetch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $use_implicit_fetch
|
||||
*/
|
||||
public static function setDefaultUseImplicitFetch($use_implicit_fetch) {
|
||||
static::$defaultUseImplicitFetch = $use_implicit_fetch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseImplicitFetch() {
|
||||
return $this->useImplicitFetch !== null
|
||||
? $this->useImplicitFetch
|
||||
: static::$defaultUseImplicitFetch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $use_implicit_fetch
|
||||
*/
|
||||
public function setUseImplicitFetch($use_implicit_fetch) {
|
||||
$this->useImplicitFetch = $use_implicit_fetch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBefore() {
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
return isset($content['paging']['cursors']['before'])
|
||||
? $content['paging']['cursors']['before']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getAfter() {
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
return isset($content['paging']['cursors']['after'])
|
||||
? $content['paging']['cursors']['after']
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
protected function createUndirectionalizedRequest() {
|
||||
$request = $this->getLastResponse()->getRequest()->createClone();
|
||||
$params = $request->getQueryParams();
|
||||
if (isset($params['before'])) {
|
||||
unset($params['before']);
|
||||
}
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
protected function createUndirectionalizedRequest()
|
||||
{
|
||||
$request = $this->getLastResponse()->getRequest()->createClone();
|
||||
$params = $request->getQueryParams();
|
||||
if (isset($params['before'])) {
|
||||
unset($params['before']);
|
||||
}
|
||||
if (isset($params['after'])) {
|
||||
unset($params['after']);
|
||||
}
|
||||
return $request;
|
||||
if (isset($params['after'])) {
|
||||
unset($params['after']);
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPrevious()
|
||||
{
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
if (isset($content['paging']['previous'])) {
|
||||
return $content['paging']['previous'];
|
||||
}
|
||||
$before = $this->getBefore();
|
||||
if ($before !== null) {
|
||||
$request = $this->createUndirectionalizedRequest();
|
||||
$request->getQueryParams()->offsetSet('before', $before);
|
||||
return $request->getUrl();
|
||||
}
|
||||
return null;
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPrevious() {
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
if (isset($content['paging']['previous'])) {
|
||||
return $content['paging']['previous'];
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNext()
|
||||
{
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
if (isset($content['paging']['next'])) {
|
||||
return $content['paging']['next'];
|
||||
}
|
||||
$after = $this->getAfter();
|
||||
if ($after !== null) {
|
||||
$request = $this->createUndirectionalizedRequest();
|
||||
$request->getQueryParams()->offsetSet('after', $after);
|
||||
return $request->getUrl();
|
||||
}
|
||||
return null;
|
||||
|
||||
$before = $this->getBefore();
|
||||
if ($before !== null) {
|
||||
$request = $this->createUndirectionalizedRequest();
|
||||
$request->getQueryParams()->offsetSet('before', $before);
|
||||
return $request->getUrl();
|
||||
}
|
||||
/**
|
||||
* @param string $url
|
||||
* @return RequestInterface
|
||||
*/
|
||||
protected function createRequestFromUrl($url)
|
||||
{
|
||||
$components = \parse_url($url);
|
||||
$request = $this->getLastResponse()->getRequest()->createClone();
|
||||
$request->setDomain($components['host']);
|
||||
$query = isset($components['query']) ? \PYS_PRO_GLOBAL\FacebookAds\Http\Util::parseUrlQuery($components['query']) : array();
|
||||
$request->getQueryParams()->enhance($query);
|
||||
return $request;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNext() {
|
||||
$content = $this->getLastResponse()->getContent();
|
||||
if (isset($content['paging']['next'])) {
|
||||
return $content['paging']['next'];
|
||||
}
|
||||
/**
|
||||
* @return RequestInterface|null
|
||||
*/
|
||||
public function createBeforeRequest()
|
||||
{
|
||||
$url = $this->getPrevious();
|
||||
return $url !== null ? $this->createRequestFromUrl($url) : null;
|
||||
|
||||
$after = $this->getAfter();
|
||||
if ($after !== null) {
|
||||
$request = $this->createUndirectionalizedRequest();
|
||||
$request->getQueryParams()->offsetSet('after', $after);
|
||||
return $request->getUrl();
|
||||
}
|
||||
/**
|
||||
* @return RequestInterface|null
|
||||
*/
|
||||
public function createAfterRequest()
|
||||
{
|
||||
$url = $this->getNext();
|
||||
return $url !== null ? $this->createRequestFromUrl($url) : null;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
* @return RequestInterface
|
||||
*/
|
||||
protected function createRequestFromUrl($url) {
|
||||
$components = parse_url($url);
|
||||
$request = $this->getLastResponse()->getRequest()->createClone();
|
||||
$request->setDomain($components['host']);
|
||||
$query = isset($components['query'])
|
||||
? Util::parseUrlQuery($components['query'])
|
||||
: array();
|
||||
$request->getQueryParams()->enhance($query);
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequestInterface|null
|
||||
*/
|
||||
public function createBeforeRequest() {
|
||||
$url = $this->getPrevious();
|
||||
return $url !== null ? $this->createRequestFromUrl($url) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequestInterface|null
|
||||
*/
|
||||
public function createAfterRequest() {
|
||||
$url = $this->getNext();
|
||||
return $url !== null ? $this->createRequestFromUrl($url) : null;
|
||||
}
|
||||
|
||||
public function fetchBefore() {
|
||||
$request = $this->createBeforeRequest();
|
||||
if (!$request) {
|
||||
return;
|
||||
}
|
||||
public function fetchBefore()
|
||||
{
|
||||
$request = $this->createBeforeRequest();
|
||||
if (!$request) {
|
||||
return;
|
||||
}
|
||||
$this->prependResponse($request->execute());
|
||||
|
||||
$this->prependResponse($request->execute());
|
||||
}
|
||||
|
||||
public function fetchAfter() {
|
||||
$request = $this->createAfterRequest();
|
||||
if (!$request) {
|
||||
return;
|
||||
}
|
||||
public function fetchAfter()
|
||||
{
|
||||
$request = $this->createAfterRequest();
|
||||
if (!$request) {
|
||||
return;
|
||||
}
|
||||
$this->appendResponse($request->execute());
|
||||
|
||||
$this->appendResponse($request->execute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use getArrayCopy()
|
||||
* @return AbstractObject[]
|
||||
*/
|
||||
public function getObjects() {
|
||||
return $this->objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $ksort
|
||||
* @return AbstractObject[]
|
||||
*/
|
||||
public function getArrayCopy($ksort = false) {
|
||||
if ($ksort) {
|
||||
// Sort the main array to improve best case performance in future
|
||||
// invocations
|
||||
ksort($this->objects);
|
||||
}
|
||||
/**
|
||||
* @deprecated Use getArrayCopy()
|
||||
* @return AbstractObject[]
|
||||
*/
|
||||
public function getObjects()
|
||||
{
|
||||
return $this->objects;
|
||||
}
|
||||
/**
|
||||
* @param bool $ksort
|
||||
* @return AbstractObject[]
|
||||
*/
|
||||
public function getArrayCopy($ksort = \false)
|
||||
{
|
||||
if ($ksort) {
|
||||
// Sort the main array to improve best case performance in future
|
||||
// invocations
|
||||
\ksort($this->objects);
|
||||
}
|
||||
return $this->objects;
|
||||
}
|
||||
/**
|
||||
* @deprecated Use getLastResponse()
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getLastResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIndexLeft()
|
||||
{
|
||||
return $this->indexLeft;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIndexRight()
|
||||
{
|
||||
return $this->indexRight;
|
||||
}
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = $this->indexLeft;
|
||||
}
|
||||
public function end()
|
||||
{
|
||||
$this->position = $this->indexRight;
|
||||
}
|
||||
/**
|
||||
* @param int $position
|
||||
*/
|
||||
public function seekTo($position)
|
||||
{
|
||||
$position = \array_key_exists($position, $this->objects) ? $position : null;
|
||||
$this->position = $position;
|
||||
}
|
||||
/**
|
||||
* @return AbstractObject|bool
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return isset($this->objects[$this->position]) ? $this->objects[$this->position] : \false;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
public function prev()
|
||||
{
|
||||
|
||||
return $this->objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use getLastResponse()
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getResponse() {
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getLastResponse() {
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIndexLeft() {
|
||||
return $this->indexLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIndexRight() {
|
||||
return $this->indexRight;
|
||||
}
|
||||
|
||||
public function rewind() : void {
|
||||
$this->position = $this->indexLeft;
|
||||
}
|
||||
|
||||
public function end() {
|
||||
$this->position = $this->indexRight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $position
|
||||
*/
|
||||
public function seekTo($position) {
|
||||
$position = array_key_exists($position, $this->objects) ? $position : null;
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
public function current() : AbstractObject|bool {
|
||||
return isset($this->objects[$this->position])
|
||||
? $this->objects[$this->position]
|
||||
: false;
|
||||
}
|
||||
|
||||
public function key() : ?int {
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function prev() {
|
||||
if ($this->position == $this->getIndexLeft()) {
|
||||
if ($this->getUseImplicitFetch()) {
|
||||
$this->fetchBefore();
|
||||
if ($this->position == $this->getIndexLeft()) {
|
||||
if ($this->getUseImplicitFetch()) {
|
||||
$this->fetchBefore();
|
||||
if ($this->position == $this->getIndexLeft()) {
|
||||
$this->position = null;
|
||||
} else {
|
||||
--$this->position;
|
||||
}
|
||||
} else {
|
||||
$this->position = null;
|
||||
}
|
||||
$this->position = null;
|
||||
} else {
|
||||
--$this->position;
|
||||
--$this->position;
|
||||
}
|
||||
} else {
|
||||
$this->position = null;
|
||||
}
|
||||
} else {
|
||||
--$this->position;
|
||||
}
|
||||
public function next()
|
||||
{
|
||||
}
|
||||
|
||||
public function next() : void {
|
||||
if ($this->position == $this->getIndexRight()) {
|
||||
if ($this->getUseImplicitFetch()) {
|
||||
$this->fetchAfter();
|
||||
if ($this->position == $this->getIndexRight()) {
|
||||
if ($this->getUseImplicitFetch()) {
|
||||
$this->fetchAfter();
|
||||
if ($this->position == $this->getIndexRight()) {
|
||||
$this->position = null;
|
||||
} else {
|
||||
++$this->position;
|
||||
}
|
||||
} else {
|
||||
$this->position = null;
|
||||
}
|
||||
$this->position = null;
|
||||
} else {
|
||||
++$this->position;
|
||||
++$this->position;
|
||||
}
|
||||
} else {
|
||||
$this->position = null;
|
||||
}
|
||||
} else {
|
||||
++$this->position;
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return isset($this->objects[$this->position]);
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return \count($this->objects);
|
||||
}
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if ($offset === null) {
|
||||
$this->objects[] = $value;
|
||||
} else {
|
||||
$this->objects[$offset] = $value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->objects[$offset]);
|
||||
}
|
||||
/**
|
||||
* @param mixed $offset
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->objects[$offset]);
|
||||
}
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return isset($this->objects[$offset]) ? $this->objects[$offset] : null;
|
||||
}
|
||||
|
||||
public function valid() : bool {
|
||||
return isset($this->objects[$this->position]);
|
||||
}
|
||||
|
||||
public function count() : int {
|
||||
return count($this->objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($offset, $value) : void {
|
||||
if ($offset === null) {
|
||||
$this->objects[] = $value;
|
||||
} else {
|
||||
$this->objects[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset) : bool {
|
||||
return isset($this->objects[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
*/
|
||||
public function offsetUnset($offset) : void {
|
||||
unset($this->objects[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset) : mixed {
|
||||
return isset($this->objects[$offset]) ? $this->objects[$offset] : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,144 +21,161 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Enum;
|
||||
|
||||
abstract class AbstractEnum implements \PYS_PRO_GLOBAL\FacebookAds\Enum\EnumInstanceInterface
|
||||
{
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $map = null;
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $names = null;
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $values = null;
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $valuesMap = null;
|
||||
/**
|
||||
* @var AbstractEnum[]
|
||||
*/
|
||||
protected static $instances = array();
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
static function className()
|
||||
{
|
||||
return \get_called_class();
|
||||
abstract class AbstractEnum implements EnumInstanceInterface {
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $map = null;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $names = null;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $values = null;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $valuesMap = null;
|
||||
|
||||
/**
|
||||
* @var AbstractEnum[]
|
||||
*/
|
||||
protected static $instances = array();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
static function className() {
|
||||
return get_called_class();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AbstractEnum
|
||||
*/
|
||||
public static function getInstance() {
|
||||
$fqn = get_called_class();
|
||||
if (!array_key_exists($fqn, static::$instances)) {
|
||||
static::$instances[$fqn] = new static();
|
||||
}
|
||||
/**
|
||||
* @return AbstractEnum
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
$fqn = \get_called_class();
|
||||
if (!\array_key_exists($fqn, static::$instances)) {
|
||||
static::$instances[$fqn] = new static();
|
||||
}
|
||||
return static::$instances[$fqn];
|
||||
|
||||
return static::$instances[$fqn];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy() {
|
||||
if ($this->map === null) {
|
||||
$this->map = (new \ReflectionClass(get_called_class()))
|
||||
->getConstants();
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy()
|
||||
{
|
||||
if ($this->map === null) {
|
||||
$this->map = (new \ReflectionClass(\get_called_class()))->getConstants();
|
||||
}
|
||||
return $this->map;
|
||||
|
||||
return $this->map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNames() {
|
||||
if ($this->names === null) {
|
||||
$this->names = array_keys($this->getArrayCopy());
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNames()
|
||||
{
|
||||
if ($this->names === null) {
|
||||
$this->names = \array_keys($this->getArrayCopy());
|
||||
}
|
||||
return $this->names;
|
||||
|
||||
return $this->names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues() {
|
||||
if ($this->values === null) {
|
||||
$this->values = array_values($this->getArrayCopy());
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
if ($this->values === null) {
|
||||
$this->values = \array_values($this->getArrayCopy());
|
||||
}
|
||||
return $this->values;
|
||||
|
||||
return $this->values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValuesMap() {
|
||||
if ($this->valuesMap === null) {
|
||||
$this->valuesMap = array_fill_keys($this->getValues(), null);
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValuesMap()
|
||||
{
|
||||
if ($this->valuesMap === null) {
|
||||
$this->valuesMap = \array_fill_keys($this->getValues(), null);
|
||||
}
|
||||
return $this->valuesMap;
|
||||
|
||||
return $this->valuesMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValueForName($name) {
|
||||
$copy = $this->getArrayCopy();
|
||||
return array_key_exists($name, $copy)
|
||||
? $copy[$name]
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureValueForName($name) {
|
||||
$value = $this->getValueForName($name);
|
||||
if ($value === null) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Unknown name "'.$name.'" in '.static::className());
|
||||
}
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValueForName($name)
|
||||
{
|
||||
$copy = $this->getArrayCopy();
|
||||
return \array_key_exists($name, $copy) ? $copy[$name] : null;
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($name) {
|
||||
return array_key_exists($name, $this->getArrayCopy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValid($name) {
|
||||
if (!array_key_exists($name, $this->getArrayCopy())) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Unknown name "'.$name.'" in '.static::className());
|
||||
}
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureValueForName($name)
|
||||
{
|
||||
$value = $this->getValueForName($name);
|
||||
if ($value === null) {
|
||||
throw new \InvalidArgumentException('Unknown name "' . $name . '" in ' . static::className());
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($name)
|
||||
{
|
||||
return \array_key_exists($name, $this->getArrayCopy());
|
||||
}
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValid($name)
|
||||
{
|
||||
if (!\array_key_exists($name, $this->getArrayCopy())) {
|
||||
throw new \InvalidArgumentException('Unknown name "' . $name . '" in ' . static::className());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string|int|float $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isValidValue($value)
|
||||
{
|
||||
return \array_key_exists($value, $this->getValuesMap());
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValidValue($value)
|
||||
{
|
||||
if (!$this->isValidValue($value)) {
|
||||
throw new \InvalidArgumentException('"' . $value . '", not a valid value in ' . static::className());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|int|float $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isValidValue($value) {
|
||||
return array_key_exists($value, $this->getValuesMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValidValue($value) {
|
||||
if (!$this->isValidValue($value)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'"'.$value.'", not a valid value in '.static::className());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,36 +21,36 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Enum;
|
||||
|
||||
class EmptyEnum extends \PYS_PRO_GLOBAL\FacebookAds\Enum\AbstractEnum
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNames()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValuesMap()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
class EmptyEnum extends AbstractEnum {
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNames() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValuesMap() {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,60 +21,71 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Enum;
|
||||
|
||||
interface EnumInstanceInterface
|
||||
{
|
||||
/**
|
||||
* @return EnumInstanceInterface
|
||||
*/
|
||||
public static function getInstance();
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy();
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNames();
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues();
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValuesMap();
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValueForName($name);
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureValueForName($name);
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($name);
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValid($name);
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isValidValue($value);
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValidValue($value);
|
||||
interface EnumInstanceInterface {
|
||||
|
||||
/**
|
||||
* @return EnumInstanceInterface
|
||||
*/
|
||||
public static function getInstance();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArrayCopy();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNames();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValuesMap();
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValueForName($name);
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureValueForName($name);
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($name);
|
||||
|
||||
/**
|
||||
* @param string|int|float $name
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValid($name);
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function isValidValue($value);
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function assureIsValidValue($value);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,8 +21,9 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Exception;
|
||||
|
||||
class Exception extends \Exception
|
||||
{
|
||||
class Exception extends \Exception {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,34 +21,36 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Adapter;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Client;
|
||||
abstract class AbstractAdapter implements \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\AdapterInterface
|
||||
{
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient()
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCaBundlePath()
|
||||
{
|
||||
return $this->getClient()->getCaBundlePath();
|
||||
}
|
||||
|
||||
abstract class AbstractAdapter implements AdapterInterface {
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(Client $client) {
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient() {
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCaBundlePath() {
|
||||
return $this->getClient()->getCaBundlePath();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,37 +21,44 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Adapter;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Client;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
interface AdapterInterface
|
||||
{
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\Client $client);
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient();
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCaBundlePath();
|
||||
/**
|
||||
* @return \ArrayObject
|
||||
*/
|
||||
public function getOpts();
|
||||
/**
|
||||
* @param \ArrayObject $opts
|
||||
* @return void
|
||||
*/
|
||||
public function setOpts(\ArrayObject $opts);
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendRequest(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request);
|
||||
|
||||
interface AdapterInterface {
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(Client $client);
|
||||
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCaBundlePath();
|
||||
|
||||
/**
|
||||
* @return \ArrayObject
|
||||
*/
|
||||
public function getOpts();
|
||||
|
||||
/**
|
||||
* @param \ArrayObject $opts
|
||||
* @return void
|
||||
*/
|
||||
public function setOpts(\ArrayObject $opts);
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function sendRequest(RequestInterface $request);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,109 +21,110 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl;
|
||||
|
||||
abstract class AbstractCurl implements \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl\CurlInterface
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $handle;
|
||||
/**
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (!\extension_loaded('curl')) {
|
||||
throw new \RuntimeException("Extension curl not loaded");
|
||||
}
|
||||
abstract class AbstractCurl implements CurlInterface {
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $handle;
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct() {
|
||||
if (!extension_loaded('curl')) {
|
||||
throw new \RuntimeException("Extension curl not loaded");
|
||||
}
|
||||
public function __clone()
|
||||
{
|
||||
$this->handle = \curl_copy_handle($this->handle);
|
||||
}
|
||||
|
||||
public function __clone() {
|
||||
$this->handle = curl_copy_handle($this->handle);
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
if (is_resource($this->handle)) {
|
||||
curl_close($this->handle);
|
||||
}
|
||||
public function __destruct()
|
||||
{
|
||||
if (\is_resource($this->handle)) {
|
||||
\curl_close($this->handle);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return CurlInterface
|
||||
*/
|
||||
public static function createOptimalVersion()
|
||||
{
|
||||
if (\version_compare(\PHP_VERSION, '5.5.0') >= 0) {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl\Curl55();
|
||||
} else {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl\Curl();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
public function getHandle()
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function errno()
|
||||
{
|
||||
return \curl_errno($this->handle);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
return \curl_error($this->handle);
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function exec()
|
||||
{
|
||||
return \curl_exec($this->handle);
|
||||
}
|
||||
/**
|
||||
* @param int $opt
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo($opt = 0)
|
||||
{
|
||||
return \curl_getinfo($this->handle, $opt);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->handle = $this->handle ?: \curl_init();
|
||||
}
|
||||
/**
|
||||
* @param array $opts
|
||||
*/
|
||||
public function setoptArray(array $opts)
|
||||
{
|
||||
\curl_setopt_array($this->handle, $opts);
|
||||
}
|
||||
/**
|
||||
* @param int $option
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function setopt($option, $value)
|
||||
{
|
||||
return \curl_setopt($this->handle, $option, $value);
|
||||
}
|
||||
/**
|
||||
* @param int $age
|
||||
* @return array
|
||||
*/
|
||||
public static function version($age)
|
||||
{
|
||||
return \curl_version($age);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CurlInterface
|
||||
*/
|
||||
public static function createOptimalVersion() {
|
||||
if (version_compare(PHP_VERSION, '5.5.0') >= 0) {
|
||||
return new Curl55();
|
||||
} else {
|
||||
return new Curl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
public function getHandle() {
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function errno() {
|
||||
return curl_errno($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function error() {
|
||||
return curl_error($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function exec() {
|
||||
return curl_exec($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $opt
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo($opt = 0) {
|
||||
return curl_getinfo($this->handle, $opt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
$this->handle = $this->handle ?: curl_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $opts
|
||||
*/
|
||||
public function setoptArray(array $opts) {
|
||||
curl_setopt_array($this->handle, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $option
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function setopt($option, $value) {
|
||||
return curl_setopt($this->handle, $option, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $age
|
||||
* @return array
|
||||
*/
|
||||
public static function version($age) {
|
||||
return curl_version($age);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,76 +21,81 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\FileParameter;
|
||||
class Curl extends \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl\AbstractCurl
|
||||
{
|
||||
/**
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
if (\version_compare(\PHP_VERSION, '5.5.0') >= 0) {
|
||||
throw new \RuntimeException("Unsupported Curl version");
|
||||
}
|
||||
|
||||
class Curl extends AbstractCurl {
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
if (version_compare(PHP_VERSION, '5.5.0') >= 0) {
|
||||
throw new \RuntimeException("Unsupported Curl version");
|
||||
}
|
||||
/**
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function escape($string)
|
||||
{
|
||||
return \rawurlencode($string);
|
||||
}
|
||||
/**
|
||||
* @param int $bitmask
|
||||
* @return int
|
||||
*/
|
||||
public function pause($bitmask)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* FIXME should introduce v2.10 breaking change:
|
||||
* implement abstract support for FileParameter in AdapterInterface
|
||||
*
|
||||
* @param string|FileParameter $filepath
|
||||
* @return string
|
||||
*/
|
||||
public function preparePostFileField($filepath)
|
||||
{
|
||||
$mime_type = $name = '';
|
||||
if ($filepath instanceof \PYS_PRO_GLOBAL\FacebookAds\Http\FileParameter) {
|
||||
$mime_type = $filepath->getMimeType() !== null ? \sprintf(';type=%s', $filepath->getMimeType()) : '';
|
||||
$name = $filepath->getName() !== null ? \sprintf(';filename=%s', $filepath->getName()) : '';
|
||||
$filepath = $filepath->getPath();
|
||||
}
|
||||
return \sprintf('@%s%s%s', $filepath, $mime_type, $name);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->handle && \curl_close($this->handle);
|
||||
$this->handle = \curl_init();
|
||||
}
|
||||
/**
|
||||
* @param int $errornum
|
||||
* @return NULL|string
|
||||
*/
|
||||
public static function strerror($errornum)
|
||||
{
|
||||
return \curl_strerror($errornum);
|
||||
}
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function unescape($string)
|
||||
{
|
||||
return \curl_unescape($this->handle, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function escape($string) {
|
||||
return rawurlencode($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $bitmask
|
||||
* @return int
|
||||
*/
|
||||
public function pause($bitmask) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME should introduce v2.10 breaking change:
|
||||
* implement abstract support for FileParameter in AdapterInterface
|
||||
*
|
||||
* @param string|FileParameter $filepath
|
||||
* @return string
|
||||
*/
|
||||
public function preparePostFileField($filepath) {
|
||||
$mime_type = $name = '';
|
||||
if ($filepath instanceof FileParameter) {
|
||||
$mime_type = $filepath->getMimeType() !== null
|
||||
? sprintf(';type=%s', $filepath->getMimeType())
|
||||
: '';
|
||||
$name = $filepath->getName() !== null
|
||||
? sprintf(';filename=%s', $filepath->getName())
|
||||
: '';
|
||||
$filepath = $filepath->getPath();
|
||||
}
|
||||
return sprintf('@%s%s%s', $filepath, $mime_type, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset() {
|
||||
$this->handle && curl_close($this->handle);
|
||||
$this->handle = curl_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $errornum
|
||||
* @return NULL|string
|
||||
*/
|
||||
public static function strerror($errornum) {
|
||||
return curl_strerror($errornum);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function unescape($string) {
|
||||
return curl_unescape($this->handle, $string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,76 +21,76 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\FileParameter;
|
||||
class Curl55 extends \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl\AbstractCurl
|
||||
{
|
||||
/**
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
if (\version_compare(\PHP_VERSION, '5.5.0') < 0) {
|
||||
throw new \RuntimeException("Unsupported Curl version");
|
||||
}
|
||||
|
||||
class Curl55 extends AbstractCurl {
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
if (version_compare(PHP_VERSION, '5.5.0') < 0) {
|
||||
throw new \RuntimeException("Unsupported Curl version");
|
||||
}
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function escape($string)
|
||||
{
|
||||
return \curl_escape($this->handle, $string);
|
||||
}
|
||||
/**
|
||||
* @param int $bitmask
|
||||
* @return int
|
||||
*/
|
||||
public function pause($bitmask)
|
||||
{
|
||||
return \curl_pause($this->handle, $bitmask);
|
||||
}
|
||||
/**
|
||||
* FIXME should introduce v2.10 breaking change:
|
||||
* implement abstract support for FileParameter in AdapterInterface
|
||||
*
|
||||
* @param string|FileParameter $filepath
|
||||
* @return \CURLFile
|
||||
*/
|
||||
public function preparePostFileField($filepath)
|
||||
{
|
||||
$mime_type = $name = '';
|
||||
// can't be null in HHVM
|
||||
if ($filepath instanceof \PYS_PRO_GLOBAL\FacebookAds\Http\FileParameter) {
|
||||
$mime_type = $filepath->getMimeType() ?: '';
|
||||
$name = $filepath->getName() ?: '';
|
||||
$filepath = $filepath->getPath();
|
||||
}
|
||||
return new \CURLFile($filepath, $mime_type, $name);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->handle && \curl_reset($this->handle);
|
||||
}
|
||||
/**
|
||||
* @param int $errornum
|
||||
* @return NULL|string
|
||||
*/
|
||||
public static function strerror($errornum)
|
||||
{
|
||||
return \curl_strerror($errornum);
|
||||
}
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function unescape($string)
|
||||
{
|
||||
return \curl_unescape($this->handle, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function escape($string) {
|
||||
return curl_escape($this->handle, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $bitmask
|
||||
* @return int
|
||||
*/
|
||||
public function pause($bitmask) {
|
||||
return curl_pause($this->handle, $bitmask);
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME should introduce v2.10 breaking change:
|
||||
* implement abstract support for FileParameter in AdapterInterface
|
||||
*
|
||||
* @param string|FileParameter $filepath
|
||||
* @return \CURLFile
|
||||
*/
|
||||
public function preparePostFileField($filepath) {
|
||||
$mime_type = $name = ''; // can't be null in HHVM
|
||||
if ($filepath instanceof FileParameter) {
|
||||
$mime_type = $filepath->getMimeType() ?: '';
|
||||
$name = $filepath->getName() ?: '';
|
||||
$filepath = $filepath->getPath();
|
||||
}
|
||||
return new \CURLFile($filepath, $mime_type, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset() {
|
||||
$this->handle && curl_reset($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $errornum
|
||||
* @return NULL|string
|
||||
*/
|
||||
public static function strerror($errornum) {
|
||||
return curl_strerror($errornum);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function unescape($string) {
|
||||
return curl_unescape($this->handle, $string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,72 +21,86 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl;
|
||||
|
||||
interface CurlInterface
|
||||
{
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
public function getHandle();
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function errno();
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function error();
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function escape($string);
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function exec();
|
||||
/**
|
||||
* @param int $opt
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo($opt = 0);
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init();
|
||||
/**
|
||||
* @param int $bitmask
|
||||
* @return int
|
||||
*/
|
||||
public function pause($bitmask);
|
||||
/**
|
||||
* @param $filepath
|
||||
* @return string|\CurlFile
|
||||
*/
|
||||
public function preparePostFileField($filepath);
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset();
|
||||
/**
|
||||
* @param array $opts
|
||||
*/
|
||||
public function setoptArray(array $opts);
|
||||
/**
|
||||
* @param int $option
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function setopt($option, $value);
|
||||
/**
|
||||
* @param $string
|
||||
* @return string
|
||||
*/
|
||||
public function unescape($string);
|
||||
/**
|
||||
* @param int $age
|
||||
* @return array
|
||||
*/
|
||||
public static function version($age);
|
||||
interface CurlInterface {
|
||||
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
public function getHandle();
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function errno();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function error();
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return bool|string
|
||||
*/
|
||||
public function escape($string);
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function exec();
|
||||
|
||||
/**
|
||||
* @param int $opt
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInfo($opt = 0);
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init();
|
||||
|
||||
/**
|
||||
* @param int $bitmask
|
||||
* @return int
|
||||
*/
|
||||
public function pause($bitmask);
|
||||
|
||||
/**
|
||||
* @param $filepath
|
||||
* @return string|\CurlFile
|
||||
*/
|
||||
public function preparePostFileField($filepath);
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset();
|
||||
|
||||
/**
|
||||
* @param array $opts
|
||||
*/
|
||||
public function setoptArray(array $opts);
|
||||
|
||||
/**
|
||||
* @param int $option
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function setopt($option, $value);
|
||||
|
||||
/**
|
||||
* @param $string
|
||||
* @return string
|
||||
*/
|
||||
public function unescape($string);
|
||||
|
||||
/**
|
||||
* @param int $age
|
||||
* @return array
|
||||
*/
|
||||
public static function version($age);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Adapter;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Exception\Exception;
|
||||
@@ -32,135 +32,170 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\Client;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Headers;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
class CurlAdapter extends \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\AbstractAdapter
|
||||
{
|
||||
/**
|
||||
* @var CurlInterface
|
||||
*/
|
||||
protected $curl;
|
||||
/**
|
||||
* @var \ArrayObject
|
||||
*/
|
||||
protected $opts;
|
||||
/**
|
||||
* @param Client $client
|
||||
* @param CurlInterface $curl
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\Client $client, \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl\CurlInterface $curl = null)
|
||||
{
|
||||
parent::__construct($client);
|
||||
$this->curl = $curl ?: \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\Curl\AbstractCurl::createOptimalVersion();
|
||||
$this->curl->init();
|
||||
|
||||
class CurlAdapter extends AbstractAdapter {
|
||||
|
||||
/**
|
||||
* @var CurlInterface
|
||||
*/
|
||||
protected $curl;
|
||||
|
||||
/**
|
||||
* @var \ArrayObject
|
||||
*/
|
||||
protected $opts;
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @param CurlInterface $curl
|
||||
*/
|
||||
public function __construct(Client $client, CurlInterface $curl = null) {
|
||||
parent::__construct($client);
|
||||
$this->curl = $curl ?: AbstractCurl::createOptimalVersion();
|
||||
$this->curl->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Curl
|
||||
*/
|
||||
public function getCurl() {
|
||||
return $this->curl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayObject
|
||||
*/
|
||||
public function getOpts() {
|
||||
if ($this->opts === null) {
|
||||
$this->opts = new \ArrayObject(array(
|
||||
CURLOPT_CONNECTTIMEOUT => 10,
|
||||
CURLOPT_TIMEOUT => 60,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_CAINFO => $this->getCaBundlePath(),
|
||||
));
|
||||
}
|
||||
/**
|
||||
* @return Curl
|
||||
*/
|
||||
public function getCurl()
|
||||
{
|
||||
return $this->curl;
|
||||
|
||||
return $this->opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ArrayObject $opts
|
||||
*/
|
||||
public function setOpts(\ArrayObject $opts) {
|
||||
$this->opts = $opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
protected function getheaderSize() {
|
||||
return $this->getCurl()->getInfo(CURLINFO_HEADER_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the headers and the body into a two-part array
|
||||
* @param string $raw_response
|
||||
* @return array
|
||||
*/
|
||||
protected function extractResponseHeadersAndBody($raw_response) {
|
||||
$header_size = $this->getheaderSize();
|
||||
|
||||
$raw_headers = mb_substr($raw_response, 0, $header_size);
|
||||
$raw_body = mb_substr($raw_response, $header_size);
|
||||
|
||||
return array(trim($raw_headers), trim($raw_body));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Headers $headers
|
||||
* @param string $raw_headers
|
||||
*/
|
||||
protected function parseHeaders(Headers $headers, $raw_headers) {
|
||||
$raw_headers = str_replace("\r\n", "\n", $raw_headers);
|
||||
|
||||
// There will be multiple headers if a 301 was followed
|
||||
// or a proxy was followed, etc
|
||||
$header_collection = explode("\n\n", trim($raw_headers));
|
||||
// We just want the last response (at the end)
|
||||
$raw_headers = array_pop($header_collection);
|
||||
|
||||
$header_components = explode("\n", $raw_headers);
|
||||
foreach ($header_components as $line) {
|
||||
if (strpos($line, ': ') === false) {
|
||||
$headers['http_code'] = $line;
|
||||
} else {
|
||||
list ($key, $value) = explode(': ', $line, 2);
|
||||
$headers[$key] = $value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return \ArrayObject
|
||||
*/
|
||||
public function getOpts()
|
||||
{
|
||||
if ($this->opts === null) {
|
||||
$this->opts = new \ArrayObject(array(\CURLOPT_CONNECTTIMEOUT => 10, \CURLOPT_TIMEOUT => 60, \CURLOPT_RETURNTRANSFER => \true, \CURLOPT_HEADER => \true, \CURLOPT_CAINFO => $this->getCaBundlePath()));
|
||||
}
|
||||
return $this->opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendRequest(RequestInterface $request) {
|
||||
$response = $this->getClient()->createResponse();
|
||||
$this->getCurl()->reset();
|
||||
$curlopts = array(
|
||||
CURLOPT_URL => $request->getUrl(),
|
||||
);
|
||||
|
||||
$method = $request->getMethod();
|
||||
if ($method !== RequestInterface::METHOD_GET
|
||||
&& $method !== RequestInterface::METHOD_POST) {
|
||||
$curlopts[CURLOPT_CUSTOMREQUEST] = $method;
|
||||
}
|
||||
/**
|
||||
* @param \ArrayObject $opts
|
||||
*/
|
||||
public function setOpts(\ArrayObject $opts)
|
||||
{
|
||||
$this->opts = $opts;
|
||||
|
||||
$curlopts = $this->getOpts()->getArrayCopy() + $curlopts;
|
||||
|
||||
if ($request->getHeaders()->count()) {
|
||||
$headers = array();
|
||||
foreach ($request->getHeaders() as $header => $value) {
|
||||
$headers[] = "{$header}: {$value}";
|
||||
}
|
||||
$curlopts[CURLOPT_HTTPHEADER] = $headers;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
protected function getheaderSize()
|
||||
{
|
||||
return $this->getCurl()->getInfo(\CURLINFO_HEADER_SIZE);
|
||||
|
||||
$postfields = array();
|
||||
if ($method === RequestInterface::METHOD_POST
|
||||
&& $request->getFileParams()->count()
|
||||
) {
|
||||
$postfields = array_merge(
|
||||
$postfields,
|
||||
array_map(
|
||||
array($this->getCurl(), 'preparePostFileField'),
|
||||
$request->getFileParams()->getArrayCopy()));
|
||||
}
|
||||
/**
|
||||
* Extracts the headers and the body into a two-part array
|
||||
* @param string $raw_response
|
||||
* @return array
|
||||
*/
|
||||
protected function extractResponseHeadersAndBody($raw_response)
|
||||
{
|
||||
$header_size = $this->getheaderSize();
|
||||
$raw_headers = \mb_substr($raw_response, 0, $header_size);
|
||||
$raw_body = \mb_substr($raw_response, $header_size);
|
||||
return array(\trim($raw_headers), \trim($raw_body));
|
||||
if ($method !== RequestInterface::METHOD_GET
|
||||
&& $request->getBodyParams()->count()) {
|
||||
$postfields
|
||||
= array_merge($postfields, $request->getBodyParams()->export());
|
||||
}
|
||||
/**
|
||||
* @param Headers $headers
|
||||
* @param string $raw_headers
|
||||
*/
|
||||
protected function parseHeaders(\PYS_PRO_GLOBAL\FacebookAds\Http\Headers $headers, $raw_headers)
|
||||
{
|
||||
$raw_headers = \str_replace("\r\n", "\n", $raw_headers);
|
||||
// There will be multiple headers if a 301 was followed
|
||||
// or a proxy was followed, etc
|
||||
$header_collection = \explode("\n\n", \trim($raw_headers));
|
||||
// We just want the last response (at the end)
|
||||
$raw_headers = \array_pop($header_collection);
|
||||
$header_components = \explode("\n", $raw_headers);
|
||||
foreach ($header_components as $line) {
|
||||
if (\strpos($line, ': ') === \false) {
|
||||
$headers['http_code'] = $line;
|
||||
} else {
|
||||
list($key, $value) = \explode(': ', $line, 2);
|
||||
$headers[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($postfields)) {
|
||||
$curlopts[CURLOPT_POSTFIELDS] = $postfields;
|
||||
}
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendRequest(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request)
|
||||
{
|
||||
$response = $this->getClient()->createResponse();
|
||||
$this->getCurl()->reset();
|
||||
$curlopts = array(\CURLOPT_URL => $request->getUrl());
|
||||
$method = $request->getMethod();
|
||||
if ($method !== \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET && $method !== \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST) {
|
||||
$curlopts[\CURLOPT_CUSTOMREQUEST] = $method;
|
||||
}
|
||||
$curlopts = $this->getOpts()->getArrayCopy() + $curlopts;
|
||||
if ($request->getHeaders()->count()) {
|
||||
$headers = array();
|
||||
foreach ($request->getHeaders() as $header => $value) {
|
||||
$headers[] = "{$header}: {$value}";
|
||||
}
|
||||
$curlopts[\CURLOPT_HTTPHEADER] = $headers;
|
||||
}
|
||||
$postfields = array();
|
||||
if ($method === \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST && $request->getFileParams()->count()) {
|
||||
$postfields = \array_merge($postfields, \array_map(array($this->getCurl(), 'preparePostFileField'), $request->getFileParams()->getArrayCopy()));
|
||||
}
|
||||
if ($method !== \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET && $request->getBodyParams()->count()) {
|
||||
$postfields = \array_merge($postfields, $request->getBodyParams()->export());
|
||||
}
|
||||
if (!empty($postfields)) {
|
||||
$curlopts[\CURLOPT_POSTFIELDS] = $postfields;
|
||||
}
|
||||
$this->getCurl()->setoptArray($curlopts);
|
||||
$raw_response = $this->getCurl()->exec();
|
||||
$status_code = $this->getCurl()->getInfo(\CURLINFO_HTTP_CODE);
|
||||
$curl_errno = $this->getCurl()->errno();
|
||||
$curl_error = $curl_errno ? $this->getCurl()->error() : null;
|
||||
$response_parts = $this->extractResponseHeadersAndBody($raw_response);
|
||||
$response->setStatusCode($status_code);
|
||||
$this->parseHeaders($response->getHeaders(), $response_parts[0]);
|
||||
$response->setBody($response_parts[1]);
|
||||
if ($curl_errno) {
|
||||
throw new \PYS_PRO_GLOBAL\FacebookAds\Exception\Exception($curl_error, $curl_errno);
|
||||
}
|
||||
return $response;
|
||||
|
||||
$this->getCurl()->setoptArray($curlopts);
|
||||
$raw_response = $this->getCurl()->exec();
|
||||
|
||||
$status_code = $this->getCurl()->getInfo(CURLINFO_HTTP_CODE);
|
||||
$curl_errno = $this->getCurl()->errno();
|
||||
$curl_error = $curl_errno ? $this->getCurl()->error() : null;
|
||||
|
||||
$response_parts = $this->extractResponseHeadersAndBody($raw_response);
|
||||
|
||||
$response->setStatusCode($status_code);
|
||||
$this->parseHeaders($response->getHeaders(), $response_parts[0]);
|
||||
$response->setBody($response_parts[1]);
|
||||
|
||||
if ($curl_errno) {
|
||||
throw new Exception($curl_error, $curl_errno);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiConfig;
|
||||
@@ -29,169 +29,203 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\AdapterInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\CurlAdapter;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Exception\EmptyResponseException;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException;
|
||||
class Client
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_GRAPH_BASE_DOMAIN = 'facebook.com';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_LAST_LEVEL_DOMAIN = 'graph';
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
protected $requestPrototype;
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
protected $responsePrototype;
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $defaultRequestHeaders;
|
||||
/**
|
||||
* @var AdapterInterface
|
||||
*/
|
||||
protected $adapter;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $caBundlePath;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $defaultGraphBaseDomain = self::DEFAULT_GRAPH_BASE_DOMAIN;
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function getRequestPrototype()
|
||||
{
|
||||
if ($this->requestPrototype === null) {
|
||||
$this->requestPrototype = new \PYS_PRO_GLOBAL\FacebookAds\Http\Request($this);
|
||||
}
|
||||
return $this->requestPrototype;
|
||||
|
||||
class Client {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_GRAPH_BASE_DOMAIN = 'facebook.com';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_LAST_LEVEL_DOMAIN = 'graph';
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
protected $requestPrototype;
|
||||
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
protected $responsePrototype;
|
||||
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $defaultRequestHeaders;
|
||||
|
||||
/**
|
||||
* @var AdapterInterface
|
||||
*/
|
||||
protected $adapter;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $caBundlePath;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $defaultGraphBaseDomain = self::DEFAULT_GRAPH_BASE_DOMAIN;
|
||||
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function getRequestPrototype() {
|
||||
if ($this->requestPrototype === null) {
|
||||
$this->requestPrototype = new Request($this);
|
||||
}
|
||||
/**
|
||||
* @param RequestInterface $prototype
|
||||
*/
|
||||
public function setRequestPrototype(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $prototype)
|
||||
{
|
||||
$this->requestPrototype = $prototype;
|
||||
|
||||
return $this->requestPrototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestInterface $prototype
|
||||
*/
|
||||
public function setRequestPrototype(RequestInterface $prototype) {
|
||||
$this->requestPrototype = $prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function createRequest() {
|
||||
return $this->getRequestPrototype()->createClone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getResponsePrototype() {
|
||||
if ($this->responsePrototype === null) {
|
||||
$this->responsePrototype = new Response();
|
||||
}
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function createRequest()
|
||||
{
|
||||
return $this->getRequestPrototype()->createClone();
|
||||
|
||||
return $this->responsePrototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $prototype
|
||||
*/
|
||||
public function setResponsePrototype(ResponseInterface $prototype) {
|
||||
$this->responsePrototype = $prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function createResponse() {
|
||||
return clone $this->getResponsePrototype();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getDefaultRequestHeaders() {
|
||||
if ($this->defaultRequestHeaders === null) {
|
||||
$this->defaultRequestHeaders = new Headers(array(
|
||||
'User-Agent' => 'fbbizsdk-php-v'.ApiConfig::SDKVersion,
|
||||
'Accept-Encoding' => '*',
|
||||
));
|
||||
}
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getResponsePrototype()
|
||||
{
|
||||
if ($this->responsePrototype === null) {
|
||||
$this->responsePrototype = new \PYS_PRO_GLOBAL\FacebookAds\Http\Response();
|
||||
}
|
||||
return $this->responsePrototype;
|
||||
|
||||
return $this->defaultRequestHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getDefaultRequestHeaders() instead
|
||||
*
|
||||
* @return Headers
|
||||
*/
|
||||
public function getDefaultRequestHeaderds() {
|
||||
@trigger_error(sprintf('%s deprecated, use getDefaultRequestHeaders() instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->getDefaultRequestHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setDefaultRequestHeaders(Headers $headers) {
|
||||
$this->defaultRequestHeaders = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultGraphBaseDomain() {
|
||||
return $this->defaultGraphBaseDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $domain
|
||||
*/
|
||||
public function setDefaultGraphBaseDomain($domain) {
|
||||
$this->defaultGraphBaseDomain = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function getAdapter() {
|
||||
if ($this->adapter === null) {
|
||||
$this->adapter = new CurlAdapter($this);
|
||||
}
|
||||
/**
|
||||
* @param ResponseInterface $prototype
|
||||
*/
|
||||
public function setResponsePrototype(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $prototype)
|
||||
{
|
||||
$this->responsePrototype = $prototype;
|
||||
|
||||
return $this->adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdapterInterface $adapter
|
||||
*/
|
||||
public function setAdapter(AdapterInterface $adapter) {
|
||||
$this->adapter = $adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCaBundlePath() {
|
||||
if ($this->caBundlePath === null) {
|
||||
$this->caBundlePath = __DIR__.DIRECTORY_SEPARATOR
|
||||
.str_repeat('..'.DIRECTORY_SEPARATOR, 3)
|
||||
.'fb_ca_chain_bundle.crt';
|
||||
}
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function createResponse()
|
||||
{
|
||||
return clone $this->getResponsePrototype();
|
||||
|
||||
return $this->caBundlePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function setCaBundlePath($path) {
|
||||
$this->caBundlePath = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function sendRequest(RequestInterface $request) {
|
||||
$response = $this->getAdapter()->sendRequest($request);
|
||||
$response->setRequest($request);
|
||||
$response_content = $response->getContent();
|
||||
|
||||
if ($response_content === null) {
|
||||
throw new EmptyResponseException($response);
|
||||
}
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getDefaultRequestHeaderds()
|
||||
{
|
||||
if ($this->defaultRequestHeaders === null) {
|
||||
$this->defaultRequestHeaders = new \PYS_PRO_GLOBAL\FacebookAds\Http\Headers(array('User-Agent' => 'fbbizsdk-php-v' . \PYS_PRO_GLOBAL\FacebookAds\ApiConfig::SDKVersion, 'Accept-Encoding' => '*'));
|
||||
}
|
||||
return $this->defaultRequestHeaders;
|
||||
}
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setDefaultRequestHeaders(\PYS_PRO_GLOBAL\FacebookAds\Http\Headers $headers)
|
||||
{
|
||||
$this->defaultRequestHeaders = $headers;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultGraphBaseDomain()
|
||||
{
|
||||
return $this->defaultGraphBaseDomain;
|
||||
}
|
||||
/**
|
||||
* @param string $domain
|
||||
*/
|
||||
public function setDefaultGraphBaseDomain($domain)
|
||||
{
|
||||
$this->defaultGraphBaseDomain = $domain;
|
||||
}
|
||||
/**
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function getAdapter()
|
||||
{
|
||||
if ($this->adapter === null) {
|
||||
$this->adapter = new \PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\CurlAdapter($this);
|
||||
}
|
||||
return $this->adapter;
|
||||
}
|
||||
/**
|
||||
* @param AdapterInterface $adapter
|
||||
*/
|
||||
public function setAdapter(\PYS_PRO_GLOBAL\FacebookAds\Http\Adapter\AdapterInterface $adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCaBundlePath()
|
||||
{
|
||||
if ($this->caBundlePath === null) {
|
||||
$this->caBundlePath = __DIR__ . \DIRECTORY_SEPARATOR . \str_repeat('..' . \DIRECTORY_SEPARATOR, 3) . 'fb_ca_chain_bundle.crt';
|
||||
}
|
||||
return $this->caBundlePath;
|
||||
}
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function setCaBundlePath($path)
|
||||
{
|
||||
$this->caBundlePath = $path;
|
||||
}
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return ResponseInterface
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function sendRequest(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request)
|
||||
{
|
||||
$response = $this->getAdapter()->sendRequest($request);
|
||||
$response->setRequest($request);
|
||||
$response_content = $response->getContent();
|
||||
if ($response_content === null) {
|
||||
throw new \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\EmptyResponseException($response);
|
||||
}
|
||||
if (\is_array($response_content) && \array_key_exists('error', $response_content)) {
|
||||
throw \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException::create($response);
|
||||
}
|
||||
return $response;
|
||||
|
||||
if (is_array($response_content)
|
||||
&& array_key_exists('error', $response_content)) {
|
||||
|
||||
throw RequestException::create($response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,8 +21,9 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Exception;
|
||||
|
||||
class AuthorizationException extends \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException
|
||||
{
|
||||
class AuthorizationException extends RequestException {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,8 +21,9 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Exception;
|
||||
|
||||
class ClientException extends \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException
|
||||
{
|
||||
class ClientException extends RequestException {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,18 +21,22 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Exception;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
class EmptyResponseException extends \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException
|
||||
{
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response)
|
||||
{
|
||||
$content = array('error' => array('message' => 'Empty Response'));
|
||||
$response->setBody(\json_encode($content));
|
||||
parent::__construct($response);
|
||||
}
|
||||
|
||||
class EmptyResponseException extends RequestException {
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
public function __construct(ResponseInterface $response) {
|
||||
$content = array(
|
||||
'error' => array(
|
||||
'message' => 'Empty Response',
|
||||
));
|
||||
$response->setBody(json_encode($content));
|
||||
parent::__construct($response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,8 +21,9 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Exception;
|
||||
|
||||
class PermissionException extends \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException
|
||||
{
|
||||
class PermissionException extends RequestException {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,190 +21,237 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Exception;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Exception\Exception;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
class RequestException extends \PYS_PRO_GLOBAL\FacebookAds\Exception\Exception
|
||||
{
|
||||
/**
|
||||
* @var ResponseInterface|null
|
||||
*/
|
||||
protected $response;
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $headers;
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $errorCode;
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $errorSubcode;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $errorMessage;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $errorUserTitle;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $errorUserMessage;
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $errorType;
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $errorBlameFieldSpecs;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $facebookTraceId;
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response)
|
||||
{
|
||||
$this->headers = $response->getHeaders();
|
||||
$this->response = $response;
|
||||
$error_data = static::getErrorData($response);
|
||||
parent::__construct($error_data['message'], $error_data['code']);
|
||||
$this->errorSubcode = $error_data['error_subcode'];
|
||||
$this->errorUserTitle = $error_data['error_user_title'];
|
||||
$this->errorUserMessage = $error_data['error_user_msg'];
|
||||
$this->errorBlameFieldSpecs = $error_data['error_blame_field_specs'];
|
||||
$this->facebookTraceId = $error_data['fbtrace_id'];
|
||||
|
||||
class RequestException extends Exception {
|
||||
|
||||
/**
|
||||
* @var ResponseInterface|null
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $headers;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $errorCode;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $errorSubcode;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $errorMessage;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $errorUserTitle;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $errorUserMessage;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $errorType;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
protected $errorBlameFieldSpecs;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $facebookTraceId;
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
public function __construct(ResponseInterface $response) {
|
||||
$this->headers = $response->getHeaders();
|
||||
$this->response = $response;
|
||||
$error_data = static::getErrorData($response);
|
||||
|
||||
parent::__construct($error_data['message'], $error_data['code']);
|
||||
|
||||
$this->errorSubcode = $error_data['error_subcode'];
|
||||
$this->errorUserTitle = $error_data['error_user_title'];
|
||||
$this->errorUserMessage = $error_data['error_user_msg'];
|
||||
$this->errorBlameFieldSpecs = $error_data['error_blame_field_specs'];
|
||||
$this->facebookTraceId = $error_data['fbtrace_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseInterface|null
|
||||
*/
|
||||
public function getResponse() {
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|string $array
|
||||
* @param string|int $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function idx($array, $key, $default = null) {
|
||||
if (is_string($array)) {
|
||||
$array = json_decode($array, true);
|
||||
}
|
||||
/**
|
||||
* @return ResponseInterface|null
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
|
||||
if (is_null($array)) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param array|string $array
|
||||
* @param string|int $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function idx($array, $key, $default = null)
|
||||
{
|
||||
if (\is_string($array)) {
|
||||
$array = \json_decode($array, \true);
|
||||
}
|
||||
if (\is_null($array)) {
|
||||
return null;
|
||||
}
|
||||
return \array_key_exists($key, $array) ? $array[$key] : $default;
|
||||
|
||||
return array_key_exists($key, $array)
|
||||
? $array[$key]
|
||||
: $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
* @return array
|
||||
*/
|
||||
protected static function getErrorData(ResponseInterface $response) {
|
||||
$response_data = $response->getContent();
|
||||
if (is_null($response_data)) {
|
||||
$response_data = array();
|
||||
}
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
* @return array
|
||||
*/
|
||||
protected static function getErrorData(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response)
|
||||
{
|
||||
$response_data = $response->getContent();
|
||||
if (\is_null($response_data)) {
|
||||
$response_data = array();
|
||||
}
|
||||
$error_data = static::idx($response_data, 'error', array());
|
||||
if (\is_string(static::idx($error_data, 'error_data'))) {
|
||||
$error_data["error_data"] = \json_decode(\stripslashes(static::idx($error_data, 'error_data')), \true);
|
||||
}
|
||||
if (\is_null(static::idx($error_data, 'error_data'))) {
|
||||
$error_data["error_data"] = array();
|
||||
}
|
||||
return array('code' => static::idx($error_data, 'code', static::idx($response_data, 'code')), 'error_subcode' => static::idx($error_data, 'error_subcode'), 'message' => static::idx($error_data, 'message'), 'error_user_title' => static::idx($error_data, 'error_user_title'), 'error_user_msg' => static::idx($error_data, 'error_user_msg'), 'error_blame_field_specs' => static::idx(static::idx($error_data, 'error_data', array()), 'blame_field_specs'), 'fbtrace_id' => static::idx($error_data, 'fbtrace_id'), 'type' => static::idx($error_data, 'type'));
|
||||
$error_data = static::idx($response_data, 'error', array());
|
||||
|
||||
if (is_string(static::idx($error_data, 'error_data'))) {
|
||||
$error_data["error_data"] =
|
||||
json_decode(stripslashes(static::idx($error_data, 'error_data')), true);
|
||||
}
|
||||
/**
|
||||
* Process an error payload from the Graph API and return the appropriate
|
||||
* exception subclass.
|
||||
* @param ResponseInterface $response
|
||||
* @return RequestException
|
||||
*/
|
||||
public static function create(\PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response)
|
||||
{
|
||||
$error_data = static::getErrorData($response);
|
||||
if (\in_array($error_data['error_subcode'], array(458, 459, 460, 463, 464, 467)) || \in_array($error_data['code'], array(100, 102, 190)) || $error_data['type'] === 'OAuthException') {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\AuthorizationException($response);
|
||||
} elseif (\in_array($error_data['code'], array(1, 2))) {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\ServerException($response);
|
||||
} elseif (\in_array($error_data['code'], array(4, 17, 341))) {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\ThrottleException($response);
|
||||
} elseif ($error_data['code'] == 506) {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\ClientException($response);
|
||||
} elseif ($error_data['code'] == 10 || $error_data['code'] >= 200 && $error_data['code'] <= 299) {
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\PermissionException($response);
|
||||
} else {
|
||||
return new self($response);
|
||||
}
|
||||
|
||||
if (is_null(static::idx($error_data, 'error_data'))) {
|
||||
$error_data["error_data"] = array();
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHttpStatusCode()
|
||||
{
|
||||
return $this->response->getStatusCode();
|
||||
|
||||
return array(
|
||||
'code' =>
|
||||
static::idx($error_data, 'code', static::idx($response_data, 'code')),
|
||||
'error_subcode' => static::idx($error_data, 'error_subcode'),
|
||||
'message' => static::idx($error_data, 'message'),
|
||||
'error_user_title' => static::idx($error_data, 'error_user_title'),
|
||||
'error_user_msg' => static::idx($error_data, 'error_user_msg'),
|
||||
'error_blame_field_specs' =>
|
||||
static::idx(static::idx($error_data, 'error_data', array()),
|
||||
'blame_field_specs'),
|
||||
'fbtrace_id' => static::idx($error_data, 'fbtrace_id'),
|
||||
'type' => static::idx($error_data, 'type'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an error payload from the Graph API and return the appropriate
|
||||
* exception subclass.
|
||||
* @param ResponseInterface $response
|
||||
* @return RequestException
|
||||
*/
|
||||
public static function create(ResponseInterface $response) {
|
||||
$error_data = static::getErrorData($response);
|
||||
if (in_array(
|
||||
$error_data['error_subcode'], array(458, 459, 460, 463, 464, 467))
|
||||
|| in_array($error_data['code'], array(100, 102, 190))
|
||||
|| $error_data['type'] === 'OAuthException') {
|
||||
|
||||
return new AuthorizationException($response);
|
||||
} elseif (in_array($error_data['code'], array(1, 2))) {
|
||||
|
||||
return new ServerException($response);
|
||||
} elseif (in_array($error_data['code'], array(4, 17, 341))) {
|
||||
|
||||
return new ThrottleException($response);
|
||||
} elseif ($error_data['code'] == 506) {
|
||||
|
||||
return new ClientException($response);
|
||||
} elseif ($error_data['code'] == 10
|
||||
|| ($error_data['code'] >= 200 && $error_data['code'] <= 299)) {
|
||||
|
||||
return new PermissionException($response);
|
||||
} else {
|
||||
|
||||
return new self($response);
|
||||
}
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getErrorSubcode()
|
||||
{
|
||||
return $this->errorSubcode;
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getErrorUserTitle()
|
||||
{
|
||||
return $this->errorUserTitle;
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getErrorUserMessage()
|
||||
{
|
||||
return $this->errorUserMessage;
|
||||
}
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getErrorBlameFieldSpecs()
|
||||
{
|
||||
return $this->errorBlameFieldSpecs;
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFacebookTraceId()
|
||||
{
|
||||
return $this->facebookTraceId;
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isTransient()
|
||||
{
|
||||
if ($this->getResponse() !== null) {
|
||||
return \false;
|
||||
}
|
||||
$body = $this->getResponse()->getBody();
|
||||
return \array_key_exists('error', $body) && \array_key_exists('is_transient', $body['error']) && $body['error']['is_transient'];
|
||||
}
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders()
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHttpStatusCode() {
|
||||
return $this->response->getStatusCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getErrorSubcode() {
|
||||
return $this->errorSubcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getErrorUserTitle() {
|
||||
return $this->errorUserTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getErrorUserMessage() {
|
||||
return $this->errorUserMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getErrorBlameFieldSpecs() {
|
||||
return $this->errorBlameFieldSpecs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFacebookTraceId() {
|
||||
return $this->facebookTraceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isTransient() {
|
||||
if ($this->getResponse() !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$body = $this->getResponse()->getBody();
|
||||
|
||||
return array_key_exists('error', $body)
|
||||
&& array_key_exists('is_transient', $body['error'])
|
||||
&& $body['error']['is_transient'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders() {
|
||||
return $this->headers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,8 +21,9 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Exception;
|
||||
|
||||
class ServerException extends \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException
|
||||
{
|
||||
class ServerException extends RequestException {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,8 +21,9 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http\Exception;
|
||||
|
||||
class ThrottleException extends \PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException
|
||||
{
|
||||
class ThrottleException extends RequestException {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,66 +21,69 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
class FileParameter
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $path;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $mimeType;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $name;
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->mimeType;
|
||||
}
|
||||
/**
|
||||
* @param null|string $mime_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setMimeType($mime_type)
|
||||
{
|
||||
$this->mimeType = $mime_type;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
/**
|
||||
* @param null|string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
class FileParameter {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $mimeType;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function __construct($path) {
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath() {
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getMimeType() {
|
||||
return $this->mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $mime_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setMimeType($mime_type) {
|
||||
$this->mimeType = $mime_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,8 +21,22 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
class Headers extends \ArrayObject
|
||||
{
|
||||
class Headers extends \ArrayObject {
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function export() {
|
||||
$data = array();
|
||||
foreach ($this as $key => $value) {
|
||||
$data[$key] = is_null($value) || is_scalar($value)
|
||||
? $value
|
||||
: $this->exportNonScalar($value);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,36 +21,39 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
class Parameters extends \ArrayObject
|
||||
{
|
||||
/**
|
||||
* @param array $data
|
||||
*/
|
||||
public function enhance(array $data)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$this[$key] = $value;
|
||||
}
|
||||
class Parameters extends \ArrayObject {
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*/
|
||||
public function enhance(array $data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this[$key] = $value;
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
protected function exportNonScalar($value)
|
||||
{
|
||||
return \json_encode($value);
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
$data = array();
|
||||
foreach ($this as $key => $value) {
|
||||
$data[$key] = \is_null($value) || \is_scalar($value) ? $value : $this->exportNonScalar($value);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
protected function exportNonScalar($value) {
|
||||
return json_encode($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function export() {
|
||||
$data = array();
|
||||
foreach ($this as $key => $value) {
|
||||
$data[$key] = is_null($value) || is_scalar($value)
|
||||
? $value
|
||||
: $this->exportNonScalar($value);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,250 +21,276 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
class Request implements \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PROTOCOL_HTTP = 'http://';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PROTOCOL_HTTPS = 'https://';
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $headers;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $method = self::METHOD_GET;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $protocol = self::PROTOCOL_HTTPS;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $domain;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $path;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $graphVersion;
|
||||
/**
|
||||
* @var Parameters
|
||||
*/
|
||||
protected $queryParams;
|
||||
/**
|
||||
* @var Parameters
|
||||
*/
|
||||
protected $bodyParams;
|
||||
/**
|
||||
* @var Parameters
|
||||
*/
|
||||
protected $fileParams;
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
class Request implements RequestInterface {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PROTOCOL_HTTP = 'http://';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PROTOCOL_HTTPS = 'https://';
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $headers;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $method = self::METHOD_GET;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $protocol = self::PROTOCOL_HTTPS;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $domain;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $graphVersion;
|
||||
|
||||
/**
|
||||
* @var Parameters
|
||||
*/
|
||||
protected $queryParams;
|
||||
|
||||
/**
|
||||
* @var Parameters
|
||||
*/
|
||||
protected $bodyParams;
|
||||
|
||||
/**
|
||||
* @var Parameters
|
||||
*/
|
||||
protected $fileParams;
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(Client $client) {
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function __clone() {
|
||||
$this->queryParams && $this->queryParams = clone $this->queryParams;
|
||||
$this->bodyParams && $this->bodyParams = clone $this->bodyParams;
|
||||
$this->fileParams && $this->fileParams = clone $this->fileParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient() {
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProtocol() {
|
||||
return $this->protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $protocol
|
||||
*/
|
||||
public function setProtocol($protocol) {
|
||||
$this->protocol = $protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain() {
|
||||
if ($this->domain === null) {
|
||||
$this->domain = sprintf(
|
||||
"%s.%s",
|
||||
Client::DEFAULT_LAST_LEVEL_DOMAIN,
|
||||
$this->client->getDefaultGraphBaseDomain());
|
||||
}
|
||||
public function __clone()
|
||||
{
|
||||
$this->queryParams && ($this->queryParams = clone $this->queryParams);
|
||||
$this->bodyParams && ($this->bodyParams = clone $this->bodyParams);
|
||||
$this->fileParams && ($this->fileParams = clone $this->fileParams);
|
||||
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $domain
|
||||
*/
|
||||
public function setDomain($domain) {
|
||||
$this->domain = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $last_level_domain
|
||||
*/
|
||||
public function setLastLevelDomain($last_level_domain) {
|
||||
$this->domain = sprintf(
|
||||
"%s.%s",
|
||||
$last_level_domain,
|
||||
$this->client->getDefaultGraphBaseDomain());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders() {
|
||||
if ($this->headers === null) {
|
||||
$this->headers = clone $this->getClient()->getDefaultRequestHeaders();
|
||||
}
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient()
|
||||
{
|
||||
return $this->client;
|
||||
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(Headers $headers) {
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod() {
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
*/
|
||||
public function setMethod($method) {
|
||||
$this->method = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath() {
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function setPath($path) {
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getGraphVersion() {
|
||||
return $this->graphVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
*/
|
||||
public function setGraphVersion($version) {
|
||||
$this->graphVersion = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getQueryParams() {
|
||||
if ($this->queryParams === null) {
|
||||
$this->queryParams = new Parameters();
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProtocol()
|
||||
{
|
||||
return $this->protocol;
|
||||
|
||||
return $this->queryParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setQueryParams(Parameters $params) {
|
||||
$this->queryParams = $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl() {
|
||||
$delimiter = null;
|
||||
if ($this->getQueryParams()->count() ) {
|
||||
$delimiter = strpos($this->getPath(), '?') ? '&' : '?';
|
||||
}
|
||||
/**
|
||||
* @param string $protocol
|
||||
*/
|
||||
public function setProtocol($protocol)
|
||||
{
|
||||
$this->protocol = $protocol;
|
||||
return $this->getProtocol().$this->getDomain()
|
||||
.'/v'.$this->getGraphVersion().$this->getPath()
|
||||
.$delimiter
|
||||
.http_build_query($this->getQueryParams()->export(), '', '&');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getBodyParams() {
|
||||
if ($this->bodyParams === null) {
|
||||
$this->bodyParams = new Parameters();
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain()
|
||||
{
|
||||
if ($this->domain === null) {
|
||||
$this->domain = \sprintf("%s.%s", \PYS_PRO_GLOBAL\FacebookAds\Http\Client::DEFAULT_LAST_LEVEL_DOMAIN, $this->client->getDefaultGraphBaseDomain());
|
||||
}
|
||||
return $this->domain;
|
||||
}
|
||||
/**
|
||||
* @param string $domain
|
||||
*/
|
||||
public function setDomain($domain)
|
||||
{
|
||||
$this->domain = $domain;
|
||||
}
|
||||
/**
|
||||
* @param string $last_level_domain
|
||||
*/
|
||||
public function setLastLevelDomain($last_level_domain)
|
||||
{
|
||||
$this->domain = \sprintf("%s.%s", $last_level_domain, $this->client->getDefaultGraphBaseDomain());
|
||||
}
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders()
|
||||
{
|
||||
if ($this->headers === null) {
|
||||
$this->headers = clone $this->getClient()->getDefaultRequestHeaderds();
|
||||
}
|
||||
return $this->headers;
|
||||
}
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(\PYS_PRO_GLOBAL\FacebookAds\Http\Headers $headers)
|
||||
{
|
||||
$this->headers = $headers;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
/**
|
||||
* @param string $method
|
||||
*/
|
||||
public function setMethod($method)
|
||||
{
|
||||
$this->method = $method;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getGraphVersion()
|
||||
{
|
||||
return $this->graphVersion;
|
||||
}
|
||||
/**
|
||||
* @param string $version
|
||||
*/
|
||||
public function setGraphVersion($version)
|
||||
{
|
||||
$this->graphVersion = $version;
|
||||
}
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getQueryParams()
|
||||
{
|
||||
if ($this->queryParams === null) {
|
||||
$this->queryParams = new \PYS_PRO_GLOBAL\FacebookAds\Http\Parameters();
|
||||
}
|
||||
return $this->queryParams;
|
||||
}
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setQueryParams(\PYS_PRO_GLOBAL\FacebookAds\Http\Parameters $params)
|
||||
{
|
||||
$this->queryParams = $params;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
$delimiter = null;
|
||||
if ($this->getQueryParams()->count()) {
|
||||
$delimiter = \strpos($this->getPath(), '?') ? '&' : '?';
|
||||
}
|
||||
return $this->getProtocol() . $this->getDomain() . '/v' . $this->getGraphVersion() . $this->getPath() . $delimiter . \http_build_query($this->getQueryParams()->export(), '', '&');
|
||||
}
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getBodyParams()
|
||||
{
|
||||
if ($this->bodyParams === null) {
|
||||
$this->bodyParams = new \PYS_PRO_GLOBAL\FacebookAds\Http\Parameters();
|
||||
}
|
||||
return $this->bodyParams;
|
||||
}
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setBodyParams(\PYS_PRO_GLOBAL\FacebookAds\Http\Parameters $params)
|
||||
{
|
||||
$this->bodyParams = $params;
|
||||
}
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getFileParams()
|
||||
{
|
||||
if ($this->fileParams === null) {
|
||||
$this->fileParams = new \PYS_PRO_GLOBAL\FacebookAds\Http\Parameters();
|
||||
}
|
||||
return $this->fileParams;
|
||||
}
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setFileParams(\PYS_PRO_GLOBAL\FacebookAds\Http\Parameters $params)
|
||||
{
|
||||
$this->fileParams = $params;
|
||||
}
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->getClient()->sendRequest($this);
|
||||
}
|
||||
/**
|
||||
* @return Request
|
||||
* @see RequestInterface::createClone()
|
||||
*/
|
||||
public function createClone()
|
||||
{
|
||||
return clone $this;
|
||||
|
||||
return $this->bodyParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setBodyParams(Parameters $params) {
|
||||
$this->bodyParams = $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getFileParams() {
|
||||
if ($this->fileParams === null) {
|
||||
$this->fileParams = new Parameters();
|
||||
}
|
||||
|
||||
return $this->fileParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setFileParams(Parameters $params) {
|
||||
$this->fileParams = $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function execute() {
|
||||
return $this->getClient()->sendRequest($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Request
|
||||
* @see RequestInterface::createClone()
|
||||
*/
|
||||
public function createClone() {
|
||||
return clone $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,121 +21,149 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
interface RequestInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_DELETE = 'DELETE';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_GET = 'GET';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_POST = 'POST';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_PUT = 'PUT';
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\Client $client);
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient();
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders();
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(\PYS_PRO_GLOBAL\FacebookAds\Http\Headers $headers);
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProtocol();
|
||||
/**
|
||||
* @param string $protocol
|
||||
*/
|
||||
public function setProtocol($protocol);
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain();
|
||||
/**
|
||||
* @param string $domain
|
||||
*/
|
||||
public function setDomain($domain);
|
||||
/**
|
||||
* @param string $last_level_domain
|
||||
*/
|
||||
public function setLastLevelDomain($last_level_domain);
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod();
|
||||
/**
|
||||
* @param string $method
|
||||
*/
|
||||
public function setMethod($method);
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath();
|
||||
/**
|
||||
* @param string $version
|
||||
*/
|
||||
public function setGraphVersion($version);
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGraphVersion();
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function setPath($path);
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getQueryParams();
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setQueryParams(\PYS_PRO_GLOBAL\FacebookAds\Http\Parameters $params);
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl();
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getBodyParams();
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setBodyParams(\PYS_PRO_GLOBAL\FacebookAds\Http\Parameters $params);
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getFileParams();
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setFileParams(\PYS_PRO_GLOBAL\FacebookAds\Http\Parameters $params);
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function execute();
|
||||
/**
|
||||
* Required for Mocking request/response chaining
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function createClone();
|
||||
interface RequestInterface {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_DELETE = 'DELETE';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_GET = 'GET';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_POST = 'POST';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_PUT = 'PUT';
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(Client $client);
|
||||
|
||||
/**
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient();
|
||||
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders();
|
||||
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(Headers $headers);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProtocol();
|
||||
|
||||
/**
|
||||
* @param string $protocol
|
||||
*/
|
||||
public function setProtocol($protocol);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain();
|
||||
|
||||
/**
|
||||
* @param string $domain
|
||||
*/
|
||||
public function setDomain($domain);
|
||||
|
||||
/**
|
||||
* @param string $last_level_domain
|
||||
*/
|
||||
public function setLastLevelDomain($last_level_domain);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod();
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
*/
|
||||
public function setMethod($method);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath();
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
*/
|
||||
public function setGraphVersion($version);
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGraphVersion();
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function setPath($path);
|
||||
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getQueryParams();
|
||||
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setQueryParams(Parameters $params);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl();
|
||||
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getBodyParams();
|
||||
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setBodyParams(Parameters $params);
|
||||
|
||||
/**
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getFileParams();
|
||||
|
||||
/**
|
||||
* @param Parameters $params
|
||||
*/
|
||||
public function setFileParams(Parameters $params);
|
||||
|
||||
/**
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function execute();
|
||||
|
||||
/**
|
||||
* Required for Mocking request/response chaining
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function createClone();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,98 +21,105 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
class Response implements \PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface
|
||||
{
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
protected $request;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $statusCode;
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $headers;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $body;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $content;
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
class Response implements ResponseInterface {
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $statusCode;
|
||||
|
||||
/**
|
||||
* @var Headers
|
||||
*/
|
||||
protected $headers;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $body;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $content;
|
||||
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function getRequest() {
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
*/
|
||||
public function setRequest(RequestInterface $request) {
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStatusCode() {
|
||||
return $this->statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $status_code
|
||||
*/
|
||||
public function setStatusCode($status_code) {
|
||||
$this->statusCode = $status_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders() {
|
||||
if ($this->headers === null) {
|
||||
$this->headers = new Headers();
|
||||
}
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
*/
|
||||
public function setRequest(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStatusCode()
|
||||
{
|
||||
return $this->statusCode;
|
||||
}
|
||||
/**
|
||||
* @param int $status_code
|
||||
*/
|
||||
public function setStatusCode($status_code)
|
||||
{
|
||||
$this->statusCode = $status_code;
|
||||
}
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders()
|
||||
{
|
||||
if ($this->headers === null) {
|
||||
$this->headers = new \PYS_PRO_GLOBAL\FacebookAds\Http\Headers();
|
||||
}
|
||||
return $this->headers;
|
||||
}
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(\PYS_PRO_GLOBAL\FacebookAds\Http\Headers $headers)
|
||||
{
|
||||
$this->headers = $headers;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBody()
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
/**
|
||||
* @param string $body
|
||||
*/
|
||||
public function setBody($body)
|
||||
{
|
||||
$this->body = $body;
|
||||
$this->content = null;
|
||||
}
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if ($this->content === null) {
|
||||
$this->content = \json_decode($this->getBody(), \true);
|
||||
}
|
||||
return $this->content;
|
||||
|
||||
return $this->headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(Headers $headers) {
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBody() {
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $body
|
||||
*/
|
||||
public function setBody($body) {
|
||||
$this->body = $body;
|
||||
$this->content = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getContent() {
|
||||
if ($this->content === null) {
|
||||
$this->content = json_decode($this->getBody(), true);
|
||||
}
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,44 +21,53 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
interface ResponseInterface
|
||||
{
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function getRequest();
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
*/
|
||||
public function setRequest(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request);
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStatusCode();
|
||||
/**
|
||||
* @param int $status_code
|
||||
*/
|
||||
public function setStatusCode($status_code);
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders();
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(\PYS_PRO_GLOBAL\FacebookAds\Http\Headers $headers);
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBody();
|
||||
/**
|
||||
* @param string $body
|
||||
*/
|
||||
public function setBody($body);
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getContent();
|
||||
interface ResponseInterface {
|
||||
|
||||
/**
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function getRequest();
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
*/
|
||||
public function setRequest(RequestInterface $request);
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStatusCode();
|
||||
|
||||
/**
|
||||
* @param int $status_code
|
||||
*/
|
||||
public function setStatusCode($status_code);
|
||||
|
||||
/**
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders();
|
||||
|
||||
/**
|
||||
* @param Headers $headers
|
||||
*/
|
||||
public function setHeaders(Headers $headers);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBody();
|
||||
|
||||
/**
|
||||
* @param string $body
|
||||
*/
|
||||
public function setBody($body);
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getContent();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,42 +21,54 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
class SimpleRequest extends \PYS_PRO_GLOBAL\FacebookAds\Http\Request
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_WWWW_BASE_DOMAIN = 'connect.facebook.net';
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(\PYS_PRO_GLOBAL\FacebookAds\Http\Client $client)
|
||||
{
|
||||
parent::__construct($client);
|
||||
//Setting the curl options inside the client to avoid SSL certificates usage
|
||||
$client->getAdapter()->setOpts(new \ArrayObject(array(\CURLOPT_CONNECTTIMEOUT => 10, \CURLOPT_TIMEOUT => 60, \CURLOPT_RETURNTRANSFER => \true, \CURLOPT_HEADER => \true, \CURLOPT_SSL_VERIFYPEER => 0)));
|
||||
class SimpleRequest extends Request{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_WWWW_BASE_DOMAIN = 'connect.facebook.net';
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(Client $client) {
|
||||
parent::__construct($client);
|
||||
//Setting the curl options inside the client to avoid SSL certificates usage
|
||||
$client -> getAdapter()->setOpts( new \ArrayObject(array(
|
||||
CURLOPT_CONNECTTIMEOUT => 10,
|
||||
CURLOPT_TIMEOUT => 60,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain() {
|
||||
if ($this->domain === null) {
|
||||
$this->domain = sprintf(
|
||||
"%s",
|
||||
self::DEFAULT_WWWW_BASE_DOMAIN);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain()
|
||||
{
|
||||
if ($this->domain === null) {
|
||||
$this->domain = \sprintf("%s", self::DEFAULT_WWWW_BASE_DOMAIN);
|
||||
}
|
||||
return $this->domain;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
$delimiter = null;
|
||||
if ($this->getQueryParams()->count()) {
|
||||
$delimiter = \strpos($this->getPath(), '?') ? '&' : '?';
|
||||
}
|
||||
return $this->getProtocol() . $this->getDomain() . '/' . $this->getPath() . $delimiter . \http_build_query($this->getQueryParams()->export(), '', '&');
|
||||
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl() {
|
||||
$delimiter = null;
|
||||
if ($this->getQueryParams()->count() ) {
|
||||
$delimiter = strpos($this->getPath(), '?') ? '&' : '?';
|
||||
}
|
||||
return $this->getProtocol().$this->getDomain()
|
||||
.'/'.$this->getPath()
|
||||
.$delimiter
|
||||
.http_build_query($this->getQueryParams()->export(), '', '&');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,27 +21,28 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Http;
|
||||
|
||||
abstract class Util
|
||||
{
|
||||
/**
|
||||
* Avoid parse_str() for HHVM compatibility
|
||||
* This implementation is not a complete sobstitute, but covers all the
|
||||
* requirements of the Facebook Graph Cursor.
|
||||
*
|
||||
* @see hhvm.hack.disallow_dynamic_var_env_funcs
|
||||
* @param $query_string
|
||||
* @return array
|
||||
*/
|
||||
public static function parseUrlQuery($query_string)
|
||||
{
|
||||
$query = array();
|
||||
$pairs = \explode('&', $query_string);
|
||||
foreach ($pairs as $pair) {
|
||||
list($key, $value) = \explode('=', $pair);
|
||||
$query[$key] = \urldecode($value);
|
||||
}
|
||||
return $query;
|
||||
abstract class Util {
|
||||
|
||||
/**
|
||||
* Avoid parse_str() for HHVM compatibility
|
||||
* This implementation is not a complete sobstitute, but covers all the
|
||||
* requirements of the Facebook Graph Cursor.
|
||||
*
|
||||
* @see hhvm.hack.disallow_dynamic_var_env_funcs
|
||||
* @param $query_string
|
||||
* @return array
|
||||
*/
|
||||
public static function parseUrlQuery($query_string) {
|
||||
$query = array();
|
||||
$pairs = explode('&', $query_string);
|
||||
foreach ($pairs as $pair) {
|
||||
list($key, $value) = explode('=', $pair);
|
||||
$query[$key] = urldecode($value);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Logger;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\FileParameter;
|
||||
@@ -29,210 +29,248 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\Parameters;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Logger\CurlLogger\JsonAwareParameters;
|
||||
class CurlLogger implements \PYS_PRO_GLOBAL\FacebookAds\Logger\LoggerInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PARAM_DEFAULT_FLAG = 'd';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PARAM_URLENCODE_FLAG = '-data-urlencode';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PARAM_POST_FLAG = 'F';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_DEFAULT_FLAG = '';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_GET_FLAG = 'G';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_PUT_FLAG = 'X PUT';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_DELETE_FLAG = 'X DELETE';
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $handle;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $jsonPrettyPrint = \false;
|
||||
/**
|
||||
* @param resource $handle
|
||||
*/
|
||||
public function __construct($handle = null)
|
||||
{
|
||||
if (!\defined('STDOUT')) {
|
||||
\define('STDOUT', \fopen('php://stdout', 'w'));
|
||||
}
|
||||
$this->handle = \is_resource($handle) ? $handle : \STDOUT;
|
||||
|
||||
class CurlLogger implements LoggerInterface {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PARAM_DEFAULT_FLAG = 'd';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PARAM_URLENCODE_FLAG = '-data-urlencode';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PARAM_POST_FLAG = 'F';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_DEFAULT_FLAG = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_GET_FLAG = 'G';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_PUT_FLAG = 'X PUT';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const METHOD_DELETE_FLAG = 'X DELETE';
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $handle;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $jsonPrettyPrint = false;
|
||||
|
||||
/**
|
||||
* @param resource $handle
|
||||
*/
|
||||
public function __construct($handle = null) {
|
||||
if (!defined('STDOUT')) {
|
||||
define('STDOUT', fopen('php://stdout', 'w'));
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isJsonPrettyPrint()
|
||||
{
|
||||
return $this->jsonPrettyPrint;
|
||||
$this->handle = is_resource($handle) ? $handle : STDOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isJsonPrettyPrint() {
|
||||
return $this->jsonPrettyPrint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $json_pretty_print
|
||||
* @return $this
|
||||
*/
|
||||
public function setJsonPrettyPrint($json_pretty_print) {
|
||||
$this->jsonPrettyPrint = $json_pretty_print;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @return string
|
||||
*/
|
||||
public static function getMethodFlag($method) {
|
||||
switch ($method) {
|
||||
case RequestInterface::METHOD_GET:
|
||||
return static::METHOD_GET_FLAG;
|
||||
case RequestInterface::METHOD_PUT:
|
||||
return static::METHOD_PUT_FLAG;
|
||||
case RequestInterface::METHOD_DELETE:
|
||||
return static::METHOD_DELETE_FLAG;
|
||||
}
|
||||
/**
|
||||
* @param bool $json_pretty_print
|
||||
* @return $this
|
||||
*/
|
||||
public function setJsonPrettyPrint($json_pretty_print)
|
||||
{
|
||||
$this->jsonPrettyPrint = $json_pretty_print;
|
||||
return $this;
|
||||
|
||||
return static::METHOD_DEFAULT_FLAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function getParamFlag($method, $value) {
|
||||
return $method === RequestInterface::METHOD_POST
|
||||
? static::PARAM_POST_FLAG
|
||||
: (strstr($value, "\n")
|
||||
? static::PARAM_URLENCODE_FLAG
|
||||
: static::PARAM_DEFAULT_FLAG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
protected function indent($string, $indent) {
|
||||
return str_replace("\n", " \n".str_repeat(' ', $indent), $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parameters $params
|
||||
* @param string $method
|
||||
* @param bool $is_file
|
||||
* @return string
|
||||
*/
|
||||
protected function processParams(Parameters $params, $method, $is_file) {
|
||||
$chunks = array();
|
||||
if ($this->isJsonPrettyPrint()) {
|
||||
$params = new JsonAwareParameters($params);
|
||||
}
|
||||
/**
|
||||
* @param string $method
|
||||
* @return string
|
||||
*/
|
||||
public static function getMethodFlag($method)
|
||||
{
|
||||
switch ($method) {
|
||||
case \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET:
|
||||
return static::METHOD_GET_FLAG;
|
||||
case \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_PUT:
|
||||
return static::METHOD_PUT_FLAG;
|
||||
case \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_DELETE:
|
||||
return static::METHOD_DELETE_FLAG;
|
||||
}
|
||||
return static::METHOD_DEFAULT_FLAG;
|
||||
foreach ($params->export() as $name => $value) {
|
||||
if ($is_file && $params->offsetGet($name) instanceof FileParameter) {
|
||||
$value = "@" . $this->normalizeFileParam($params->offsetGet($name));
|
||||
} else {
|
||||
$value = addcslashes(
|
||||
strpos($value, "\n") !== false
|
||||
? $this->indent($value, 2)
|
||||
: $value,
|
||||
'\'');
|
||||
}
|
||||
$chunks[$name] = sprintf(
|
||||
'-%s \'%s=%s\'',
|
||||
$this->getParamFlag($method, $value),
|
||||
$name,
|
||||
$value);
|
||||
}
|
||||
/**
|
||||
* @param string $method
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function getParamFlag($method, $value)
|
||||
{
|
||||
return $method === \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST ? static::PARAM_POST_FLAG : (\strstr($value, "\n") ? static::PARAM_URLENCODE_FLAG : static::PARAM_DEFAULT_FLAG);
|
||||
|
||||
return $chunks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FileParameter $file_param
|
||||
* @return string
|
||||
*/
|
||||
protected function normalizeFileParam(FileParameter $file_param) {
|
||||
return sprintf('%s%s%s%s%s',
|
||||
$file_param->getPath(),
|
||||
$file_param->getMimeType() != null ? ";type=" : "",
|
||||
$file_param->getMimeType(),
|
||||
$file_param->getName() != null ? ";name=" : "",
|
||||
$file_param->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return string
|
||||
*/
|
||||
protected function processUrl(RequestInterface $request) {
|
||||
return $request->getProtocol().$request->getDomain()
|
||||
.'/v'.$request->getGraphVersion().$request->getPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $buffer
|
||||
*/
|
||||
protected function flush($buffer) {
|
||||
fwrite($this->handle, $buffer.PHP_EOL.PHP_EOL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*/
|
||||
public function log($level, $message, array $context = array()) {
|
||||
// We only care about requests
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
protected function removeArrayKey(array &$array, $key) {
|
||||
if (array_key_exists($key, $array)) {
|
||||
$value = $array[$key];
|
||||
unset($array[$key]);
|
||||
return $value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param string $string
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
protected function indent($string, $indent)
|
||||
{
|
||||
return \str_replace("\n", " \n" . \str_repeat(' ', $indent), $string);
|
||||
}
|
||||
/**
|
||||
* @param Parameters $params
|
||||
* @param string $method
|
||||
* @param bool $is_file
|
||||
* @return string
|
||||
*/
|
||||
protected function processParams(\PYS_PRO_GLOBAL\FacebookAds\Http\Parameters $params, $method, $is_file)
|
||||
{
|
||||
$chunks = array();
|
||||
if ($this->isJsonPrettyPrint()) {
|
||||
$params = new \PYS_PRO_GLOBAL\FacebookAds\Logger\CurlLogger\JsonAwareParameters($params);
|
||||
}
|
||||
foreach ($params->export() as $name => $value) {
|
||||
if ($is_file && $params->offsetGet($name) instanceof \PYS_PRO_GLOBAL\FacebookAds\Http\FileParameter) {
|
||||
$value = "@" . $this->normalizeFileParam($params->offsetGet($name));
|
||||
} else {
|
||||
$value = \addcslashes(\strpos($value, "\n") !== \false ? $this->indent($value, 2) : $value, '\'');
|
||||
}
|
||||
$chunks[$name] = \sprintf('-%s \'%s=%s\'', $this->getParamFlag($method, $value), $name, $value);
|
||||
}
|
||||
return $chunks;
|
||||
}
|
||||
/**
|
||||
* @param FileParameter $file_param
|
||||
* @return string
|
||||
*/
|
||||
protected function normalizeFileParam(\PYS_PRO_GLOBAL\FacebookAds\Http\FileParameter $file_param)
|
||||
{
|
||||
return \sprintf('%s%s%s%s%s', $file_param->getPath(), $file_param->getMimeType() != null ? ";type=" : "", $file_param->getMimeType(), $file_param->getName() != null ? ";name=" : "", $file_param->getName());
|
||||
}
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return string
|
||||
*/
|
||||
protected function processUrl(\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request)
|
||||
{
|
||||
return $request->getProtocol() . $request->getDomain() . '/v' . $request->getGraphVersion() . $request->getPath();
|
||||
}
|
||||
/**
|
||||
* @param string $buffer
|
||||
*/
|
||||
protected function flush($buffer)
|
||||
{
|
||||
\fwrite($this->handle, $buffer . \PHP_EOL . \PHP_EOL);
|
||||
}
|
||||
/**
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*/
|
||||
public function log($level, $message, array $context = array())
|
||||
{
|
||||
// We only care about requests
|
||||
}
|
||||
/**
|
||||
* @param array $array
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
protected function removeArrayKey(array &$array, $key)
|
||||
{
|
||||
if (\array_key_exists($key, $array)) {
|
||||
$value = $array[$key];
|
||||
unset($array[$key]);
|
||||
return $value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
protected function sortParams(array $params)
|
||||
{
|
||||
$access_token = $this->removeArrayKey($params, 'access_token');
|
||||
$appsecret_proof = $this->removeArrayKey($params, 'appsecret_proof');
|
||||
$access_token !== null && ($params['access_token'] = $access_token);
|
||||
$appsecret_proof !== null && ($params['appsecret_proof'] = $appsecret_proof);
|
||||
return $params;
|
||||
}
|
||||
/**
|
||||
* @param string $level
|
||||
* @param RequestInterface $request
|
||||
* @param array $context
|
||||
*/
|
||||
public function logRequest($level, \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request, array $context = array())
|
||||
{
|
||||
$new_line = ' \\' . \PHP_EOL . ' ';
|
||||
$method = $request->getMethod();
|
||||
$method_flag = static::getMethodFlag($method);
|
||||
$params = $this->sortParams(\array_merge($this->processParams($request->getQueryParams(), $method, \false), $this->processParams($request->getBodyParams(), $method, \false), $this->processParams($request->getFileParams(), $method, \true)));
|
||||
$buffer = 'curl' . ($method_flag ? ' -' . $method_flag : '');
|
||||
foreach ($params as $param) {
|
||||
$buffer .= $new_line . $param;
|
||||
}
|
||||
$buffer .= $new_line . $this->processUrl($request);
|
||||
$this->flush($buffer);
|
||||
}
|
||||
/**
|
||||
* @param string $level
|
||||
* @param ResponseInterface $response
|
||||
* @param array $context
|
||||
*/
|
||||
public function logResponse($level, \PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response, array $context = array())
|
||||
{
|
||||
// We only care about requests
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
protected function sortParams(array $params) {
|
||||
$access_token = $this->removeArrayKey($params, 'access_token');
|
||||
$appsecret_proof = $this->removeArrayKey($params, 'appsecret_proof');
|
||||
$access_token !== null && $params['access_token'] = $access_token;
|
||||
$appsecret_proof !== null && $params['appsecret_proof'] = $appsecret_proof;
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param RequestInterface $request
|
||||
* @param array $context
|
||||
*/
|
||||
public function logRequest(
|
||||
$level, RequestInterface $request, array $context = array()) {
|
||||
|
||||
$new_line = ' \\'.PHP_EOL.' ';
|
||||
$method = $request->getMethod();
|
||||
$method_flag = static::getMethodFlag($method);
|
||||
$params = $this->sortParams(array_merge(
|
||||
$this->processParams($request->getQueryParams(), $method, false),
|
||||
$this->processParams($request->getBodyParams(), $method, false),
|
||||
$this->processParams($request->getFileParams(), $method, true)));
|
||||
|
||||
$buffer = 'curl'.($method_flag ? ' -'.$method_flag : '');
|
||||
foreach ($params as $param) {
|
||||
$buffer .= $new_line.$param;
|
||||
}
|
||||
$buffer .= $new_line.$this->processUrl($request);
|
||||
|
||||
$this->flush($buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param ResponseInterface $response
|
||||
* @param array $context
|
||||
*/
|
||||
public function logResponse(
|
||||
$level, ResponseInterface $response, array $context = array()) {
|
||||
// We only care about requests
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,17 +21,18 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Logger\CurlLogger;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Parameters;
|
||||
class JsonAwareParameters extends \PYS_PRO_GLOBAL\FacebookAds\Http\Parameters
|
||||
{
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
protected function exportNonScalar($value)
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Logger\CurlLogger\JsonNode::factory($value)->encode();
|
||||
}
|
||||
|
||||
class JsonAwareParameters extends Parameters {
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
protected function exportNonScalar($value) {
|
||||
return JsonNode::factory($value)->encode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,152 +21,176 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Logger\CurlLogger;
|
||||
|
||||
final class JsonNode
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const INDENT_UNIT = 2;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const EXPLOSION_THRESHOLD = 78;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $value;
|
||||
/**
|
||||
* @var \ArrayObject
|
||||
*/
|
||||
protected $children;
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function factory($value)
|
||||
{
|
||||
$object = new self();
|
||||
switch (\true) {
|
||||
case \is_object($value):
|
||||
$value = (array) $value;
|
||||
// fallthrough
|
||||
case \is_array($value):
|
||||
foreach ($value as $key => $sub) {
|
||||
$object->getChildren()->offsetSet($key, self::factory($sub));
|
||||
}
|
||||
// fallthrough
|
||||
case \is_null($value) || \is_scalar($value):
|
||||
$object->setValue($value);
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(\gettype($value) . ' can\'t be encoded');
|
||||
final class JsonNode {
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const INDENT_UNIT = 2;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const EXPLOSION_THRESHOLD = 78;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* @var \ArrayObject
|
||||
*/
|
||||
protected $children;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function factory($value) {
|
||||
$object = new self();
|
||||
switch (true) {
|
||||
case is_object($value):
|
||||
$value = (array) $value;
|
||||
// fallthrough
|
||||
case is_array($value):
|
||||
foreach ($value as $key => $sub) {
|
||||
$object->getChildren()->offsetSet($key, self::factory($sub));
|
||||
}
|
||||
return $object;
|
||||
// fallthrough
|
||||
case is_null($value) || is_scalar($value):
|
||||
$object->setValue($value);
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(
|
||||
gettype($value).' can\'t be encoded');
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new \ArrayObject();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
$this->children = new \ArrayObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value) {
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayObject
|
||||
*/
|
||||
public function getChildren() {
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxTreeChildrenCount() {
|
||||
$max = $this->getChildren()->count();
|
||||
|
||||
/** @var JsonNode $child */
|
||||
foreach ($this->getChildren() as $child) {
|
||||
$ith = $child->getMaxTreeChildrenCount();
|
||||
$max = $ith > $max ? $ith : $max;
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
|
||||
return $max;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
protected function getPadding($indent) {
|
||||
return str_repeat(' ', $indent * self::INDENT_UNIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getLastChildKey() {
|
||||
if ($this->getChildren()->count() === 0) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
|
||||
$copy = $this->getChildren()->getArrayCopy();
|
||||
end($copy);
|
||||
|
||||
return key($copy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
protected function encodeList($indent) {
|
||||
$value = $this->getValue();
|
||||
if (empty($value) || (array_keys($value) === range(0, count($value) - 1))) {
|
||||
$is_map = false;
|
||||
} else {
|
||||
$is_map = true;
|
||||
}
|
||||
/**
|
||||
* @return \ArrayObject
|
||||
*/
|
||||
public function getChildren()
|
||||
{
|
||||
return $this->children;
|
||||
|
||||
++$indent;
|
||||
$last_key = $this->getLastChildKey();
|
||||
|
||||
$buffer = ($is_map ? '{' : '[')."\n";
|
||||
|
||||
/** @var JsonNode $child */
|
||||
foreach ($this->getChildren() as $key => $child) {
|
||||
$buffer .= sprintf(
|
||||
"%s%s%s%s\n",
|
||||
$this->getPadding($indent),
|
||||
$is_map ? sprintf("%s: ", json_encode($key)) : '',
|
||||
$child->encode($indent),
|
||||
$key === $last_key ? '' : ',');
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxTreeChildrenCount()
|
||||
{
|
||||
$max = $this->getChildren()->count();
|
||||
/** @var JsonNode $child */
|
||||
foreach ($this->getChildren() as $child) {
|
||||
$ith = $child->getMaxTreeChildrenCount();
|
||||
$max = $ith > $max ? $ith : $max;
|
||||
}
|
||||
return $max;
|
||||
}
|
||||
/**
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
protected function getPadding($indent)
|
||||
{
|
||||
return \str_repeat(' ', $indent * self::INDENT_UNIT);
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getLastChildKey()
|
||||
{
|
||||
if ($this->getChildren()->count() === 0) {
|
||||
return null;
|
||||
}
|
||||
$copy = $this->getChildren()->getArrayCopy();
|
||||
\end($copy);
|
||||
return \key($copy);
|
||||
}
|
||||
/**
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
protected function encodeList($indent)
|
||||
{
|
||||
$value = $this->getValue();
|
||||
if (empty($value) || \array_keys($value) === \range(0, \count($value) - 1)) {
|
||||
$is_map = \false;
|
||||
} else {
|
||||
$is_map = \true;
|
||||
}
|
||||
++$indent;
|
||||
$last_key = $this->getLastChildKey();
|
||||
$buffer = ($is_map ? '{' : '[') . "\n";
|
||||
/** @var JsonNode $child */
|
||||
foreach ($this->getChildren() as $key => $child) {
|
||||
$buffer .= \sprintf("%s%s%s%s\n", $this->getPadding($indent), $is_map ? \sprintf("%s: ", \json_encode($key)) : '', $child->encode($indent), $key === $last_key ? '' : ',');
|
||||
}
|
||||
--$indent;
|
||||
$buffer .= $this->getPadding($indent) . ($is_map ? '}' : ']');
|
||||
return $buffer;
|
||||
}
|
||||
/**
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
public function encode($indent = 0)
|
||||
{
|
||||
$value = $this->getValue();
|
||||
if (\is_array($value) || \is_object($value)) {
|
||||
if ($this->getMaxTreeChildrenCount() > 2) {
|
||||
return $this->encodeList($indent);
|
||||
}
|
||||
$ugly = \json_encode($value);
|
||||
$output_prediction = $this->getPadding($indent) . $ugly;
|
||||
if (\strlen($output_prediction) > self::EXPLOSION_THRESHOLD) {
|
||||
return $this->encodeList($indent);
|
||||
}
|
||||
return $ugly;
|
||||
}
|
||||
return \json_encode($value);
|
||||
|
||||
--$indent;
|
||||
$buffer .= $this->getPadding($indent).($is_map ? '}' : ']');
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $indent
|
||||
* @return string
|
||||
*/
|
||||
public function encode($indent = 0) {
|
||||
$value = $this->getValue();
|
||||
if (is_array($value) || is_object($value)) {
|
||||
if ($this->getMaxTreeChildrenCount() > 2) {
|
||||
return $this->encodeList($indent);
|
||||
}
|
||||
|
||||
$ugly = json_encode($value);
|
||||
$output_prediction = $this->getPadding($indent).$ugly;
|
||||
if (strlen($output_prediction) > self::EXPLOSION_THRESHOLD) {
|
||||
return $this->encodeList($indent);
|
||||
}
|
||||
|
||||
return $ugly;
|
||||
}
|
||||
|
||||
return json_encode($value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,28 +21,34 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Logger;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
interface LoggerInterface
|
||||
{
|
||||
/**
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*/
|
||||
public function log($level, $message, array $context = array());
|
||||
/**
|
||||
* @param string $level
|
||||
* @param RequestInterface $request
|
||||
* @param array $context
|
||||
*/
|
||||
public function logRequest($level, \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request, array $context = array());
|
||||
/**
|
||||
* @param string $level
|
||||
* @param ResponseInterface $response
|
||||
* @param array $context
|
||||
*/
|
||||
public function logResponse($level, \PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response, array $context = array());
|
||||
|
||||
interface LoggerInterface {
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*/
|
||||
public function log($level, $message, array $context = array());
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param RequestInterface $request
|
||||
* @param array $context
|
||||
*/
|
||||
public function logRequest(
|
||||
$level, RequestInterface $request, array $context = array());
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param ResponseInterface $response
|
||||
* @param array $context
|
||||
*/
|
||||
public function logResponse(
|
||||
$level, ResponseInterface $response, array $context = array());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,34 +21,40 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Logger;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
class NullLogger implements \PYS_PRO_GLOBAL\FacebookAds\Logger\LoggerInterface
|
||||
{
|
||||
/**
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*/
|
||||
public function log($level, $message, array $context = array())
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @param string $level
|
||||
* @param RequestInterface $request
|
||||
* @param array $context
|
||||
*/
|
||||
public function logRequest($level, \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface $request, array $context = array())
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @param string $level
|
||||
* @param ResponseInterface $response
|
||||
* @param array $context
|
||||
*/
|
||||
public function logResponse($level, \PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface $response, array $context = array())
|
||||
{
|
||||
}
|
||||
|
||||
class NullLogger implements LoggerInterface {
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*/
|
||||
public function log($level, $message, array $context = array()) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param RequestInterface $request
|
||||
* @param array $context
|
||||
*/
|
||||
public function logRequest(
|
||||
$level, RequestInterface $request, array $context = array()) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $level
|
||||
* @param ResponseInterface $response
|
||||
* @param array $context
|
||||
*/
|
||||
public function logResponse(
|
||||
$level, ResponseInterface $response, array $context = array()) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AREffectsBatchStatusFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AREffectsBatchStatusFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AREffectsBatchStatus extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AREffectsBatchStatusFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AREffectsBatchStatusFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AREffectsBatchStatus extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AREffectsBatchStatusFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AREffectsBatchStatusFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,58 +21,72 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
abstract class AbstractArchivableCrudObject extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_PARAM_NAME = 'status';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_ACTIVE = 'ACTIVE';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_PAUSED = 'PAUSED';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_DELETED = 'DELETED';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_ARCHIVED = 'ARCHIVED';
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusParamName()
|
||||
{
|
||||
return self::STATUS_PARAM_NAME;
|
||||
}
|
||||
/**
|
||||
* Archive this object
|
||||
*
|
||||
* @deprecated use api_update instead
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function archive(array $params = array())
|
||||
{
|
||||
$this->getApi()->call($this->getNodePath(), \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, \array_merge($params, array($this->getStatusParamName() => static::STATUS_ARCHIVED)));
|
||||
}
|
||||
/**
|
||||
* Delete this object
|
||||
*
|
||||
* @deprecated use api_update instead
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function delete(array $params = array())
|
||||
{
|
||||
$this->getApi()->call($this->getNodePath(), \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, \array_merge($params, array($this->getStatusParamName() => static::STATUS_DELETED)));
|
||||
}
|
||||
|
||||
abstract class AbstractArchivableCrudObject extends AbstractCrudObject {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_PARAM_NAME = 'status';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_ACTIVE = 'ACTIVE';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_PAUSED = 'PAUSED';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_DELETED = 'DELETED';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUS_ARCHIVED = 'ARCHIVED';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusParamName() {
|
||||
return self::STATUS_PARAM_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive this object
|
||||
*
|
||||
* @deprecated use api_update instead
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function archive(array $params = array()) {
|
||||
$this->getApi()->call(
|
||||
$this->getNodePath(),
|
||||
RequestInterface::METHOD_POST,
|
||||
array_merge($params, array(
|
||||
$this->getStatusParamName() => static::STATUS_ARCHIVED)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete this object
|
||||
*
|
||||
* @deprecated use api_update instead
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function delete(array $params = array()) {
|
||||
$this->getApi()->call(
|
||||
$this->getNodePath(),
|
||||
RequestInterface::METHOD_POST,
|
||||
array_merge($params, array(
|
||||
$this->getStatusParamName() => static::STATUS_DELETED)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -23,466 +22,510 @@
|
||||
*
|
||||
*/
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Api;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\ResponseInterface;
|
||||
class AbstractCrudObject extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const FIELD_ID = 'id';
|
||||
/**
|
||||
* @var string[] set of fields to read by default
|
||||
*/
|
||||
protected static $defaultReadFields = array();
|
||||
/**
|
||||
* @var array set of fields that have been mutated
|
||||
*/
|
||||
protected $changedFields = array();
|
||||
/**
|
||||
* @var Api instance of the Api used by this object
|
||||
*/
|
||||
protected $api;
|
||||
/**
|
||||
* @var string ID of the adaccount this object belongs to
|
||||
*/
|
||||
protected $parentId;
|
||||
/**
|
||||
* @deprecated deprecate constructor with null and parent_id
|
||||
* @param string $id Optional (do not set for new objects)
|
||||
* @param string $parent_id Optional, needed for creating new objects.
|
||||
* @param Api $api The Api instance this object should use to make calls
|
||||
*/
|
||||
public function __construct($id = null, $parent_id = null, \PYS_PRO_GLOBAL\FacebookAds\Api $api = null)
|
||||
{
|
||||
parent::__construct();
|
||||
// check that $id is an integer or a string integer or a string of
|
||||
// two integer connected by an underscore, like "123_456"
|
||||
$int_id = $id;
|
||||
if (\strpos($id, 'act_') === 0) {
|
||||
$int_id = \substr($id, 4);
|
||||
}
|
||||
$split_by_underscore = \explode('_', (string) $id);
|
||||
$is_regular_id = \sizeof($split_by_underscore) == 2 && \ctype_digit($split_by_underscore[0]) && \ctype_digit($split_by_underscore[1]);
|
||||
if (!\is_null($int_id) && !\ctype_digit((string) $int_id) && !$is_regular_id) {
|
||||
$extra_message = '';
|
||||
if (\is_numeric($int_id)) {
|
||||
$extra_message = ' Please use an integer string' . ' to prevent integer overflow.';
|
||||
}
|
||||
throw new \InvalidArgumentException('Object ID must be an integer or integer string but was passed "' . (string) $id . '" (' . \gettype($id) . ').' . (string) $extra_message);
|
||||
}
|
||||
$this->data[static::FIELD_ID] = $id;
|
||||
if (!\is_null($parent_id)) {
|
||||
$warning_message = "\$parent_id as a parameter of constructor is being " . "deprecated, please try not to use this in new code.\n";
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
}
|
||||
$this->parentId = $parent_id;
|
||||
$this->api = static::assureApi($api);
|
||||
class AbstractCrudObject extends AbstractObject {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const FIELD_ID = 'id';
|
||||
/**
|
||||
* @var string[] set of fields to read by default
|
||||
*/
|
||||
protected static $defaultReadFields = array();
|
||||
/**
|
||||
* @var array set of fields that have been mutated
|
||||
*/
|
||||
protected $changedFields = array();
|
||||
/**
|
||||
* @var Api instance of the Api used by this object
|
||||
*/
|
||||
protected $api;
|
||||
/**
|
||||
* @var string ID of the adaccount this object belongs to
|
||||
*/
|
||||
protected $parentId;
|
||||
|
||||
/**
|
||||
* @deprecated deprecate constructor with null and parent_id
|
||||
* @param string $id Optional (do not set for new objects)
|
||||
* @param string $parent_id Optional, needed for creating new objects.
|
||||
* @param Api $api The Api instance this object should use to make calls
|
||||
*/
|
||||
public function __construct($id = null, $parent_id = null, Api $api = null) {
|
||||
parent::__construct();
|
||||
|
||||
// check that $id is an integer or a string integer or a string of
|
||||
// two integer connected by an underscore, like "123_456"
|
||||
|
||||
$int_id = $id;
|
||||
if ($id !== null && strpos($id, 'act_') === 0) {
|
||||
$int_id = substr($id, 4);
|
||||
}
|
||||
/**
|
||||
* @param string $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->data[static::FIELD_ID] = $id;
|
||||
return $this;
|
||||
$split_by_underscore = explode('_', (string) $id);
|
||||
$is_regular_id = sizeof($split_by_underscore) == 2 &&
|
||||
ctype_digit($split_by_underscore[0]) &&
|
||||
ctype_digit($split_by_underscore[1]);
|
||||
if (!is_null($int_id) && !ctype_digit((string) $int_id) && !$is_regular_id) {
|
||||
$extra_message = '';
|
||||
if (is_numeric($int_id)) {
|
||||
$extra_message = ' Please use an integer string'
|
||||
.' to prevent integer overflow.';
|
||||
}
|
||||
throw new \InvalidArgumentException(
|
||||
'Object ID must be an integer or integer string but was passed "'
|
||||
.(string)$id.'" ('.gettype($id).').'.(string)$extra_message);
|
||||
}
|
||||
/**
|
||||
* @deprecated deprecate parent_id in AbstractCrudObject
|
||||
* @param string $parent_id
|
||||
*/
|
||||
public function setParentId($parent_id)
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
$this->parentId = $parent_id;
|
||||
return $this;
|
||||
$this->data[static::FIELD_ID] = $id;
|
||||
|
||||
if (!is_null($parent_id)) {
|
||||
$warning_message = "\$parent_id as a parameter of constructor is being " .
|
||||
"deprecated, please try not to use this in new code.\n";
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
}
|
||||
/**
|
||||
* @param Api $api The Api instance this object should use to make calls
|
||||
*/
|
||||
public function setApi(\PYS_PRO_GLOBAL\FacebookAds\Api $api)
|
||||
{
|
||||
$this->api = static::assureApi($api);
|
||||
return $this;
|
||||
$this->parentId = $parent_id;
|
||||
|
||||
$this->api = static::assureApi($api);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*/
|
||||
public function setId($id) {
|
||||
$this->data[static::FIELD_ID] = $id;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated deprecate parent_id in AbstractCrudObject
|
||||
* @param string $parent_id
|
||||
*/
|
||||
public function setParentId($parent_id) {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
$this->parentId = $parent_id;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param Api $api The Api instance this object should use to make calls
|
||||
*/
|
||||
public function setApi(Api $api) {
|
||||
$this->api = static::assureApi($api);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
* @return string
|
||||
*/
|
||||
protected function getEndpoint() {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @param Api|null $instance
|
||||
* @return Api
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected static function assureApi(Api $instance = null) {
|
||||
$instance = $instance ?: Api::instance();
|
||||
if (!$instance) {
|
||||
throw new \InvalidArgumentException(
|
||||
'An Api instance must be provided as argument or '.
|
||||
'set as instance in the \PYS_PRO_GLOBAL\FacebookAds\Api');
|
||||
}
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
* @return string
|
||||
*/
|
||||
protected function getEndpoint()
|
||||
{
|
||||
return null;
|
||||
return $instance;
|
||||
}
|
||||
/**
|
||||
* @deprecated deprecate parent_id in AbstractCrudObject
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParentId() {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
return $this->parentId;
|
||||
}
|
||||
/**
|
||||
* @deprecated deprecate parent_id in AbstractCrudObject
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function assureParentId() {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
if (!$this->parentId) {
|
||||
throw new \Exception("A parent ID is required.");
|
||||
}
|
||||
/**
|
||||
* @param Api|null $instance
|
||||
* @return Api
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected static function assureApi(\PYS_PRO_GLOBAL\FacebookAds\Api $instance = null)
|
||||
{
|
||||
$instance = $instance ?: \PYS_PRO_GLOBAL\FacebookAds\Api::instance();
|
||||
if (!$instance) {
|
||||
throw new \InvalidArgumentException('An Api instance must be provided as argument or ' . 'set as instance in the \\FacebookAds\\Api');
|
||||
}
|
||||
return $instance;
|
||||
return $this->parentId;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function assureId() {
|
||||
if (!$this->data[static::FIELD_ID]) {
|
||||
throw new \Exception("field '".static::FIELD_ID."' is required.");
|
||||
}
|
||||
/**
|
||||
* @deprecated deprecate parent_id in AbstractCrudObject
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParentId()
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
return $this->parentId;
|
||||
return (string) $this->data[static::FIELD_ID];
|
||||
}
|
||||
/**
|
||||
* @return Api
|
||||
*/
|
||||
public function getApi() {
|
||||
return $this->api;
|
||||
}
|
||||
/**
|
||||
* Get the values which have changed
|
||||
*
|
||||
* @return array Key value pairs of changed variables
|
||||
*/
|
||||
public function getChangedValues() {
|
||||
return $this->changedFields;
|
||||
}
|
||||
/**
|
||||
* Get the name of the fields that have changed
|
||||
*
|
||||
* @return array Array of changed field names
|
||||
*/
|
||||
public function getChangedFields() {
|
||||
return array_keys($this->changedFields);
|
||||
}
|
||||
/**
|
||||
* Get the values which have changed, converting them to scalars
|
||||
*/
|
||||
public function exportData() {
|
||||
$data = array();
|
||||
foreach ($this->changedFields as $key => $val) {
|
||||
$data[$key] = parent::exportValue($val);
|
||||
}
|
||||
/**
|
||||
* @deprecated deprecate parent_id in AbstractCrudObject
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function assureParentId()
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
if (!$this->parentId) {
|
||||
throw new \Exception("A parent ID is required.");
|
||||
}
|
||||
return $this->parentId;
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function clearHistory() {
|
||||
$this->changedFields = array();
|
||||
}
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($name, $value) {
|
||||
if (!array_key_exists($name, $this->data)
|
||||
|| $this->data[$name] !== $value) {
|
||||
$this->changedFields[$name] = $value;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function assureId()
|
||||
{
|
||||
if (!$this->data[static::FIELD_ID]) {
|
||||
throw new \Exception("field '" . static::FIELD_ID . "' is required.");
|
||||
}
|
||||
return (string) $this->data[static::FIELD_ID];
|
||||
parent::__set($name, $value);
|
||||
}
|
||||
/**
|
||||
* @param string[] $fields
|
||||
*/
|
||||
public static function setDefaultReadFields(array $fields = array()) {
|
||||
static::$defaultReadFields = $fields;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getDefaultReadFields() {
|
||||
return static::$defaultReadFields;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getNodePath() {
|
||||
return '/'.$this->assureId();
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use (ParentObject)->creatXXX() instead
|
||||
* Create function for the object.
|
||||
*
|
||||
* @param array $params Additional parameters to include in the request
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function create(array $params = array()) {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
if ($this->data[static::FIELD_ID]) {
|
||||
throw new \Exception("Object has already an ID");
|
||||
}
|
||||
/**
|
||||
* @return Api
|
||||
*/
|
||||
public function getApi()
|
||||
{
|
||||
return $this->api;
|
||||
$response = $this->getApi()->call(
|
||||
'/'.$this->assureParentId().'/'.$this->getEndpoint(),
|
||||
RequestInterface::METHOD_POST,
|
||||
array_merge($this->exportData(), $params));
|
||||
$this->clearHistory();
|
||||
$data = $response->getContent();
|
||||
if (!isset($params['execution_options'])){
|
||||
$id = is_string($data) ? $data : $data[static::FIELD_ID];
|
||||
/** @var AbstractCrudObject $this */
|
||||
if ($this instanceof CanRedownloadInterface
|
||||
&& isset($params[CanRedownloadInterface::PARAM_REDOWNLOAD])
|
||||
&& $params[CanRedownloadInterface::PARAM_REDOWNLOAD] === true
|
||||
&& isset($data['data'][$id])
|
||||
&& is_array($data['data'][$id])
|
||||
) {
|
||||
$this->setDataWithoutValidation($data['data'][$id]);
|
||||
}
|
||||
$this->data[static::FIELD_ID] = (string) $id;
|
||||
}
|
||||
/**
|
||||
* Get the values which have changed
|
||||
*
|
||||
* @return array Key value pairs of changed variables
|
||||
*/
|
||||
public function getChangedValues()
|
||||
{
|
||||
return $this->changedFields;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use getSelf() instead
|
||||
* Read object data from the graph
|
||||
*
|
||||
* @param string[] $fields Fields to request
|
||||
* @param array $params Additional request parameters
|
||||
* @return $this
|
||||
*/
|
||||
public function read(array $fields = array(), array $params = array()) {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
$fields = implode(',', $fields ?: static::getDefaultReadFields());
|
||||
if ($fields) {
|
||||
$params['fields'] = $fields;
|
||||
}
|
||||
/**
|
||||
* Get the name of the fields that have changed
|
||||
*
|
||||
* @return array Array of changed field names
|
||||
*/
|
||||
public function getChangedFields()
|
||||
{
|
||||
return \array_keys($this->changedFields);
|
||||
$response = $this->getApi()->call(
|
||||
$this->getNodePath(),
|
||||
RequestInterface::METHOD_GET,
|
||||
$params);
|
||||
$this->setDataWithoutValidation($response->getContent());
|
||||
$this->clearHistory();
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use updateSelf() instead
|
||||
* Update the object. Function parameters are similar with the create function
|
||||
*
|
||||
* @param array $params Update parameters in assoc
|
||||
* @return $this
|
||||
*/
|
||||
public function update(array $params = array()) {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
$this->getApi()->call(
|
||||
$this->getNodePath(),
|
||||
RequestInterface::METHOD_POST,
|
||||
array_merge($this->exportData(), $params));
|
||||
$this->clearHistory();
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use deleteSelf() in each subclass
|
||||
* Delete this object from the graph
|
||||
*
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function deleteSelf(array $params = array()) {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
$this->getApi()->call(
|
||||
$this->getNodePath(),
|
||||
RequestInterface::METHOD_DELETE,
|
||||
$params);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* deprecate with ObjectValidation
|
||||
* Perform object upsert
|
||||
*
|
||||
* Helper function which determines whether an object should be created or
|
||||
* updated
|
||||
*
|
||||
* @param array $params
|
||||
* @return $this
|
||||
*/
|
||||
public function save(array $params = array()) {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
if ($this->data[static::FIELD_ID]) {
|
||||
return $this->update($params);
|
||||
} else {
|
||||
return $this->create($params);
|
||||
}
|
||||
/**
|
||||
* Get the values which have changed, converting them to scalars
|
||||
*/
|
||||
public function exportData()
|
||||
{
|
||||
$data = array();
|
||||
foreach ($this->changedFields as $key => $val) {
|
||||
$data[$key] = parent::exportValue($val);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function clearHistory()
|
||||
{
|
||||
$this->changedFields = array();
|
||||
}
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
if (!\array_key_exists($name, $this->data) || $this->data[$name] !== $value) {
|
||||
$this->changedFields[$name] = $value;
|
||||
}
|
||||
parent::__set($name, $value);
|
||||
}
|
||||
/**
|
||||
* @param string[] $fields
|
||||
*/
|
||||
public static function setDefaultReadFields(array $fields = array())
|
||||
{
|
||||
static::$defaultReadFields = $fields;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getDefaultReadFields()
|
||||
{
|
||||
return static::$defaultReadFields;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getNodePath()
|
||||
{
|
||||
return '/' . $this->assureId();
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use (ParentObject)->creatXXX() instead
|
||||
* Create function for the object.
|
||||
*
|
||||
* @param array $params Additional parameters to include in the request
|
||||
* @return $this
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function create(array $params = array())
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
if ($this->data[static::FIELD_ID]) {
|
||||
throw new \Exception("Object has already an ID");
|
||||
}
|
||||
$response = $this->getApi()->call('/' . $this->assureParentId() . '/' . $this->getEndpoint(), \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, \array_merge($this->exportData(), $params));
|
||||
$this->clearHistory();
|
||||
$data = $response->getContent();
|
||||
if (!isset($params['execution_options'])) {
|
||||
$id = \is_string($data) ? $data : $data[static::FIELD_ID];
|
||||
/** @var AbstractCrudObject $this */
|
||||
if ($this instanceof \PYS_PRO_GLOBAL\FacebookAds\Object\CanRedownloadInterface && isset($params[\PYS_PRO_GLOBAL\FacebookAds\Object\CanRedownloadInterface::PARAM_REDOWNLOAD]) && $params[\PYS_PRO_GLOBAL\FacebookAds\Object\CanRedownloadInterface::PARAM_REDOWNLOAD] === \true && isset($data['data'][$id]) && \is_array($data['data'][$id])) {
|
||||
$this->setDataWithoutValidation($data['data'][$id]);
|
||||
}
|
||||
$this->data[static::FIELD_ID] = (string) $id;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use getSelf() instead
|
||||
* Read object data from the graph
|
||||
*
|
||||
* @param string[] $fields Fields to request
|
||||
* @param array $params Additional request parameters
|
||||
* @return $this
|
||||
*/
|
||||
public function read(array $fields = array(), array $params = array())
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
$fields = \implode(',', $fields ?: static::getDefaultReadFields());
|
||||
if ($fields) {
|
||||
$params['fields'] = $fields;
|
||||
}
|
||||
$response = $this->getApi()->call($this->getNodePath(), \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, $params);
|
||||
$this->setDataWithoutValidation($response->getContent());
|
||||
$this->clearHistory();
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use updateSelf() instead
|
||||
* Update the object. Function parameters are similar with the create function
|
||||
*
|
||||
* @param array $params Update parameters in assoc
|
||||
* @return $this
|
||||
*/
|
||||
public function update(array $params = array())
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
$this->getApi()->call($this->getNodePath(), \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, \array_merge($this->exportData(), $params));
|
||||
$this->clearHistory();
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* use deleteSelf() in each subclass
|
||||
* Delete this object from the graph
|
||||
*
|
||||
* @param array $params
|
||||
* @return void
|
||||
*/
|
||||
public function deleteSelf(array $params = array())
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
$this->getApi()->call($this->getNodePath(), \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_DELETE, $params);
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* deprecate with ObjectValidation
|
||||
* Perform object upsert
|
||||
*
|
||||
* Helper function which determines whether an object should be created or
|
||||
* updated
|
||||
*
|
||||
* @param array $params
|
||||
* @return $this
|
||||
*/
|
||||
public function save(array $params = array())
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
if ($this->data[static::FIELD_ID]) {
|
||||
return $this->update($params);
|
||||
} else {
|
||||
return $this->create($params);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* deprecate with getEndpoint
|
||||
* @param string $prototype_class
|
||||
* @param string $endpoint
|
||||
* @return string
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function assureEndpoint($prototype_class, $endpoint)
|
||||
{
|
||||
$warning_message = \sprintf('%s is being deprecated, please try not to use' . ' this in new code.', __FUNCTION__);
|
||||
\trigger_error($warning_message, \E_USER_DEPRECATED);
|
||||
if (!$endpoint) {
|
||||
$prototype = new $prototype_class(null, null, $this->getApi());
|
||||
if (!$prototype instanceof \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject) {
|
||||
throw new \InvalidArgumentException('Either prototype must be instance
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* deprecate with getEndpoint
|
||||
* @param string $prototype_class
|
||||
* @param string $endpoint
|
||||
* @return string
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function assureEndpoint($prototype_class, $endpoint) {
|
||||
$warning_message = sprintf('%s is being deprecated, please try not to use'.
|
||||
' this in new code.',__FUNCTION__);
|
||||
trigger_error($warning_message, E_USER_DEPRECATED);
|
||||
if (!$endpoint) {
|
||||
$prototype = new $prototype_class(null, null, $this->getApi());
|
||||
if (!$prototype instanceof AbstractCrudObject) {
|
||||
throw new \InvalidArgumentException('Either prototype must be instance
|
||||
of AbstractCrudObject or $endpoint must be given');
|
||||
}
|
||||
$endpoint = $prototype->getEndpoint();
|
||||
}
|
||||
return $endpoint;
|
||||
}
|
||||
$endpoint = $prototype->getEndpoint();
|
||||
}
|
||||
/**
|
||||
* @param array $fields
|
||||
* @param array $params
|
||||
* @param string $prototype_class
|
||||
* @param string|null $endpoint
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
protected function fetchConnection(array $fields = array(), array $params = array(), $prototype_class = '', $endpoint = null)
|
||||
{
|
||||
$fields = \implode(',', $fields ?: static::getDefaultReadFields());
|
||||
if ($fields) {
|
||||
$params['fields'] = $fields;
|
||||
}
|
||||
$endpoint = $this->assureEndpoint($prototype_class, $endpoint);
|
||||
return $this->getApi()->call('/' . $this->assureId() . '/' . $endpoint, \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, $params);
|
||||
return $endpoint;
|
||||
}
|
||||
/**
|
||||
* @param array $fields
|
||||
* @param array $params
|
||||
* @param string $prototype_class
|
||||
* @param string|null $endpoint
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
protected function fetchConnection(
|
||||
array $fields = array(),
|
||||
array $params = array(),
|
||||
$prototype_class = '',
|
||||
$endpoint = null) {
|
||||
$fields = implode(',', $fields ?: static::getDefaultReadFields());
|
||||
if ($fields) {
|
||||
$params['fields'] = $fields;
|
||||
}
|
||||
/**
|
||||
* Read a single connection object
|
||||
*
|
||||
* @param string $prototype_class
|
||||
* @param array $fields Fields to request
|
||||
* @param array $params Additional filters for the reading
|
||||
* @param string|null $endpoint
|
||||
* @return AbstractObject
|
||||
*/
|
||||
protected function getOneByConnection($prototype_class, array $fields = array(), array $params = array(), $endpoint = null)
|
||||
{
|
||||
$response = $this->fetchConnection($fields, $params, $prototype_class, $endpoint);
|
||||
if (!$response->getContent()) {
|
||||
return null;
|
||||
}
|
||||
$object = new $prototype_class(null, null, $this->getApi());
|
||||
/** @var AbstractCrudObject $object */
|
||||
$object->setDataWithoutValidation($response->getContent());
|
||||
return $object;
|
||||
$endpoint = $this->assureEndpoint($prototype_class, $endpoint);
|
||||
return $this->getApi()->call(
|
||||
'/'.$this->assureId().'/'.$endpoint,
|
||||
RequestInterface::METHOD_GET,
|
||||
$params);
|
||||
}
|
||||
/**
|
||||
* Read a single connection object
|
||||
*
|
||||
* @param string $prototype_class
|
||||
* @param array $fields Fields to request
|
||||
* @param array $params Additional filters for the reading
|
||||
* @param string|null $endpoint
|
||||
* @return AbstractObject
|
||||
*/
|
||||
protected function getOneByConnection(
|
||||
$prototype_class,
|
||||
array $fields = array(),
|
||||
array $params = array(),
|
||||
$endpoint = null) {
|
||||
$response = $this->fetchConnection(
|
||||
$fields, $params, $prototype_class, $endpoint);
|
||||
if (!$response->getContent()) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Read objects from a connection
|
||||
*
|
||||
* @param string $prototype_class
|
||||
* @param array $fields Fields to request
|
||||
* @param array $params Additional filters for the reading
|
||||
* @param string|null $endpoint
|
||||
* @return Cursor
|
||||
*/
|
||||
protected function getManyByConnection($prototype_class, array $fields = array(), array $params = array(), $endpoint = null)
|
||||
{
|
||||
$response = $this->fetchConnection($fields, $params, $prototype_class, $endpoint);
|
||||
return new \PYS_PRO_GLOBAL\FacebookAds\Cursor($response, new $prototype_class(null, null, $this->getApi()));
|
||||
$object = new $prototype_class(
|
||||
null, null, $this->getApi());
|
||||
/** @var AbstractCrudObject $object */
|
||||
$object->setDataWithoutValidation($response->getContent());
|
||||
return $object;
|
||||
}
|
||||
/**
|
||||
* Read objects from a connection
|
||||
*
|
||||
* @param string $prototype_class
|
||||
* @param array $fields Fields to request
|
||||
* @param array $params Additional filters for the reading
|
||||
* @param string|null $endpoint
|
||||
* @return Cursor
|
||||
*/
|
||||
protected function getManyByConnection(
|
||||
$prototype_class,
|
||||
array $fields = array(),
|
||||
array $params = array(),
|
||||
$endpoint = null) {
|
||||
$response = $this->fetchConnection(
|
||||
$fields, $params, $prototype_class, $endpoint);
|
||||
return new Cursor(
|
||||
$response,
|
||||
new $prototype_class(null, null, $this->getApi()));
|
||||
}
|
||||
/**
|
||||
* @param string $job_class
|
||||
* @param array $fields
|
||||
* @param array $params
|
||||
* @return AbstractAsyncJobObject
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function createAsyncJob(
|
||||
$job_class,
|
||||
array $fields = array(),
|
||||
array $params = array()) {
|
||||
$object = new $job_class(null, $this->assureId(), $this->getApi());
|
||||
if (!$object instanceof AbstractAsyncJobObject) {
|
||||
throw new \InvalidArgumentException(
|
||||
"Class {$job_class} is not of type "
|
||||
.AbstractAsyncJobObject::className());
|
||||
}
|
||||
/**
|
||||
* @param string $job_class
|
||||
* @param array $fields
|
||||
* @param array $params
|
||||
* @return AbstractAsyncJobObject
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function createAsyncJob($job_class, array $fields = array(), array $params = array())
|
||||
{
|
||||
$object = new $job_class(null, $this->assureId(), $this->getApi());
|
||||
if (!$object instanceof \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractAsyncJobObject) {
|
||||
throw new \InvalidArgumentException("Class {$job_class} is not of type " . \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractAsyncJobObject::className());
|
||||
}
|
||||
$params['fields'] = $fields;
|
||||
return $object->create($params);
|
||||
$params['fields'] = $fields;
|
||||
return $object->create($params);
|
||||
}
|
||||
/**
|
||||
* Delete objects.
|
||||
*
|
||||
* Used batch API calls to delete multiple objects at once
|
||||
*
|
||||
* @param string[] $ids Array or single Object ID to delete
|
||||
* @param Api $api Api Object to use
|
||||
* @return bool Returns true on success
|
||||
*/
|
||||
public static function deleteIds(array $ids, Api $api = null) {
|
||||
$batch = array();
|
||||
foreach ($ids as $id) {
|
||||
$request = array(
|
||||
'relative_url' => '/'.$id,
|
||||
'method' => RequestInterface::METHOD_DELETE,
|
||||
);
|
||||
$batch[] = $request;
|
||||
}
|
||||
/**
|
||||
* Delete objects.
|
||||
*
|
||||
* Used batch API calls to delete multiple objects at once
|
||||
*
|
||||
* @param string[] $ids Array or single Object ID to delete
|
||||
* @param Api $api Api Object to use
|
||||
* @return bool Returns true on success
|
||||
*/
|
||||
public static function deleteIds(array $ids, \PYS_PRO_GLOBAL\FacebookAds\Api $api = null)
|
||||
{
|
||||
$batch = array();
|
||||
foreach ($ids as $id) {
|
||||
$request = array('relative_url' => '/' . $id, 'method' => \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_DELETE);
|
||||
$batch[] = $request;
|
||||
}
|
||||
$api = static::assureApi($api);
|
||||
$response = $api->call('/', \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, array('batch' => \json_encode($batch)));
|
||||
foreach ($response->getContent() as $result) {
|
||||
if (200 != $result['code']) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
return \true;
|
||||
$api = static::assureApi($api);
|
||||
$response = $api->call(
|
||||
'/',
|
||||
RequestInterface::METHOD_POST,
|
||||
array('batch' => json_encode($batch)));
|
||||
foreach ($response->getContent() as $result) {
|
||||
if (200 != $result['code']) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read function for the object. Convert fields and filters into the query
|
||||
* part of uri and return objects.
|
||||
*
|
||||
* @param mixed $ids Array or single object IDs
|
||||
* @param array $fields Array of field names to read
|
||||
* @param array $params Additional filters for the reading, in assoc
|
||||
* @param Api $api Api Object to use
|
||||
* @return Cursor
|
||||
*/
|
||||
public static function readIds(array $ids, array $fields = array(), array $params = array(), \PYS_PRO_GLOBAL\FacebookAds\Api $api = null)
|
||||
{
|
||||
if (empty($fields)) {
|
||||
$fields = static::getDefaultReadFields();
|
||||
}
|
||||
if (!empty($fields)) {
|
||||
$params['fields'] = \implode(',', $fields);
|
||||
}
|
||||
$params['ids'] = \implode(',', $ids);
|
||||
$api = static::assureApi($api);
|
||||
$response = $api->call('/', \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, $params);
|
||||
$result = array();
|
||||
foreach ($response->getContent() as $data) {
|
||||
/** @var AbstractObject $object */
|
||||
$object = new static(null, null, $api);
|
||||
$object->setDataWithoutValidation((array) $data);
|
||||
$result[] = $object;
|
||||
}
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Read function for the object. Convert fields and filters into the query
|
||||
* part of uri and return objects.
|
||||
*
|
||||
* @param mixed $ids Array or single object IDs
|
||||
* @param array $fields Array of field names to read
|
||||
* @param array $params Additional filters for the reading, in assoc
|
||||
* @param Api $api Api Object to use
|
||||
* @return Cursor
|
||||
*/
|
||||
public static function readIds(
|
||||
array $ids,
|
||||
array $fields = array(),
|
||||
array $params = array(),
|
||||
Api $api = null) {
|
||||
if (empty($fields)) {
|
||||
$fields = static::getDefaultReadFields();
|
||||
}
|
||||
if (!empty($fields)) {
|
||||
$params['fields'] = implode(',', $fields);
|
||||
}
|
||||
$params['ids'] = implode(',', $ids);
|
||||
$api = static::assureApi($api);
|
||||
$response = $api->call('/', RequestInterface::METHOD_GET, $params);
|
||||
$result = array();
|
||||
foreach ($response->getContent() as $data) {
|
||||
/** @var AbstractObject $object */
|
||||
$object = new static(null, null, $api);
|
||||
$object->setDataWithoutValidation((array) $data);
|
||||
$result[] = $object;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -23,169 +22,164 @@
|
||||
*
|
||||
*/
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiConfig;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Enum\EmptyEnum;
|
||||
class AbstractObject
|
||||
{
|
||||
/**
|
||||
* @var mixed[] set of key value pairs representing data
|
||||
*/
|
||||
protected $data = array();
|
||||
protected $_type_checker;
|
||||
public function __construct()
|
||||
{
|
||||
$this->data = static::getFieldsEnum()->getValuesMap();
|
||||
$this->_type_checker = new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker(static::getFieldTypes(), static::getReferencedEnums());
|
||||
class AbstractObject {
|
||||
/**
|
||||
* @var mixed[] set of key value pairs representing data
|
||||
*/
|
||||
protected $data = array();
|
||||
protected $_type_checker;
|
||||
|
||||
public function __construct() {
|
||||
$this->data = static::getFieldsEnum()->getValuesMap();
|
||||
$this->_type_checker = new TypeChecker(
|
||||
static::getFieldTypes(), static::getReferencedEnums());
|
||||
}
|
||||
|
||||
protected static function getFieldTypes() {
|
||||
$fields_enum = static::getFieldsEnum();
|
||||
if (method_exists($fields_enum, 'getFieldTypes')) {
|
||||
return $fields_enum->getFieldTypes();
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
protected static function getFieldTypes()
|
||||
{
|
||||
$fields_enum = static::getFieldsEnum();
|
||||
if (\method_exists($fields_enum, 'getFieldTypes')) {
|
||||
return $fields_enum->getFieldTypes();
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($name, $value) {
|
||||
if (ApiConfig::TYPE_CHECKER_STRICT_MODE
|
||||
&& $this->_type_checker->isValidParam($name)
|
||||
) {
|
||||
if ($this->_type_checker->isValidParamPair($name, $value)) {
|
||||
$this->data[$name] = $value;
|
||||
} else {
|
||||
throw new \InvalidArgumentException(
|
||||
$name." and ".$this->exportValue($value)
|
||||
." are not a valid type value pair");
|
||||
}
|
||||
} else {
|
||||
$this->data[$name] = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __get($name) {
|
||||
if (array_key_exists($name, $this->data)) {
|
||||
return $this->data[$name];
|
||||
} else {
|
||||
throw new \InvalidArgumentException(
|
||||
$name.' is not a field of '.get_class($this));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
public function __isset($name) {
|
||||
return array_key_exists($name, $this->data);
|
||||
}
|
||||
/**
|
||||
* @param array
|
||||
* @return $this
|
||||
*/
|
||||
public function setData(array $data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
// Handle class-specific situations
|
||||
if (method_exists($this, 'setDataTrigger')) {
|
||||
$this->setDataTrigger($data);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Like setData but will skip field validation
|
||||
*
|
||||
* @param array
|
||||
* @return $this
|
||||
*/
|
||||
public function setDataWithoutValidation(array $data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
// Handle class-specific situations
|
||||
if (method_exists($this, 'setDataTrigger')) {
|
||||
$this->setDataTrigger($data);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
protected function exportValue($value) {
|
||||
$result = $value;
|
||||
switch (true) {
|
||||
case $value === null:
|
||||
break;
|
||||
case $value instanceof AbstractObject:
|
||||
$result = $value->exportData();
|
||||
break;
|
||||
case is_array($value):
|
||||
$result = array();
|
||||
foreach ($value as $key => $sub_value) {
|
||||
if ($sub_value !== null) {
|
||||
$result[$key] = $this->exportValue($sub_value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
if (\PYS_PRO_GLOBAL\FacebookAds\ApiConfig::TYPE_CHECKER_STRICT_MODE && $this->_type_checker->isValidParam($name)) {
|
||||
if ($this->_type_checker->isValidParamPair($name, $value)) {
|
||||
$this->data[$name] = $value;
|
||||
} else {
|
||||
throw new \InvalidArgumentException($name . " and " . $this->exportValue($value) . " are not a valid type value pair");
|
||||
}
|
||||
} else {
|
||||
$this->data[$name] = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if (\array_key_exists($name, $this->data)) {
|
||||
return $this->data[$name];
|
||||
} else {
|
||||
throw new \InvalidArgumentException($name . ' is not a field of ' . \get_class($this));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
return \array_key_exists($name, $this->data);
|
||||
}
|
||||
/**
|
||||
* @param array
|
||||
* @return $this
|
||||
*/
|
||||
public function setData(array $data)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
// Handle class-specific situations
|
||||
if (\method_exists($this, 'setDataTrigger')) {
|
||||
$this->setDataTrigger($data);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Like setData but will skip field validation
|
||||
*
|
||||
* @param array
|
||||
* @return $this
|
||||
*/
|
||||
public function setDataWithoutValidation(array $data)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
// Handle class-specific situations
|
||||
if (\method_exists($this, 'setDataTrigger')) {
|
||||
$this->setDataTrigger($data);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
protected function exportValue($value)
|
||||
{
|
||||
$result = $value;
|
||||
switch (\true) {
|
||||
case $value === null:
|
||||
break;
|
||||
case $value instanceof \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject:
|
||||
$result = $value->exportData();
|
||||
break;
|
||||
case \is_array($value):
|
||||
$result = array();
|
||||
foreach ($value as $key => $sub_value) {
|
||||
if ($sub_value !== null) {
|
||||
$result[$key] = $this->exportValue($sub_value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function exportData()
|
||||
{
|
||||
return $this->exportValue($this->data);
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function exportAllData()
|
||||
{
|
||||
return $this->exportValue($this->data);
|
||||
}
|
||||
/**
|
||||
* @return EmptyEnum
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Enum\EmptyEnum::getInstance();
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function getFields()
|
||||
{
|
||||
return static::getFieldsEnum()->getValues();
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function className()
|
||||
{
|
||||
return \get_called_class();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function exportData() {
|
||||
return $this->exportValue($this->data);
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function exportAllData() {
|
||||
return $this->exportValue($this->data);
|
||||
}
|
||||
/**
|
||||
* @return EmptyEnum
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return EmptyEnum::getInstance();
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function getFields() {
|
||||
return static::getFieldsEnum()->getValues();
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function className() {
|
||||
return get_called_class();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -47,6 +47,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsDatePresetValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsLevelValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsSummaryActionBreakdownsValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Traits\AdLabelAwareCrudObjectTrait;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -55,164 +56,465 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Traits\AdLabelAwareCrudObjectTrait;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class Ad extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractArchivableCrudObject implements \PYS_PRO_GLOBAL\FacebookAds\Object\CanRedownloadInterface
|
||||
{
|
||||
use AdLabelAwareCrudObjectTrait;
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint()
|
||||
{
|
||||
return 'ads';
|
||||
}
|
||||
/**
|
||||
* @return AdFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['BidType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdBidTypeValues::getInstance()->getValues();
|
||||
$ref_enums['ConfiguredStatus'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdConfiguredStatusValues::getInstance()->getValues();
|
||||
$ref_enums['EffectiveStatus'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdEffectiveStatusValues::getInstance()->getValues();
|
||||
$ref_enums['Status'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdStatusValues::getInstance()->getValues();
|
||||
$ref_enums['DatePreset'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdDatePresetValues::getInstance()->getValues();
|
||||
$ref_enums['ExecutionOptions'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdExecutionOptionsValues::getInstance()->getValues();
|
||||
$ref_enums['Operator'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdOperatorValues::getInstance()->getValues();
|
||||
$ref_enums['StatusOption'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdStatusOptionValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
public function getAdCreatives(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/adcreatives', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function createAdLabel(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('adlabels' => 'list<Object>', 'execution_options' => 'list<execution_options_enum>');
|
||||
$enums = array('execution_options_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdExecutionOptionsValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, '/adlabels', new \PYS_PRO_GLOBAL\FacebookAds\Object\Ad(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\Ad::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getAdRulesGoverned(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('pass_evaluation' => 'bool');
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/adrules_governed', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdRule(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdRule::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getCopies(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('date_preset' => 'date_preset_enum', 'effective_status' => 'list<string>', 'time_range' => 'Object', 'updated_since' => 'int');
|
||||
$enums = array('date_preset_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdDatePresetValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/copies', new \PYS_PRO_GLOBAL\FacebookAds\Object\Ad(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\Ad::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function createCopy(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('adset_id' => 'string', 'rename_options' => 'Object', 'status_option' => 'status_option_enum');
|
||||
$enums = array('status_option_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdStatusOptionValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, '/copies', new \PYS_PRO_GLOBAL\FacebookAds\Object\Ad(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\Ad::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getInsights(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('action_attribution_windows' => 'list<action_attribution_windows_enum>', 'action_breakdowns' => 'list<action_breakdowns_enum>', 'action_report_time' => 'action_report_time_enum', 'breakdowns' => 'list<breakdowns_enum>', 'date_preset' => 'date_preset_enum', 'default_summary' => 'bool', 'export_columns' => 'list<string>', 'export_format' => 'string', 'export_name' => 'string', 'fields' => 'list<string>', 'filtering' => 'list<Object>', 'level' => 'level_enum', 'product_id_limit' => 'int', 'sort' => 'list<string>', 'summary' => 'list<string>', 'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>', 'time_increment' => 'string', 'time_range' => 'Object', 'time_ranges' => 'list<Object>', 'use_account_attribution_setting' => 'bool', 'use_unified_attribution_setting' => 'bool');
|
||||
$enums = array('action_attribution_windows_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(), 'action_breakdowns_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsActionBreakdownsValues::getInstance()->getValues(), 'action_report_time_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsActionReportTimeValues::getInstance()->getValues(), 'breakdowns_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsBreakdownsValues::getInstance()->getValues(), 'date_preset_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsDatePresetValues::getInstance()->getValues(), 'level_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsLevelValues::getInstance()->getValues(), 'summary_action_breakdowns_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/insights', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdsInsights(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdsInsights::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getInsightsAsync(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('action_attribution_windows' => 'list<action_attribution_windows_enum>', 'action_breakdowns' => 'list<action_breakdowns_enum>', 'action_report_time' => 'action_report_time_enum', 'breakdowns' => 'list<breakdowns_enum>', 'date_preset' => 'date_preset_enum', 'default_summary' => 'bool', 'export_columns' => 'list<string>', 'export_format' => 'string', 'export_name' => 'string', 'fields' => 'list<string>', 'filtering' => 'list<Object>', 'level' => 'level_enum', 'product_id_limit' => 'int', 'sort' => 'list<string>', 'summary' => 'list<string>', 'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>', 'time_increment' => 'string', 'time_range' => 'Object', 'time_ranges' => 'list<Object>', 'use_account_attribution_setting' => 'bool', 'use_unified_attribution_setting' => 'bool');
|
||||
$enums = array('action_attribution_windows_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(), 'action_breakdowns_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsActionBreakdownsValues::getInstance()->getValues(), 'action_report_time_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsActionReportTimeValues::getInstance()->getValues(), 'breakdowns_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsBreakdownsValues::getInstance()->getValues(), 'date_preset_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsDatePresetValues::getInstance()->getValues(), 'level_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsLevelValues::getInstance()->getValues(), 'summary_action_breakdowns_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, '/insights', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdReportRun(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdReportRun::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getLeads(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/leads', new \PYS_PRO_GLOBAL\FacebookAds\Object\Lead(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\Lead::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getPreviews(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('ad_format' => 'ad_format_enum', 'dynamic_asset_label' => 'string', 'dynamic_creative_spec' => 'Object', 'dynamic_customization' => 'Object', 'end_date' => 'datetime', 'height' => 'unsigned int', 'locale' => 'string', 'place_page_id' => 'int', 'post' => 'Object', 'product_item_ids' => 'list<string>', 'render_type' => 'render_type_enum', 'start_date' => 'datetime', 'width' => 'unsigned int');
|
||||
$enums = array('ad_format_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdPreviewAdFormatValues::getInstance()->getValues(), 'render_type_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdPreviewRenderTypeValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/previews', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdPreview(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdPreview::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getTargetingSentenceLines(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/targetingsentencelines', new \PYS_PRO_GLOBAL\FacebookAds\Object\TargetingSentenceLine(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\TargetingSentenceLine::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_DELETE, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject(), 'NODE', array(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('am_call_tags' => 'map', 'date_preset' => 'date_preset_enum', 'from_adtable' => 'bool', 'review_feedback_breakdown' => 'bool', 'time_range' => 'Object');
|
||||
$enums = array('date_preset_enum' => array('data_maximum', 'last_14d', 'last_28d', 'last_30d', 'last_3d', 'last_7d', 'last_90d', 'last_month', 'last_quarter', 'last_week_mon_sun', 'last_week_sun_sat', 'last_year', 'maximum', 'this_month', 'this_quarter', 'this_week_mon_today', 'this_week_sun_today', 'this_year', 'today', 'yesterday'));
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\Ad(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\Ad::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function updateSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('adlabels' => 'list<Object>', 'adset_spec' => 'AdSet', 'audience_id' => 'string', 'bid_amount' => 'int', 'conversion_domain' => 'string', 'creative' => 'AdCreative', 'display_sequence' => 'unsigned int', 'draft_adgroup_id' => 'string', 'engagement_audience' => 'bool', 'execution_options' => 'list<execution_options_enum>', 'include_demolink_hashes' => 'bool', 'name' => 'string', 'priority' => 'unsigned int', 'status' => 'status_enum', 'tracking_specs' => 'Object');
|
||||
$enums = array('execution_options_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdExecutionOptionsValues::getInstance()->getValues(), 'status_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdStatusValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\Ad(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\Ad::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
class Ad extends AbstractArchivableCrudObject
|
||||
implements CanRedownloadInterface {
|
||||
|
||||
use AdLabelAwareCrudObjectTrait;
|
||||
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint() {
|
||||
return 'ads';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['BidType'] = AdBidTypeValues::getInstance()->getValues();
|
||||
$ref_enums['ConfiguredStatus'] = AdConfiguredStatusValues::getInstance()->getValues();
|
||||
$ref_enums['EffectiveStatus'] = AdEffectiveStatusValues::getInstance()->getValues();
|
||||
$ref_enums['Status'] = AdStatusValues::getInstance()->getValues();
|
||||
$ref_enums['DatePreset'] = AdDatePresetValues::getInstance()->getValues();
|
||||
$ref_enums['ExecutionOptions'] = AdExecutionOptionsValues::getInstance()->getValues();
|
||||
$ref_enums['Operator'] = AdOperatorValues::getInstance()->getValues();
|
||||
$ref_enums['StatusOption'] = AdStatusOptionValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
public function getAdCreatives(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/adcreatives',
|
||||
new AdCreative(),
|
||||
'EDGE',
|
||||
AdCreative::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function createAdLabel(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'adlabels' => 'list<Object>',
|
||||
'execution_options' => 'list<execution_options_enum>',
|
||||
);
|
||||
$enums = array(
|
||||
'execution_options_enum' => AdExecutionOptionsValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_POST,
|
||||
'/adlabels',
|
||||
new Ad(),
|
||||
'EDGE',
|
||||
Ad::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getAdRulesGoverned(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'pass_evaluation' => 'bool',
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/adrules_governed',
|
||||
new AdRule(),
|
||||
'EDGE',
|
||||
AdRule::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getCopies(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'date_preset' => 'date_preset_enum',
|
||||
'effective_status' => 'list<string>',
|
||||
'time_range' => 'Object',
|
||||
'updated_since' => 'int',
|
||||
);
|
||||
$enums = array(
|
||||
'date_preset_enum' => AdDatePresetValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/copies',
|
||||
new Ad(),
|
||||
'EDGE',
|
||||
Ad::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function createCopy(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'adset_id' => 'string',
|
||||
'rename_options' => 'Object',
|
||||
'status_option' => 'status_option_enum',
|
||||
);
|
||||
$enums = array(
|
||||
'status_option_enum' => AdStatusOptionValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_POST,
|
||||
'/copies',
|
||||
new Ad(),
|
||||
'EDGE',
|
||||
Ad::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getInsights(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'action_attribution_windows' => 'list<action_attribution_windows_enum>',
|
||||
'action_breakdowns' => 'list<action_breakdowns_enum>',
|
||||
'action_report_time' => 'action_report_time_enum',
|
||||
'breakdowns' => 'list<breakdowns_enum>',
|
||||
'date_preset' => 'date_preset_enum',
|
||||
'default_summary' => 'bool',
|
||||
'export_columns' => 'list<string>',
|
||||
'export_format' => 'string',
|
||||
'export_name' => 'string',
|
||||
'fields' => 'list<string>',
|
||||
'filtering' => 'list<Object>',
|
||||
'level' => 'level_enum',
|
||||
'product_id_limit' => 'int',
|
||||
'sort' => 'list<string>',
|
||||
'summary' => 'list<string>',
|
||||
'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>',
|
||||
'time_increment' => 'string',
|
||||
'time_range' => 'Object',
|
||||
'time_ranges' => 'list<Object>',
|
||||
'use_account_attribution_setting' => 'bool',
|
||||
'use_unified_attribution_setting' => 'bool',
|
||||
);
|
||||
$enums = array(
|
||||
'action_attribution_windows_enum' => AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(),
|
||||
'action_breakdowns_enum' => AdsInsightsActionBreakdownsValues::getInstance()->getValues(),
|
||||
'action_report_time_enum' => AdsInsightsActionReportTimeValues::getInstance()->getValues(),
|
||||
'breakdowns_enum' => AdsInsightsBreakdownsValues::getInstance()->getValues(),
|
||||
'date_preset_enum' => AdsInsightsDatePresetValues::getInstance()->getValues(),
|
||||
'level_enum' => AdsInsightsLevelValues::getInstance()->getValues(),
|
||||
'summary_action_breakdowns_enum' => AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/insights',
|
||||
new AdsInsights(),
|
||||
'EDGE',
|
||||
AdsInsights::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getInsightsAsync(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'action_attribution_windows' => 'list<action_attribution_windows_enum>',
|
||||
'action_breakdowns' => 'list<action_breakdowns_enum>',
|
||||
'action_report_time' => 'action_report_time_enum',
|
||||
'breakdowns' => 'list<breakdowns_enum>',
|
||||
'date_preset' => 'date_preset_enum',
|
||||
'default_summary' => 'bool',
|
||||
'export_columns' => 'list<string>',
|
||||
'export_format' => 'string',
|
||||
'export_name' => 'string',
|
||||
'fields' => 'list<string>',
|
||||
'filtering' => 'list<Object>',
|
||||
'level' => 'level_enum',
|
||||
'product_id_limit' => 'int',
|
||||
'sort' => 'list<string>',
|
||||
'summary' => 'list<string>',
|
||||
'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>',
|
||||
'time_increment' => 'string',
|
||||
'time_range' => 'Object',
|
||||
'time_ranges' => 'list<Object>',
|
||||
'use_account_attribution_setting' => 'bool',
|
||||
'use_unified_attribution_setting' => 'bool',
|
||||
);
|
||||
$enums = array(
|
||||
'action_attribution_windows_enum' => AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(),
|
||||
'action_breakdowns_enum' => AdsInsightsActionBreakdownsValues::getInstance()->getValues(),
|
||||
'action_report_time_enum' => AdsInsightsActionReportTimeValues::getInstance()->getValues(),
|
||||
'breakdowns_enum' => AdsInsightsBreakdownsValues::getInstance()->getValues(),
|
||||
'date_preset_enum' => AdsInsightsDatePresetValues::getInstance()->getValues(),
|
||||
'level_enum' => AdsInsightsLevelValues::getInstance()->getValues(),
|
||||
'summary_action_breakdowns_enum' => AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_POST,
|
||||
'/insights',
|
||||
new AdReportRun(),
|
||||
'EDGE',
|
||||
AdReportRun::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getLeads(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/leads',
|
||||
new Lead(),
|
||||
'EDGE',
|
||||
Lead::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getPreviews(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'ad_format' => 'ad_format_enum',
|
||||
'dynamic_asset_label' => 'string',
|
||||
'dynamic_creative_spec' => 'Object',
|
||||
'dynamic_customization' => 'Object',
|
||||
'end_date' => 'datetime',
|
||||
'height' => 'unsigned int',
|
||||
'locale' => 'string',
|
||||
'place_page_id' => 'int',
|
||||
'post' => 'Object',
|
||||
'product_item_ids' => 'list<string>',
|
||||
'render_type' => 'render_type_enum',
|
||||
'start_date' => 'datetime',
|
||||
'width' => 'unsigned int',
|
||||
);
|
||||
$enums = array(
|
||||
'ad_format_enum' => AdPreviewAdFormatValues::getInstance()->getValues(),
|
||||
'render_type_enum' => AdPreviewRenderTypeValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/previews',
|
||||
new AdPreview(),
|
||||
'EDGE',
|
||||
AdPreview::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getTargetingSentenceLines(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/targetingsentencelines',
|
||||
new TargetingSentenceLine(),
|
||||
'EDGE',
|
||||
TargetingSentenceLine::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_DELETE,
|
||||
'/',
|
||||
new AbstractCrudObject(),
|
||||
'NODE',
|
||||
array(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'am_call_tags' => 'map',
|
||||
'date_preset' => 'date_preset_enum',
|
||||
'from_adtable' => 'bool',
|
||||
'review_feedback_breakdown' => 'bool',
|
||||
'time_range' => 'Object',
|
||||
);
|
||||
$enums = array(
|
||||
'date_preset_enum' => array(
|
||||
'data_maximum',
|
||||
'last_14d',
|
||||
'last_28d',
|
||||
'last_30d',
|
||||
'last_3d',
|
||||
'last_7d',
|
||||
'last_90d',
|
||||
'last_month',
|
||||
'last_quarter',
|
||||
'last_week_mon_sun',
|
||||
'last_week_sun_sat',
|
||||
'last_year',
|
||||
'maximum',
|
||||
'this_month',
|
||||
'this_quarter',
|
||||
'this_week_mon_today',
|
||||
'this_week_sun_today',
|
||||
'this_year',
|
||||
'today',
|
||||
'yesterday',
|
||||
),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/',
|
||||
new Ad(),
|
||||
'NODE',
|
||||
Ad::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'adlabels' => 'list<Object>',
|
||||
'adset_spec' => 'AdSet',
|
||||
'audience_id' => 'string',
|
||||
'bid_amount' => 'int',
|
||||
'conversion_domain' => 'string',
|
||||
'creative' => 'AdCreative',
|
||||
'display_sequence' => 'unsigned int',
|
||||
'draft_adgroup_id' => 'string',
|
||||
'engagement_audience' => 'bool',
|
||||
'execution_options' => 'list<execution_options_enum>',
|
||||
'include_demolink_hashes' => 'bool',
|
||||
'name' => 'string',
|
||||
'priority' => 'unsigned int',
|
||||
'status' => 'status_enum',
|
||||
'tracking_specs' => 'Object',
|
||||
);
|
||||
$enums = array(
|
||||
'execution_options_enum' => AdExecutionOptionsValues::getInstance()->getValues(),
|
||||
'status_enum' => AdStatusValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_POST,
|
||||
'/',
|
||||
new Ad(),
|
||||
'NODE',
|
||||
Ad::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -31,6 +31,7 @@ use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountAdRulesHistoryFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdRulesHistoryActionValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdRulesHistoryEvaluationTypeValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -39,20 +40,22 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdRulesHistoryEvaluationTy
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountAdRulesHistory extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountAdRulesHistoryFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountAdRulesHistoryFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['Action'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdRulesHistoryActionValues::getInstance()->getValues();
|
||||
$ref_enums['EvaluationType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdRulesHistoryEvaluationTypeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountAdRulesHistory extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountAdRulesHistoryFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountAdRulesHistoryFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['Action'] = AdAccountAdRulesHistoryActionValues::getInstance()->getValues();
|
||||
$ref_enums['EvaluationType'] = AdAccountAdRulesHistoryEvaluationTypeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -30,6 +30,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountAdVolumeFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdVolumeRecommendationTypeValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -38,19 +39,21 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdVolumeRecommendationType
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountAdVolume extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountAdVolumeFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountAdVolumeFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['RecommendationType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountAdVolumeRecommendationTypeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountAdVolume extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountAdVolumeFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountAdVolumeFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['RecommendationType'] = AdAccountAdVolumeRecommendationTypeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
* form for use in connection with the web services and APIs provided by
|
||||
* Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use
|
||||
* of this software is subject to the Facebook Developer Principles and
|
||||
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
||||
* shall be included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountCustomAudienceFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
* For any issues or feature requests related to this class, please let us know
|
||||
* on github and we'll fix in our codegen framework. We'll not be able to accept
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
|
||||
class AdAccountCustomAudience extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountCustomAudienceFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountCustomAudienceFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountDefaultDestinationFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountDefaultDestinationFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountDefaultDestination extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountDefaultDestinationFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountDefaultDestinationFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountDefaultDestination extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountDefaultDestinationFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountDefaultDestinationFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -31,6 +31,7 @@ use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountDefaultObjectiveFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDefaultObjectiveDefaultObjectiveForUserValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDefaultObjectiveObjectiveForLevelValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -39,20 +40,22 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDefaultObjectiveObjectiveF
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountDefaultObjective extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountDefaultObjectiveFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountDefaultObjectiveFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['DefaultObjectiveForUser'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDefaultObjectiveDefaultObjectiveForUserValues::getInstance()->getValues();
|
||||
$ref_enums['ObjectiveForLevel'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDefaultObjectiveObjectiveForLevelValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountDefaultObjective extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountDefaultObjectiveFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountDefaultObjectiveFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['DefaultObjectiveForUser'] = AdAccountDefaultObjectiveDefaultObjectiveForUserValues::getInstance()->getValues();
|
||||
$ref_enums['ObjectiveForLevel'] = AdAccountDefaultObjectiveObjectiveForLevelValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -30,6 +30,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountDeliveryEstimateFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDeliveryEstimateOptimizationGoalValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -38,19 +39,21 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDeliveryEstimateOptimizati
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountDeliveryEstimate extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountDeliveryEstimateFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountDeliveryEstimateFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['OptimizationGoal'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountDeliveryEstimateOptimizationGoalValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountDeliveryEstimate extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountDeliveryEstimateFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountDeliveryEstimateFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['OptimizationGoal'] = AdAccountDeliveryEstimateOptimizationGoalValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountIosFourteenCampaignLimitsFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountIosFourteenCampaignLimitsF
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountIosFourteenCampaignLimits extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountIosFourteenCampaignLimitsFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountIosFourteenCampaignLimitsFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountIosFourteenCampaignLimits extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountIosFourteenCampaignLimitsFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountIosFourteenCampaignLimitsFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -30,6 +30,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountMatchedSearchApplicationsEdgeDataFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountMatchedSearchApplicationsEdgeDataAppStoreValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -38,19 +39,21 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountMatchedSearchApplicationsE
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountMatchedSearchApplicationsEdgeData extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountMatchedSearchApplicationsEdgeDataFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountMatchedSearchApplicationsEdgeDataFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['AppStore'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountMatchedSearchApplicationsEdgeDataAppStoreValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountMatchedSearchApplicationsEdgeData extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountMatchedSearchApplicationsEdgeDataFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountMatchedSearchApplicationsEdgeDataFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['AppStore'] = AdAccountMatchedSearchApplicationsEdgeDataAppStoreValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountMaxBidFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountMaxBidFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountMaxBid extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountMaxBidFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountMaxBidFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountMaxBid extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountMaxBidFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountMaxBidFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountPromotableObjectsFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountPromotableObjectsFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountPromotableObjects extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountPromotableObjectsFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountPromotableObjectsFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountPromotableObjects extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountPromotableObjectsFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountPromotableObjectsFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountReachEstimateFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountReachEstimateFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountReachEstimate extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountReachEstimateFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountReachEstimateFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountReachEstimate extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountReachEstimateFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountReachEstimateFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountRecommendedCamapaignBudgetFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountRecommendedCamapaignBudget
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountRecommendedCamapaignBudget extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountRecommendedCamapaignBudgetFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountRecommendedCamapaignBudgetFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountRecommendedCamapaignBudget extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountRecommendedCamapaignBudgetFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountRecommendedCamapaignBudgetFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountSubscribedAppsFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,25 +38,27 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountSubscribedAppsFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountSubscribedApps extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint()
|
||||
{
|
||||
return 'subscribed_apps';
|
||||
}
|
||||
/**
|
||||
* @return AdAccountSubscribedAppsFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountSubscribedAppsFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountSubscribedApps extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint() {
|
||||
return 'subscribed_apps';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdAccountSubscribedAppsFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountSubscribedAppsFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -35,6 +35,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedModeValues
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedObjectiveValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedRegulatedCategoriesValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedWhitelistedTypesValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -43,24 +44,26 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedWhiteliste
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountTargetingUnified extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountTargetingUnifiedFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountTargetingUnifiedFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['LimitType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedLimitTypeValues::getInstance()->getValues();
|
||||
$ref_enums['RegulatedCategories'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedRegulatedCategoriesValues::getInstance()->getValues();
|
||||
$ref_enums['WhitelistedTypes'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedWhitelistedTypesValues::getInstance()->getValues();
|
||||
$ref_enums['AppStore'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedAppStoreValues::getInstance()->getValues();
|
||||
$ref_enums['Objective'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedObjectiveValues::getInstance()->getValues();
|
||||
$ref_enums['Mode'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAccountTargetingUnifiedModeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountTargetingUnified extends AbstractCrudObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountTargetingUnifiedFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountTargetingUnifiedFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['LimitType'] = AdAccountTargetingUnifiedLimitTypeValues::getInstance()->getValues();
|
||||
$ref_enums['RegulatedCategories'] = AdAccountTargetingUnifiedRegulatedCategoriesValues::getInstance()->getValues();
|
||||
$ref_enums['WhitelistedTypes'] = AdAccountTargetingUnifiedWhitelistedTypesValues::getInstance()->getValues();
|
||||
$ref_enums['AppStore'] = AdAccountTargetingUnifiedAppStoreValues::getInstance()->getValues();
|
||||
$ref_enums['Objective'] = AdAccountTargetingUnifiedObjectiveValues::getInstance()->getValues();
|
||||
$ref_enums['Mode'] = AdAccountTargetingUnifiedModeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountTrackingDataFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountTrackingDataFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountTrackingData extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAccountTrackingDataFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountTrackingDataFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAccountTrackingData extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAccountTrackingDataFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountTrackingDataFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountUserFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,33 +38,39 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountUserFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAccountUser extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint()
|
||||
{
|
||||
return 'users';
|
||||
}
|
||||
/**
|
||||
* @return AdAccountUserFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAccountUserFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
public function getAdAccounts(array $fields = array(), array $params = array())
|
||||
{
|
||||
return $this->getManyByConnection(\PYS_PRO_GLOBAL\FacebookAds\Object\AdAccount::className(), $fields, $params);
|
||||
}
|
||||
public function getAdAccountGroups(array $fields = array(), array $params = array())
|
||||
{
|
||||
return $this->getManyByConnection(\PYS_PRO_GLOBAL\FacebookAds\Object\AdAccountGroup::className(), $fields, $params);
|
||||
}
|
||||
|
||||
class AdAccountUser extends AbstractCrudObject {
|
||||
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint() {
|
||||
return 'users';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdAccountUserFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAccountUserFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
public function getAdAccounts(
|
||||
array $fields = array(), array $params = array()) {
|
||||
return $this->getManyByConnection(AdAccount::className(), $fields, $params);
|
||||
}
|
||||
|
||||
public function getAdAccountGroups(
|
||||
array $fields = array(), array $params = array()) {
|
||||
return $this->getManyByConnection(
|
||||
AdAccountGroup::className(),
|
||||
$fields,
|
||||
$params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -32,6 +32,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdActivityFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdActivityCategoryValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdActivityDataSourceValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdActivityEventTypeValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -40,21 +41,23 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdActivityEventTypeValues;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdActivity extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdActivityFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdActivityFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['EventType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdActivityEventTypeValues::getInstance()->getValues();
|
||||
$ref_enums['Category'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdActivityCategoryValues::getInstance()->getValues();
|
||||
$ref_enums['DataSource'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdActivityDataSourceValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdActivity extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdActivityFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdActivityFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['EventType'] = AdActivityEventTypeValues::getInstance()->getValues();
|
||||
$ref_enums['Category'] = AdActivityCategoryValues::getInstance()->getValues();
|
||||
$ref_enums['DataSource'] = AdActivityDataSourceValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -30,6 +30,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAssetFeedSpecCallToActionTypesValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -38,19 +39,21 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAssetFeedSpecCallToActionTypesVal
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpec extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['CallToActionTypes'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAssetFeedSpecCallToActionTypesValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['CallToActionTypes'] = AdAssetFeedSpecCallToActionTypesValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecAssetLabelFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecAssetLabelFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecAssetLabel extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecAssetLabelFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecAssetLabelFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecAssetLabel extends AbstractCrudObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecAssetLabelFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecAssetLabelFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecBodyFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecBodyFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecBody extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecBodyFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecBodyFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecBody extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecBodyFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecBodyFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecCaptionFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecCaptionFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecCaption extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecCaptionFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecCaptionFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecCaption extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecCaptionFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecCaptionFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecDescriptionFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecDescriptionFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecDescription extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecDescriptionFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecDescriptionFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecDescription extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecDescriptionFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecDescriptionFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecGroupRuleFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecGroupRuleFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecGroupRule extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecGroupRuleFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecGroupRuleFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecGroupRule extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecGroupRuleFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecGroupRuleFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecImageFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecImageFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecImage extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecImageFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecImageFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecImage extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecImageFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecImageFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecLinkURLFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecLinkURLFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecLinkURL extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecLinkURLFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecLinkURLFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecLinkURL extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecLinkURLFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecLinkURLFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecTitleFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecTitleFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecTitle extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecTitleFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecTitleFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecTitle extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecTitleFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecTitleFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecVideoFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecVideoFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAssetFeedSpecVideo extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAssetFeedSpecVideoFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAssetFeedSpecVideoFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAssetFeedSpecVideo extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAssetFeedSpecVideoFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAssetFeedSpecVideoFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -30,6 +30,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAsyncRequestFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestStatusesValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -38,39 +39,67 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestStatusesValues;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAsyncRequest extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
/**
|
||||
* @return AdAsyncRequestFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAsyncRequestFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['Statuses'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestStatusesValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_DELETE, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject(), 'NODE', array(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequest(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequest::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
class AdAsyncRequest extends AbstractCrudObject {
|
||||
|
||||
/**
|
||||
* @return AdAsyncRequestFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAsyncRequestFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['Statuses'] = AdAsyncRequestStatusesValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_DELETE,
|
||||
'/',
|
||||
new AbstractCrudObject(),
|
||||
'NODE',
|
||||
array(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/',
|
||||
new AdAsyncRequest(),
|
||||
'NODE',
|
||||
AdAsyncRequest::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -31,6 +31,7 @@ use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAsyncRequestSetFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestSetNotificationModeValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestStatusesValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -39,66 +40,126 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestStatusesValues;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAsyncRequestSet extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint()
|
||||
{
|
||||
return 'asyncadrequestsets';
|
||||
}
|
||||
/**
|
||||
* @return AdAsyncRequestSetFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAsyncRequestSetFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['NotificationMode'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestSetNotificationModeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
public function getRequests(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('statuses' => 'list<statuses_enum>');
|
||||
$enums = array('statuses_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestStatusesValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/requests', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequest(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequest::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_DELETE, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject(), 'NODE', array(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequestSet(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequestSet::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function updateSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('name' => 'string', 'notification_mode' => 'notification_mode_enum', 'notification_uri' => 'string');
|
||||
$enums = array('notification_mode_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdAsyncRequestSetNotificationModeValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequestSet(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdAsyncRequestSet::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
class AdAsyncRequestSet extends AbstractCrudObject {
|
||||
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint() {
|
||||
return 'asyncadrequestsets';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdAsyncRequestSetFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAsyncRequestSetFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['NotificationMode'] = AdAsyncRequestSetNotificationModeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
public function getRequests(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'statuses' => 'list<statuses_enum>',
|
||||
);
|
||||
$enums = array(
|
||||
'statuses_enum' => AdAsyncRequestStatusesValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/requests',
|
||||
new AdAsyncRequest(),
|
||||
'EDGE',
|
||||
AdAsyncRequest::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_DELETE,
|
||||
'/',
|
||||
new AbstractCrudObject(),
|
||||
'NODE',
|
||||
array(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/',
|
||||
new AdAsyncRequestSet(),
|
||||
'NODE',
|
||||
AdAsyncRequestSet::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'name' => 'string',
|
||||
'notification_mode' => 'notification_mode_enum',
|
||||
'notification_uri' => 'string',
|
||||
);
|
||||
$enums = array(
|
||||
'notification_mode_enum' => AdAsyncRequestSetNotificationModeValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_POST,
|
||||
'/',
|
||||
new AdAsyncRequestSet(),
|
||||
'NODE',
|
||||
AdAsyncRequestSet::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAsyncRequestSetNotificationResultFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAsyncRequestSetNotificationResult
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdAsyncRequestSetNotificationResult extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdAsyncRequestSetNotificationResultFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdAsyncRequestSetNotificationResultFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdAsyncRequestSetNotificationResult extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdAsyncRequestSetNotificationResultFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdAsyncRequestSetNotificationResultFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdBidAdjustmentsFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdBidAdjustmentsFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdBidAdjustments extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdBidAdjustmentsFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdBidAdjustmentsFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdBidAdjustments extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdBidAdjustmentsFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdBidAdjustmentsFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,19 +22,19 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
namespace PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignActivityFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyNewValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyOldValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventNewValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventOldValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalNewValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalOldValues;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignActivityFields;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyNewValues;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyOldValues;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventNewValues;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventOldValues;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalNewValues;
|
||||
use PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalOldValues;
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -43,24 +43,24 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalO
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignActivity extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
class AdCampaignActivity extends \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignActivityFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignActivityFields::getInstance();
|
||||
return \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignActivityFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['BidStrategyNew'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyNewValues::getInstance()->getValues();
|
||||
$ref_enums['BidStrategyOld'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyOldValues::getInstance()->getValues();
|
||||
$ref_enums['BillingEventNew'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventNewValues::getInstance()->getValues();
|
||||
$ref_enums['BillingEventOld'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventOldValues::getInstance()->getValues();
|
||||
$ref_enums['OptimizationGoalNew'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalNewValues::getInstance()->getValues();
|
||||
$ref_enums['OptimizationGoalOld'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalOldValues::getInstance()->getValues();
|
||||
$ref_enums['BidStrategyNew'] = \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyNewValues::getInstance()->getValues();
|
||||
$ref_enums['BidStrategyOld'] = \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBidStrategyOldValues::getInstance()->getValues();
|
||||
$ref_enums['BillingEventNew'] = \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventNewValues::getInstance()->getValues();
|
||||
$ref_enums['BillingEventOld'] = \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityBillingEventOldValues::getInstance()->getValues();
|
||||
$ref_enums['OptimizationGoalNew'] = \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalNewValues::getInstance()->getValues();
|
||||
$ref_enums['OptimizationGoalOld'] = \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignActivityOptimizationGoalOldValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
@@ -68,7 +68,7 @@ class AdCampaignActivity extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrud
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdCampaignActivity(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdCampaignActivity::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request = new \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/', new \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\AdCampaignActivity(), 'NODE', \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\Object\AdCampaignActivity::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignBidConstraintFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignBidConstraintFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignBidConstraint extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignBidConstraintFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignBidConstraintFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignBidConstraint extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignBidConstraintFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignBidConstraintFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -30,6 +30,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignDeliveryEstimateFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignDeliveryEstimateOptimizationGoalValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -38,19 +39,21 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignDeliveryEstimateOptimizat
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignDeliveryEstimate extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignDeliveryEstimateFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignDeliveryEstimateFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['OptimizationGoal'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCampaignDeliveryEstimateOptimizationGoalValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignDeliveryEstimate extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignDeliveryEstimateFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignDeliveryEstimateFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['OptimizationGoal'] = AdCampaignDeliveryEstimateOptimizationGoalValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignDeliveryStatsUnsupportedReasonsFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignDeliveryStatsUnsupportedR
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignDeliveryStatsUnsupportedReasons extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignDeliveryStatsUnsupportedReasonsFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignDeliveryStatsUnsupportedReasonsFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignDeliveryStatsUnsupportedReasons extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignDeliveryStatsUnsupportedReasonsFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignDeliveryStatsUnsupportedReasonsFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignFrequencyControlSpecsFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignFrequencyControlSpecsFiel
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignFrequencyControlSpecs extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignFrequencyControlSpecsFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignFrequencyControlSpecsFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignFrequencyControlSpecs extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignFrequencyControlSpecsFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignFrequencyControlSpecsFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignIssuesInfoFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignIssuesInfoFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignIssuesInfo extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignIssuesInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignIssuesInfoFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignIssuesInfo extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignIssuesInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignIssuesInfoFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignLearningStageInfoFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignLearningStageInfoFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignLearningStageInfo extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignLearningStageInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignLearningStageInfoFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignLearningStageInfo extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignLearningStageInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignLearningStageInfoFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignOptimizationEventFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignOptimizationEventFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignOptimizationEvent extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignOptimizationEventFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignOptimizationEventFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignOptimizationEvent extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignOptimizationEventFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignOptimizationEventFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignPacedBidInfoFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignPacedBidInfoFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCampaignPacedBidInfo extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCampaignPacedBidInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCampaignPacedBidInfoFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCampaignPacedBidInfo extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCampaignPacedBidInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCampaignPacedBidInfoFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -35,13 +35,13 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeCategorizationCriteriaValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeCategoryMediaSourceValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeDynamicAdVoiceValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeInstantCheckoutSettingValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeObjectTypeValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeOperatorValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeStatusValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdPreviewAdFormatValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdPreviewRenderTypeValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Traits\AdLabelAwareCrudObjectTrait;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -50,102 +50,209 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Traits\AdLabelAwareCrudObjectTrait;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreative extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject
|
||||
{
|
||||
use AdLabelAwareCrudObjectTrait;
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint()
|
||||
{
|
||||
return 'adcreatives';
|
||||
}
|
||||
/**
|
||||
* @return AdCreativeFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['CallToActionType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeCallToActionTypeValues::getInstance()->getValues();
|
||||
$ref_enums['ObjectType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeObjectTypeValues::getInstance()->getValues();
|
||||
$ref_enums['Status'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeStatusValues::getInstance()->getValues();
|
||||
$ref_enums['ApplinkTreatment'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeApplinkTreatmentValues::getInstance()->getValues();
|
||||
$ref_enums['AuthorizationCategory'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeAuthorizationCategoryValues::getInstance()->getValues();
|
||||
$ref_enums['CategorizationCriteria'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeCategorizationCriteriaValues::getInstance()->getValues();
|
||||
$ref_enums['CategoryMediaSource'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeCategoryMediaSourceValues::getInstance()->getValues();
|
||||
$ref_enums['DynamicAdVoice'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeDynamicAdVoiceValues::getInstance()->getValues();
|
||||
$ref_enums['InstantCheckoutSetting'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeInstantCheckoutSettingValues::getInstance()->getValues();
|
||||
$ref_enums['Operator'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeOperatorValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
protected function setDataTrigger($data)
|
||||
{
|
||||
if (\array_key_exists('id', $data)) {
|
||||
$this->data['creative_id'] = $data['id'];
|
||||
}
|
||||
}
|
||||
public function createAdLabel(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('adlabels' => 'list<Object>');
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, '/adlabels', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getCreativeInsights(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array();
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/creative_insights', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreativeInsights(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreativeInsights::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getPreviews(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('ad_format' => 'ad_format_enum', 'dynamic_asset_label' => 'string', 'dynamic_creative_spec' => 'Object', 'dynamic_customization' => 'Object', 'end_date' => 'datetime', 'height' => 'unsigned int', 'locale' => 'string', 'place_page_id' => 'int', 'post' => 'Object', 'product_item_ids' => 'list<string>', 'render_type' => 'render_type_enum', 'start_date' => 'datetime', 'width' => 'unsigned int');
|
||||
$enums = array('ad_format_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdPreviewAdFormatValues::getInstance()->getValues(), 'render_type_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdPreviewRenderTypeValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/previews', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdPreview(), 'EDGE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdPreview::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('account_id' => 'string', 'adlabels' => 'list<Object>', 'name' => 'string', 'status' => 'status_enum');
|
||||
$enums = array('status_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeStatusValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_DELETE, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractCrudObject(), 'NODE', array(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('thumbnail_height' => 'unsigned int', 'thumbnail_width' => 'unsigned int');
|
||||
$enums = array();
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_GET, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
public function updateSelf(array $fields = array(), array $params = array(), $pending = \false)
|
||||
{
|
||||
$this->assureId();
|
||||
$param_types = array('account_id' => 'string', 'adlabels' => 'list<Object>', 'name' => 'string', 'status' => 'status_enum');
|
||||
$enums = array('status_enum' => \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeStatusValues::getInstance()->getValues());
|
||||
$request = new \PYS_PRO_GLOBAL\FacebookAds\ApiRequest($this->api, $this->data['id'], \PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface::METHOD_POST, '/', new \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative(), 'NODE', \PYS_PRO_GLOBAL\FacebookAds\Object\AdCreative::getFieldsEnum()->getValues(), new \PYS_PRO_GLOBAL\FacebookAds\TypeChecker($param_types, $enums));
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
|
||||
class AdCreative extends AbstractCrudObject {
|
||||
|
||||
use AdLabelAwareCrudObjectTrait;
|
||||
|
||||
/**
|
||||
* @deprecated getEndpoint function is deprecated
|
||||
*/
|
||||
protected function getEndpoint() {
|
||||
return 'adcreatives';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdCreativeFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['CallToActionType'] = AdCreativeCallToActionTypeValues::getInstance()->getValues();
|
||||
$ref_enums['ObjectType'] = AdCreativeObjectTypeValues::getInstance()->getValues();
|
||||
$ref_enums['Status'] = AdCreativeStatusValues::getInstance()->getValues();
|
||||
$ref_enums['ApplinkTreatment'] = AdCreativeApplinkTreatmentValues::getInstance()->getValues();
|
||||
$ref_enums['AuthorizationCategory'] = AdCreativeAuthorizationCategoryValues::getInstance()->getValues();
|
||||
$ref_enums['CategorizationCriteria'] = AdCreativeCategorizationCriteriaValues::getInstance()->getValues();
|
||||
$ref_enums['CategoryMediaSource'] = AdCreativeCategoryMediaSourceValues::getInstance()->getValues();
|
||||
$ref_enums['DynamicAdVoice'] = AdCreativeDynamicAdVoiceValues::getInstance()->getValues();
|
||||
$ref_enums['Operator'] = AdCreativeOperatorValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
protected function setDataTrigger($data) {
|
||||
if (array_key_exists('id', $data)) {
|
||||
$this->data['creative_id'] = $data['id'];
|
||||
}
|
||||
}
|
||||
|
||||
public function createAdLabel(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'adlabels' => 'list<Object>',
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_POST,
|
||||
'/adlabels',
|
||||
new AdCreative(),
|
||||
'EDGE',
|
||||
AdCreative::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getCreativeInsights(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/creative_insights',
|
||||
new AdCreativeInsights(),
|
||||
'EDGE',
|
||||
AdCreativeInsights::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getPreviews(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'ad_format' => 'ad_format_enum',
|
||||
'dynamic_asset_label' => 'string',
|
||||
'dynamic_creative_spec' => 'Object',
|
||||
'dynamic_customization' => 'Object',
|
||||
'end_date' => 'datetime',
|
||||
'height' => 'unsigned int',
|
||||
'locale' => 'string',
|
||||
'place_page_id' => 'int',
|
||||
'post' => 'Object',
|
||||
'product_item_ids' => 'list<string>',
|
||||
'render_type' => 'render_type_enum',
|
||||
'start_date' => 'datetime',
|
||||
'width' => 'unsigned int',
|
||||
);
|
||||
$enums = array(
|
||||
'ad_format_enum' => AdPreviewAdFormatValues::getInstance()->getValues(),
|
||||
'render_type_enum' => AdPreviewRenderTypeValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/previews',
|
||||
new AdPreview(),
|
||||
'EDGE',
|
||||
AdPreview::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'account_id' => 'string',
|
||||
'adlabels' => 'list<Object>',
|
||||
'name' => 'string',
|
||||
'status' => 'status_enum',
|
||||
);
|
||||
$enums = array(
|
||||
'status_enum' => AdCreativeStatusValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_DELETE,
|
||||
'/',
|
||||
new AbstractCrudObject(),
|
||||
'NODE',
|
||||
array(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function getSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'thumbnail_height' => 'unsigned int',
|
||||
'thumbnail_width' => 'unsigned int',
|
||||
);
|
||||
$enums = array(
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_GET,
|
||||
'/',
|
||||
new AdCreative(),
|
||||
'NODE',
|
||||
AdCreative::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) {
|
||||
$this->assureId();
|
||||
|
||||
$param_types = array(
|
||||
'account_id' => 'string',
|
||||
'adlabels' => 'list<Object>',
|
||||
'name' => 'string',
|
||||
'status' => 'status_enum',
|
||||
);
|
||||
$enums = array(
|
||||
'status_enum' => AdCreativeStatusValues::getInstance()->getValues(),
|
||||
);
|
||||
|
||||
$request = new ApiRequest(
|
||||
$this->api,
|
||||
$this->data['id'],
|
||||
RequestInterface::METHOD_POST,
|
||||
'/',
|
||||
new AdCreative(),
|
||||
'NODE',
|
||||
AdCreative::getFieldsEnum()->getValues(),
|
||||
new TypeChecker($param_types, $enums)
|
||||
);
|
||||
$request->addParams($params);
|
||||
$request->addFields($fields);
|
||||
return $pending ? $request : $request->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeAdDisclaimerFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeAdDisclaimerFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeAdDisclaimer extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeAdDisclaimerFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeAdDisclaimerFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeAdDisclaimer extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeAdDisclaimerFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeAdDisclaimerFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeCollectionThumbnailInfoFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeCollectionThumbnailInfoFi
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeCollectionThumbnailInfo extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeCollectionThumbnailInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeCollectionThumbnailInfoFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeCollectionThumbnailInfo extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeCollectionThumbnailInfoFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeCollectionThumbnailInfoFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
||||
* use, copy, modify, and distribute this software in source code or binary
|
||||
* form for use in connection with the web services and APIs provided by
|
||||
* Facebook.
|
||||
*
|
||||
* As with any software that integrates with the Facebook platform, your use
|
||||
* of this software is subject to the Facebook Developer Principles and
|
||||
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
||||
* shall be included in all copies or substantial portions of the software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeDegreesOfFreedomSpecFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
* For any issues or feature requests related to this class, please let us know
|
||||
* on github and we'll fix in our codegen framework. We'll not be able to accept
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
|
||||
class AdCreativeDegreesOfFreedomSpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeDegreesOfFreedomSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeDegreesOfFreedomSpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeInsightsFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeInsightsFields;
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeInsights extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeInsightsFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeInsightsFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeInsights extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeInsightsFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeInsightsFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeInteractiveComponentsSpecFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeInteractiveComponentsSpec
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeInteractiveComponentsSpec extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeInteractiveComponentsSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeInteractiveComponentsSpecFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeInteractiveComponentsSpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeInteractiveComponentsSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeInteractiveComponentsSpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -31,6 +31,7 @@ use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataAttachmentStyleValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataFormatOptionValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -39,20 +40,22 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataFormatOptionValue
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkData extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['AttachmentStyle'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataAttachmentStyleValues::getInstance()->getValues();
|
||||
$ref_enums['FormatOption'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataFormatOptionValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkData extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['AttachmentStyle'] = AdCreativeLinkDataAttachmentStyleValues::getInstance()->getValues();
|
||||
$ref_enums['FormatOption'] = AdCreativeLinkDataFormatOptionValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataAppLinkSpecFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataAppLinkSpecFields
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataAppLinkSpec extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataAppLinkSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataAppLinkSpecFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataAppLinkSpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataAppLinkSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataAppLinkSpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -30,6 +30,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataCallToActionFields;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataCallToActionTypeValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -38,19 +39,21 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataCallToActionTypeV
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataCallToAction extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataCallToActionFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataCallToActionFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['Type'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataCallToActionTypeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataCallToAction extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataCallToActionFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataCallToActionFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['Type'] = AdCreativeLinkDataCallToActionTypeValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataCallToActionValueFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataCallToActionValue
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataCallToActionValue extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataCallToActionValueFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataCallToActionValueFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataCallToActionValue extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataCallToActionValueFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataCallToActionValueFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataChildAttachmentFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataChildAttachmentFi
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataChildAttachment extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataChildAttachmentFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataChildAttachmentFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataChildAttachment extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataChildAttachmentFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataChildAttachmentFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -36,6 +36,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecLay
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecOverlayPositionValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecOverlayShapeValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecTextFontValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -44,25 +45,27 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecTex
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataImageLayerSpec extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataImageLayerSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataImageLayerSpecFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['BlendingMode'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecBlendingModeValues::getInstance()->getValues();
|
||||
$ref_enums['FrameSource'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecFrameSourceValues::getInstance()->getValues();
|
||||
$ref_enums['ImageSource'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecImageSourceValues::getInstance()->getValues();
|
||||
$ref_enums['LayerType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecLayerTypeValues::getInstance()->getValues();
|
||||
$ref_enums['OverlayPosition'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecOverlayPositionValues::getInstance()->getValues();
|
||||
$ref_enums['OverlayShape'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecOverlayShapeValues::getInstance()->getValues();
|
||||
$ref_enums['TextFont'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageLayerSpecTextFontValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataImageLayerSpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataImageLayerSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataImageLayerSpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['BlendingMode'] = AdCreativeLinkDataImageLayerSpecBlendingModeValues::getInstance()->getValues();
|
||||
$ref_enums['FrameSource'] = AdCreativeLinkDataImageLayerSpecFrameSourceValues::getInstance()->getValues();
|
||||
$ref_enums['ImageSource'] = AdCreativeLinkDataImageLayerSpecImageSourceValues::getInstance()->getValues();
|
||||
$ref_enums['LayerType'] = AdCreativeLinkDataImageLayerSpecLayerTypeValues::getInstance()->getValues();
|
||||
$ref_enums['OverlayPosition'] = AdCreativeLinkDataImageLayerSpecOverlayPositionValues::getInstance()->getValues();
|
||||
$ref_enums['OverlayShape'] = AdCreativeLinkDataImageLayerSpecOverlayShapeValues::getInstance()->getValues();
|
||||
$ref_enums['TextFont'] = AdCreativeLinkDataImageLayerSpecTextFontValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -35,6 +35,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecP
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecTextFontValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecTextTypeValues;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecThemeColorValues;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -43,24 +44,26 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecT
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataImageOverlaySpec extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataImageOverlaySpecFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataImageOverlaySpecFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
$ref_enums['CustomTextType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecCustomTextTypeValues::getInstance()->getValues();
|
||||
$ref_enums['OverlayTemplate'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecOverlayTemplateValues::getInstance()->getValues();
|
||||
$ref_enums['Position'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecPositionValues::getInstance()->getValues();
|
||||
$ref_enums['TextFont'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecTextFontValues::getInstance()->getValues();
|
||||
$ref_enums['TextType'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecTextTypeValues::getInstance()->getValues();
|
||||
$ref_enums['ThemeColor'] = \PYS_PRO_GLOBAL\FacebookAds\Object\Values\AdCreativeLinkDataImageOverlaySpecThemeColorValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataImageOverlaySpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataImageOverlaySpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataImageOverlaySpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
$ref_enums['CustomTextType'] = AdCreativeLinkDataImageOverlaySpecCustomTextTypeValues::getInstance()->getValues();
|
||||
$ref_enums['OverlayTemplate'] = AdCreativeLinkDataImageOverlaySpecOverlayTemplateValues::getInstance()->getValues();
|
||||
$ref_enums['Position'] = AdCreativeLinkDataImageOverlaySpecPositionValues::getInstance()->getValues();
|
||||
$ref_enums['TextFont'] = AdCreativeLinkDataImageOverlaySpecTextFontValues::getInstance()->getValues();
|
||||
$ref_enums['TextType'] = AdCreativeLinkDataImageOverlaySpecTextTypeValues::getInstance()->getValues();
|
||||
$ref_enums['ThemeColor'] = AdCreativeLinkDataImageOverlaySpecThemeColorValues::getInstance()->getValues();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataSponsorshipInfoSpecFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataSponsorshipInfoSp
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataSponsorshipInfoSpec extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataSponsorshipInfoSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataSponsorshipInfoSpecFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataSponsorshipInfoSpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataSponsorshipInfoSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataSponsorshipInfoSpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
@@ -22,6 +21,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PYS_PRO_GLOBAL\FacebookAds\Object;
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\ApiRequest;
|
||||
@@ -29,6 +29,7 @@ use PYS_PRO_GLOBAL\FacebookAds\Cursor;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\RequestInterface;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\TypeChecker;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataTemplateVideoSpecFields;
|
||||
|
||||
/**
|
||||
* This class is auto-generated.
|
||||
*
|
||||
@@ -37,18 +38,20 @@ use PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataTemplateVideoSpec
|
||||
* pull request for this class.
|
||||
*
|
||||
*/
|
||||
class AdCreativeLinkDataTemplateVideoSpec extends \PYS_PRO_GLOBAL\FacebookAds\Object\AbstractObject
|
||||
{
|
||||
/**
|
||||
* @return AdCreativeLinkDataTemplateVideoSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum()
|
||||
{
|
||||
return \PYS_PRO_GLOBAL\FacebookAds\Object\Fields\AdCreativeLinkDataTemplateVideoSpecFields::getInstance();
|
||||
}
|
||||
protected static function getReferencedEnums()
|
||||
{
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
class AdCreativeLinkDataTemplateVideoSpec extends AbstractObject {
|
||||
|
||||
/**
|
||||
* @return AdCreativeLinkDataTemplateVideoSpecFields
|
||||
*/
|
||||
public static function getFieldsEnum() {
|
||||
return AdCreativeLinkDataTemplateVideoSpecFields::getInstance();
|
||||
}
|
||||
|
||||
protected static function getReferencedEnums() {
|
||||
$ref_enums = array();
|
||||
return $ref_enums;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user