diff --git a/src/PushNotifications.php b/src/PushNotifications.php index dcdbe89..6c332f0 100644 --- a/src/PushNotifications.php +++ b/src/PushNotifications.php @@ -9,7 +9,7 @@ * Used to publish notifications to the Pusher Push Notifications API * http://www.pusher.com/push-notifications */ -class PushNotifications { +class PushNotifications implements PushNotificationsInterface { const SDK_VERSION = "2.0.0"; const MAX_INTERESTS = 100; const MAX_INTEREST_LENGTH = 164; diff --git a/src/PushNotificationsInterface.php b/src/PushNotificationsInterface.php new file mode 100644 index 0000000..da4dbee --- /dev/null +++ b/src/PushNotificationsInterface.php @@ -0,0 +1,63 @@ + $publishRequest + * An array of parameters to add to the request body + * + * @return mixed + * An array containing the publish response body. + * + * @throws \Exception + * @see https://pusher.com/docs/beams/concepts/device-interests + */ + public function publishToInterests(array $interests, array $publishRequest): mixed; + + /** + * Securely send notifications to individual users of your application using Authenticated Users. + * + * @param array $userIds + * Array of ids of users to send the push notification to, ranging from 1 to 1000 per publish request. + * @param array $publishRequest + * An array of parameters to add to the request body + * + * @return mixed + * An array containing the publish response body. + * + * @throws \Exception + */ + public function publishToUsers(array $userIds, array $publishRequest): mixed; + + /** + * Remove the given user (and all of their devices) from Beams. This user will no longer receive any notifications and all state stored about their devices will be deleted. + * + * @param string $userId + * The id of the user you would like to remove from Beams. + * + * @throws \Exception + */ + public function deleteUser(string $userId): void; + + /** + * Generate a Beams auth token to allow a user to associate their device with their user id. The token is valid for 24 hours. + * + * @param string $userId + * The id of the user you would like to generate a Beams auth token for. + * + * @return array + * An array containing the token key. + */ + public function generateToken(string $userId): array; +}