public function SendinblueApiV3::createUpdateUser in SendinBlue 8
Same name and namespace in other branches
- 8.2 src/Tools/Api/SendinblueApiV3.php \Drupal\sendinblue\Tools\Api\SendinblueApiV3::createUpdateUser()
Create and update user.
Parameters
string $email: An email address of user.
array $attributes: An attributes to update.
array $blacklisted: An array of black user.
string $listid: A new listid.
string $listid_unlink: A link unlink.
Overrides SendInBlueApiInterface::createUpdateUser
File
- src/
Tools/ Api/ SendinblueApiV3.php, line 301
Class
- SendinblueApiV3
- Sendinblue REST client.
Namespace
Drupal\sendinblue\Tools\ApiCode
public function createUpdateUser($email, array $attributes = [], array $blacklisted = [], $listid = '', $listid_unlink = '') {
$isContactExist = $this
->getUser($email) !== NULL;
if ($isContactExist) {
$updateContact = new UpdateContact([
'attributes' => (object) $attributes,
'emailBlacklisted' => (bool) $blacklisted,
'listIds' => [
(int) $listid[0],
],
'unlinkListIds' => $listid_unlink,
]);
$this->sibContactsApi
->updateContact($email, $updateContact);
}
else {
$updateContact = new CreateContact([
'email' => $email,
'attributes' => (object) $attributes,
'emailBlacklisted' => (bool) $blacklisted,
'listIds' => [
(int) $listid[0],
],
'unlinkListIds' => $listid_unlink,
]);
$this->sibContactsApi
->createContact($updateContact);
}
}