You are here

interface PardotClientInterface in Pardot Integration 2.x

Interface for the Pardot API service.

@package Drupal\pardot\Service

Hierarchy

Expanded class hierarchy of PardotClientInterface

All classes that implement PardotClientInterface

File

src/Service/PardotClientInterface.php, line 10

Namespace

Drupal\pardot\Service
View source
interface PardotClientInterface {

  /**
   * Return true if we have all the info to potentially make a proper api call.
   *
   * @return bool
   *   Bool true or false
   */
  public function isInit();

  /**
   * Authenticate into Pardot API and return the API Key.
   *
   * API keys are saved and reused for 50 minutes.
   *
   *  @param array $refresh
   *   if we are getting a new token
   *
   * @return null|string
   *   API key, if found. NULL on failure.
   */
  public function authenticate($refresh);

  /**
   * Retry the original operation with fresh token.
   *
   * @param $url
   *   The original url to post to again.
   * @param $request_data
   *   The original request data to try again.
   *
   * @return mixed
   *   Return the function call with the retry flag.
   */
  public function retry($url, $request_data);

  /**
   * Execute the Pardot API operation.
   *
   * @param string $url
   *   Endpoint URL.
   * @param array $request_data
   *   Data to pass into the request.
   * @param bool $retry
   *   Flag to know if this is a retry or not.
   * @param string $method
   *   (Optional) Request method to use. Defaults to POST.
   *
   * @return mixed
   *   Request result. Usually an array, or FALSE on error.
   */
  public function executePardotOperation(string $url, array $request_data, $retry, $method = 'POST');

  /**
   * Retrieve a Pardot Prospect ID using an email address.
   *
   * @param string $visitor_email
   *   The email address to use to look up a Pardot Prospect ID.
   *
   * @return mixed
   *   The Prospect ID (integer) if found, or an empty string on error.
   */
  public function getPardotProspect(string $visitor_email);

  /**
   * Assigns activity for a Visitor ID to a Prospect ID in Pardot.
   *
   * @param string $visitor_id
   *   The Pardot Visitor ID to assign to a Prospect ID.
   * @param string $prospect_id
   *   The Pardot Prospect ID to which to assign a Visitor ID.
   *
   * @return boolean
   *   TRUE if the Visitor ID is successfully assigned to the Prospect ID; False
   *   otherwise.
   */
  public function assignPardotProspect(string $visitor_id, string $prospect_id);

}

Members

Namesort descending Modifiers Type Description Overrides
PardotClientInterface::assignPardotProspect public function Assigns activity for a Visitor ID to a Prospect ID in Pardot. 1
PardotClientInterface::authenticate public function Authenticate into Pardot API and return the API Key. 1
PardotClientInterface::executePardotOperation public function Execute the Pardot API operation. 1
PardotClientInterface::getPardotProspect public function Retrieve a Pardot Prospect ID using an email address. 1
PardotClientInterface::isInit public function Return true if we have all the info to potentially make a proper api call. 1
PardotClientInterface::retry public function Retry the original operation with fresh token. 1