-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from owenvoke/feature/notifications
feat: add support for Notifications
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace OhDear\PhpSdk\Actions; | ||
|
||
use OhDear\PhpSdk\Resources\NotificationDestination; | ||
|
||
trait ManagesNotifications | ||
{ | ||
/** @return array<int, NotificationDestination> */ | ||
public function teamNotificationDestinations(): array | ||
{ | ||
return $this->transformCollection( | ||
$this->get('team-notification-destinations')['data'], | ||
NotificationDestination::class | ||
); | ||
} | ||
|
||
/** @return array<int, NotificationDestination> */ | ||
public function siteNotificationDestinations(int $siteId): array | ||
{ | ||
return $this->transformCollection( | ||
$this->get("sites/{$siteId}/notification-destinations")['data'], | ||
NotificationDestination::class | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace OhDear\PhpSdk\Resources; | ||
|
||
class NotificationDestination extends ApiResource | ||
{ | ||
public int $id; | ||
|
||
public ?int $teamId = null; | ||
|
||
public string $channel; | ||
|
||
/** @var array<string, mixed> */ | ||
public array $destination; | ||
|
||
/** @var array<int, string> */ | ||
public array $notificationTypes; | ||
} |