You are here

public function MandrillAPI::getSubAccounts in Mandrill 8

Gets a list of sub accounts.

Return value

array

Overrides MandrillAPIInterface::getSubAccounts

1 method overrides MandrillAPI::getSubAccounts()
MandrillTestAPI::getSubAccounts in src/MandrillTestAPI.php
Gets a list of sub accounts.

File

src/MandrillAPI.php, line 93

Class

MandrillAPI
Service class to integrate with Mandrill.

Namespace

Drupal\mandrill

Code

public function getSubAccounts() {
  $accounts = array();
  try {
    if ($mandrill = $this
      ->getAPIObject()) {
      $accounts = $mandrill->subaccounts
        ->getList();
    }
  } catch (\Exception $e) {
    \Drupal::messenger()
      ->addError(t('Mandrill: %message', array(
      '%message' => $e
        ->getMessage(),
    )));
    $this->log
      ->error($e
      ->getMessage());
  }
  return $accounts;
}