You are here

public function AcquiaLiftAPI::getChoicesForDecision in Acquia Lift Connector 7

Gets a list of choices for the specified agent, decision point and decision.

Parameters

$agent_name: The name of the agent.

$point_name: The name of the decision point.

$decision_name: The name of the decision.

Return value

bool|mixed An array of choices or FALSE if an error occurs.

File

includes/acquia_lift.classes.inc, line 863
Provides an agent type for Acquia Lift

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function getChoicesForDecision($agent_name, $point_name, $decision_name) {
  $url = $this
    ->generateEndpoint("/agent-api/{$agent_name}/points/{$point_name}/decisions/{$decision_name}/choices");
  $response = $this
    ->httpClient()
    ->get($url, array(
    'Accept' => 'application/json',
  ));
  if ($response->code == 200) {
    return json_decode($response->data, TRUE);
  }
  else {
    $this
      ->handleBadResponse($response->code, 'Could not retrieve choices from Acquia Lift', array(), FALSE);
  }
  return FALSE;
}