Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- update m3u_pattern
- add initial v5 (wip)
- add support for additional methods in queries (PUT/DELETE/POST)
- v5 add communities, update follow/unfollow
- v5 add communities, update follow/unfollow/blocks
- add basics for implicit oauth2
- update usher base url
</news>
Expand Down
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
- update m3u_pattern
- add initial v5 (wip)
- add support for additional methods in queries (PUT/DELETE/POST)
- v5 add communities, update follow/unfollow
- v5 add communities, update follow/unfollow/blocks
- add basics for implicit oauth2
- update usher base url
24 changes: 18 additions & 6 deletions resources/lib/twitch/api/v5/blocks.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# -*- encoding: utf-8 -*-
# https://github.com/justintv/Twitch-API/blob/master/v3_resources/blocks.md

from twitch import keys
from twitch.queries import V5Query as Qry
from twitch.queries import query


# Needs Authentification
@query
def by_name(user):
raise NotImplementedError
def by_id(identification, limit=25, offset=0):
q = Qry('users/{id}/blocks')
q.add_urlkw(keys.ID, identification)
q.add_param(keys.LIMIT, limit, 25)
q.add_param(keys.OFFSET, offset, 0)
return q


# Needs Authentification, needs PUT
@query
def add_block(user, target):
raise NotImplementedError
def add_block(identification, target):
q = Qry('users/{id}/blocks/{target}', method='PUT')
q.add_urlkw(keys.ID, identification)
q.add_urlkw(keys.TARGET, target)
return q


# Needs Authentification, needs DELETE
@query
def del_block(user, target):
raise NotImplementedError
def del_block(identification, target):
q = Qry('users/{id}/blocks/{target}', method='DELETE')
q.add_urlkw(keys.ID, identification)
q.add_urlkw(keys.TARGET, target)
return q