Skip to content

Commit 95e0ca4

Browse files
authored
Merge pull request #31 from anxdpanic/dev
[v5] [channels] deprecated notations for community endpoints, add new…
2 parents 7117cf4 + 7446e98 commit 95e0ca4

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,24 @@ def reset_stream_key(channel_id):
123123

124124

125125
# required scope: channel_editor
126+
# deprecated
126127
@query
127128
def get_community(channel_id):
128129
q = Qry('channels/{channel_id}/community')
129130
q.add_urlkw(keys.CHANNEL_ID, channel_id)
130131
return q
131132

132133

134+
# required scope: none
135+
@query
136+
def get_communities(channel_id):
137+
q = Qry('channels/{channel_id}/communities', use_token=False)
138+
q.add_urlkw(keys.CHANNEL_ID, channel_id)
139+
return q
140+
141+
133142
# required scope: channel_editor
143+
# deprecated
134144
@query
135145
def set_community(channel_id, community_id):
136146
q = Qry('channels/{channel_id}/community/{community_id}', method=methods.PUT)
@@ -141,6 +151,16 @@ def set_community(channel_id, community_id):
141151

142152
# required scope: channel_editor
143153
@query
154+
def set_communities(channel_id, community_ids):
155+
q = Qry('channels/{channel_id}/communities', method=methods.PUT)
156+
q.add_urlkw(keys.CHANNEL_ID, channel_id)
157+
q.add_data(keys.COMMUNITY_IDS, community_ids)
158+
return q
159+
160+
161+
# required scope: channel_editor
162+
# deprecated action: act on single community, new action: act on all communities
163+
@query
144164
def delete_from_community(channel_id):
145165
q = Qry('channels/{channel_id}/community', method=methods.DELETE)
146166
q.add_urlkw(keys.CHANNEL_ID, channel_id)

resources/lib/twitch/keys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
COMMENTS = 'comments'
2222
COMMUNITIES = 'communities'
2323
COMMUNITY_ID = 'community_id'
24+
COMMUNITY_IDS = 'community_ids'
2425
CONTAINING_ITEM = 'containing_item'
2526
CONTENT = 'content'
2627
COVER_IMAGE = 'cover_image'

0 commit comments

Comments
 (0)