Skip to content

Commit 2a4e40d

Browse files
committed
update follow/unfollow
1 parent 91c6ffb commit 2a4e40d

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

resources/lib/twitch/api/v5/follows.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from twitch.api.parameters import Direction, SortBy
66
from twitch.queries import V5Query as Qry
77
from twitch.queries import query
8+
from twitch.api.parameters import Boolean
89

910

1011
@query
@@ -30,24 +31,30 @@ def by_id(identification, limit=25, offset=0, direction=Direction.DESC,
3031

3132

3233
@query
33-
def status(user, target):
34-
q = Qry('users/{user}/follows/channels/{target}')
35-
q.add_urlkw(keys.USER, user)
34+
def status(identification, target):
35+
q = Qry('users/{id}/follows/channels/{target}')
36+
q.add_urlkw(keys.ID, identification)
3637
q.add_urlkw(keys.TARGET, target)
3738
return q
3839

3940

4041
# Needs Auth, needs PUT
4142
@query
42-
def follow(user, target):
43-
raise NotImplementedError
43+
def follow(identification, target, notification=Boolean.FALSE):
44+
q = Qry('users/{id}/follows/channels/{target}', method='PUT')
45+
q.add_urlkw(keys.ID, identification)
46+
q.add_urlkw(keys.TARGET, target)
47+
q.add_data('notification', notification)
48+
return q
4449

4550

4651
# Needs Auth, needs DELETE
4752
@query
48-
def unfollow(user, target):
49-
raise NotImplementedError
50-
53+
def unfollow(identification, target):
54+
q = Qry('users/{id}/follows/channels/{target}', method='DELETE')
55+
q.add_urlkw(keys.ID, identification)
56+
q.add_urlkw(keys.TARGET, target)
57+
return q
5158

5259
# Needs Auth
5360
@query

0 commit comments

Comments
 (0)