You are here

public function SendinblueApiV2::getUser in SendinBlue 7.2

Get user by email.

Parameters

string $email: An email address.

Return value

GetExtendedContactDetails An array of response code.

Overrides SendInBlueApiInterface::getUser

File

includes/Api/SendinblueApiV2.php, line 192

Class

SendinblueApiV2
Sendinblue REST client.

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'],
  ]);
}