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
20 changes: 20 additions & 0 deletions resources/lib/twitch/api/v5/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,24 @@ def reset_stream_key(channel_id):


# required scope: channel_editor
# deprecated
@query
def get_community(channel_id):
q = Qry('channels/{channel_id}/community')
q.add_urlkw(keys.CHANNEL_ID, channel_id)
return q


# required scope: none
@query
def get_communities(channel_id):
q = Qry('channels/{channel_id}/communities', use_token=False)
q.add_urlkw(keys.CHANNEL_ID, channel_id)
return q


# required scope: channel_editor
# deprecated
@query
def set_community(channel_id, community_id):
q = Qry('channels/{channel_id}/community/{community_id}', method=methods.PUT)
Expand All @@ -141,6 +151,16 @@ def set_community(channel_id, community_id):

# required scope: channel_editor
@query
def set_communities(channel_id, community_ids):
q = Qry('channels/{channel_id}/communities', method=methods.PUT)
q.add_urlkw(keys.CHANNEL_ID, channel_id)
q.add_data(keys.COMMUNITY_IDS, community_ids)
return q


# required scope: channel_editor
# deprecated action: act on single community, new action: act on all communities
@query
def delete_from_community(channel_id):
q = Qry('channels/{channel_id}/community', method=methods.DELETE)
q.add_urlkw(keys.CHANNEL_ID, channel_id)
Expand Down
1 change: 1 addition & 0 deletions resources/lib/twitch/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
COMMENTS = 'comments'
COMMUNITIES = 'communities'
COMMUNITY_ID = 'community_id'
COMMUNITY_IDS = 'community_ids'
CONTAINING_ITEM = 'containing_item'
CONTENT = 'content'
COVER_IMAGE = 'cover_image'
Expand Down