You are here

public function SendinblueApiV2::getUser in SendinBlue 8

Same name and namespace in other branches
  1. 8.2 src/Tools/Api/SendinblueApiV2.php \Drupal\sendinblue\Tools\Api\SendinblueApiV2::getUser()

Get user by email.

Parameters

string $email: An email address.

Return value

\Drupal\sendinblue\Tools\Model\GetExtendedContactDetails An array of response code.

Overrides SendInBlueApiInterface::getUser

File

src/Tools/Api/SendinblueApiV2.php, line 239

Class

SendinblueApiV2
Sendinblue REST client.

Namespace

Drupal\sendinblue\Tools\Api

Code

public function getUser($email) {
  $contactInfo = $this->sIBHttpClient
    ->get("user/" . $email, "");
  if (empty($contactInfo['data'])) {
    return NULL;
  }
  return new GetExtendedContactDetails([
    'email' => $contactInfo['data']['email'],
    'emailBlacklisted' => $contactInfo['data']['blacklisted'],
    'smsBlacklisted' => $contactInfo['data']['blacklisted_sms'],
    'createdAt' => $contactInfo['data']['entered'],
    'modifiedAt' => $contactInfo['data']['entered'],
    'listIds' => $contactInfo['data']['listid'],
  ]);
}