Skip to content

Commit

Permalink
Merge pull request #1 from PraiseCharts/feat/global-preferences
Browse files Browse the repository at this point in the history
feat: add function for getting & settings global preferences
  • Loading branch information
isaiahdahl authored Sep 5, 2024
2 parents 9303e84 + 0a7529b commit c1d2c47
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Actions/ManagesSubscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,33 @@ public function updateSubscriberPreference($subscriberId, $templateId, array $da
return new Subscriber($subscriber, $this);
}

/* Fetch a subscriber preferences
*
* @param string $subscriberId
* @return \Novu\SDK\Resources\Subscriber
*/
public function getSubscriberGlobalPreferences($subscriberId)
{
$preferences = $this->get("subscribers/{$subscriberId}/preferences/global")['data'];

return new Subscriber($preferences, $this);
}

/**
* Update a given subscribers global preferences [ Come back to this---->]
*
* @param string $subscriberId
* @param string $templateId
* @param array $data
* @return \Novu\SDK\Resources\Subscriber
*/
public function updateSubscriberGlobalPreference($subscriberId, $templateId, array $data)
{
$subscriber = $this->patch("subscribers/{$subscriberId}/preferences", $data)['data'];

return new Subscriber($subscriber, $this);
}

/**
* Update subscriber online status
*
Expand Down

0 comments on commit c1d2c47

Please sign in to comment.