Skip to content

Commit 83f3f3e

Browse files
Pass params to get notifications API (#237)
1 parent a459d43 commit 83f3f3e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

examples/notifications.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313

1414
# mute a topic
1515
client.topic_set_user_notification_level(1, notification_level: 0)
16+
17+
# get user notifications
18+
client.notifications(username: 'discourse')

lib/discourse_api/api/notifications.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
module DiscourseApi
33
module API
44
module Notifications
5-
def notifications
6-
response = get('/notifications.json')
5+
def notifications(params = {})
6+
params = API.params(params)
7+
.optional(:username, :recent, :limit, :offset, :filter)
8+
9+
response = get('/notifications.json', params)
710
response[:body]
811
end
912
end

0 commit comments

Comments
 (0)