Skip to content

Commit

Permalink
Merge pull request #318 from gldrenthe89/master
Browse files Browse the repository at this point in the history
Add missing properties and valid events to Webhook class
  • Loading branch information
miguelrs authored Jul 31, 2024
2 parents 80d7c9a + 91f4052 commit 7ce4fe1
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions src/Webhooks/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ class Webhook implements Hydratable, Extractable
];

public const VALID_EVENTS = [
'beacon.chat.created',
'beacon.chat.customer.replied',
'convo.agent.reply.created',
'convo.assigned',
'convo.created',
'convo.custom-fields',
'convo.customer.reply.created',
'convo.deleted',
'convo.merged',
Expand All @@ -30,10 +33,13 @@ class Webhook implements Hydratable, Extractable
'convo.status',
'convo.tags',
'customer.created',
'customer.deleted',
'customer.updated',
'message.survey.response.received',
'satisfaction.ratings',
'beacon.chat.created',
'beacon.chat.customer.replied',
'tag.created',
'tag.deleted',
'tag.updated',
];

/**
Expand All @@ -51,6 +57,16 @@ class Webhook implements Hydratable, Extractable
*/
private $url;

/**
* @var string
*/
private $label;

/**
* @var bool
*/
private $notification;

/**
* @var array
*/
Expand All @@ -67,6 +83,8 @@ public function hydrate(array $data, array $embedded = []): void
$this->setState($data['state'] ?? null);
$this->setEvents($data['events'] ?? null);
$this->setUrl($data['url'] ?? null);
$this->setLabel($data['label'] ?? null);
$this->setNotification($data['notification'] ?? null);
$this->setSecret($data['secret'] ?? null);
}

Expand All @@ -77,6 +95,8 @@ public function extract(): array
'url' => $this->getUrl(),
'state' => $this->getState(),
'events' => $this->getEvents(),
'label' => $this->getLabel(),
'notification' => $this->getNotification(),
'secret' => $this->getSecret(),
];
}
Expand Down Expand Up @@ -148,6 +168,42 @@ public function setUrl(?string $url): Webhook
return $this;
}

/**
* @return string
*/
public function getLabel(): ?string
{
return $this->label;
}

/**
* @param string $label
*/
public function setLabel(?string $label): Webhook
{
$this->label = $label;

return $this;
}

/**
* @return bool
*/
public function getNotification(): ?bool
{
return $this->notification;
}

/**
* @param string $notification
*/
public function setNotification(?bool $notification): Webhook
{
$this->notification = $notification;

return $this;
}

/**
* @return string
*/
Expand Down

0 comments on commit 7ce4fe1

Please sign in to comment.