Exemplo n.º 1
0
 /**
  * Obtain the WebHook resource for the given identifier.
  *
  * @deprecated since version 1.2. Use WebHookClient.
  * @param string $webHookId
  * @param array $params Parameters.
  * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls
  * @return WebHook
  */
 public static function get($webHookId, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($webHookId, 'webHookId');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array();
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $payLoad = "";
     $chainUrlPrefix = self::getChainUrlPrefix($apiContext);
     $json = self::executeCall("{$chainUrlPrefix}/hooks/{$webHookId}?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     $ret = new WebHook();
     $ret->fromJson($json);
     return $ret;
 }
Exemplo n.º 2
0
 /**
  * Create a new WebHook.
  *
  * @param WebHook $webHook
  * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls
  * @return WebHook
  */
 public function create(WebHook $webHook, $apiContext = null, $restCall = null)
 {
     $payLoad = $webHook->toJSON();
     $chainUrlPrefix = $this->getChainUrlPrefix($apiContext);
     $json = $this->executeCall("{$chainUrlPrefix}/hooks", "POST", $payLoad, null, $apiContext, $restCall);
     $webHook->fromJson($json);
     return $webHook;
 }