You are here

PardotClientInterface.php in Pardot Integration 2.x

File

src/Service/PardotClientInterface.php
View source
<?php

namespace Drupal\pardot\Service;


/**
 * Interface for the Pardot API service.
 *
 * @package Drupal\pardot\Service
 */
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);

}

Interfaces

Namesort descending Description
PardotClientInterface Interface for the Pardot API service.