Skip to content

Commit 25f3e65

Browse files
committed
remove auth/method comments, add required scope comments
1 parent 422b58c commit 25f3e65

14 files changed

Lines changed: 98 additions & 20 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from twitch.queries import query
77

88

9+
# required scope: None
910
@query
1011
def get_cheermotes(channel_id=None):
1112
q = Qry('bits/actions')

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from twitch.queries import query
88

99

10+
# required scope: any/none
1011
@query
1112
def get_posts(channel_id, limit=10, cursor='MA==', comments=5):
1213
q = Qry('feed/{channel_id}/posts')
@@ -17,6 +18,7 @@ def get_posts(channel_id, limit=10, cursor='MA==', comments=5):
1718
return q
1819

1920

21+
# required scope: any/none
2022
@query
2123
def get_post(channel_id, post_id, comments=5):
2224
q = Qry('feed/{channel_id}/posts/{post_id}')
@@ -26,6 +28,7 @@ def get_post(channel_id, post_id, comments=5):
2628
return q
2729

2830

31+
# required scope: channel_feed_edit
2932
@query
3033
def create_post(channel_id, content, share=Boolean.FALSE):
3134
q = Qry('feed/{channel_id}/posts/', method=methods.POST)
@@ -35,6 +38,7 @@ def create_post(channel_id, content, share=Boolean.FALSE):
3538
return q
3639

3740

41+
# required scope: channel_feed_edit
3842
@query
3943
def delete_post(channel_id, post_id):
4044
q = Qry('feed/{channel_id}/posts/{post_id}', method=methods.DELETE)
@@ -43,6 +47,7 @@ def delete_post(channel_id, post_id):
4347
return q
4448

4549

50+
# required scope: channel_feed_edit
4651
@query
4752
def create_post_reaction(channel_id, post_id, emote_id):
4853
q = Qry('feed/{channel_id}/posts/{post_id}/reactions', method=methods.POST)
@@ -52,6 +57,7 @@ def create_post_reaction(channel_id, post_id, emote_id):
5257
return q
5358

5459

60+
# required scope: channel_feed_edit
5561
@query
5662
def delete_post_reaction(channel_id, post_id, emote_id):
5763
q = Qry('feed/{channel_id}/posts/{post_id}/reactions', method=methods.DELETE)
@@ -61,6 +67,7 @@ def delete_post_reaction(channel_id, post_id, emote_id):
6167
return q
6268

6369

70+
# required scope: any/none
6471
@query
6572
def get_comments(channel_id, post_id, limit=10, cursor='MA=='):
6673
q = Qry('feed/{channel_id}/posts/{post_id}/comments')
@@ -71,6 +78,7 @@ def get_comments(channel_id, post_id, limit=10, cursor='MA=='):
7178
return q
7279

7380

81+
# required scope: channel_feed_edit
7482
@query
7583
def comment(channel_id, post_id, content):
7684
q = Qry('feed/{channel_id}/posts/{post_id}/comments', method=methods.POST)
@@ -80,6 +88,7 @@ def comment(channel_id, post_id, content):
8088
return q
8189

8290

91+
# required scope: channel_feed_edit
8392
@query
8493
def delete_comment(channel_id, post_id, comment_id):
8594
q = Qry('feed/{channel_id}/posts/{post_id}/comments/{comment_id}', method=methods.DELETE)
@@ -89,6 +98,7 @@ def delete_comment(channel_id, post_id, comment_id):
8998
return q
9099

91100

101+
# required scope: channel_feed_edit
92102
@query
93103
def create_comment_reaction(channel_id, post_id, comment_id, emote_id):
94104
q = Qry('feed/{channel_id}/posts/{post_id}/comments/{comment_id}/reactions', method=methods.POST)
@@ -99,6 +109,7 @@ def create_comment_reaction(channel_id, post_id, comment_id, emote_id):
99109
return q
100110

101111

112+
# required scope: channel_feed_edit
102113
@query
103114
def delete_comment_reaction(channel_id, post_id, comment_id, emote_id):
104115
q = Qry('feed/{channel_id}/posts/{post_id}/comments/{comment_id}/reactions', method=methods.DELETE)

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@
22
# https://dev.twitch.tv/docs/v5/reference/channels/
33

44
from twitch import keys, methods
5+
from twitch.api.parameters import Boolean, BroadcastType, Cursor, Direction, Duration, Language, VideoSort
56
from twitch.queries import V5Query as Qry
67
from twitch.queries import query
7-
from twitch.api.parameters import Boolean, BroadcastType, Cursor, Direction, Duration, Language, VideoSort
88

99

10+
# required scope: channel_read
1011
@query
1112
def get_channel():
1213
q = Qry('channels')
1314
return q
1415

1516

17+
# required scope: none
1618
@query
1719
def get_channel_by_id(channel_id):
1820
q = Qry('channels/{channel_id}')
1921
q.add_urlkw(keys.CHANNEL_ID, channel_id)
2022
return q
2123

2224

25+
# required scope: channel_editor
2326
@query
2427
def update_channel(channel_id, status=None, game=None, delay=None, channel_feed_enabled=None):
2528
q = Qry('channels/{channel_id}', method=methods.PUT)
@@ -37,13 +40,15 @@ def update_channel(channel_id, status=None, game=None, delay=None, channel_feed_
3740
return q
3841

3942

43+
# required scope: channel_read
4044
@query
4145
def get_channel_editors(channel_id):
4246
q = Qry('channels/{channel_id}/editors')
4347
q.add_urlkw(keys.CHANNEL_ID, channel_id)
4448
return q
4549

4650

51+
# required scope: none
4752
@query
4853
def get_channel_followers(channel_id, limit=25, offset=0, cursor='MA==', direction=Direction.DESC):
4954
q = Qry('channels/{channel_id}/follows')
@@ -55,14 +60,15 @@ def get_channel_followers(channel_id, limit=25, offset=0, cursor='MA==', directi
5560
return q
5661

5762

63+
# required scope: none
5864
@query
5965
def get_channel_teams(channel_id):
6066
q = Qry('channels/{channel_id}/teams')
6167
q.add_urlkw(keys.CHANNEL_ID, channel_id)
6268
return q
6369

6470

65-
# Needs Authentication
71+
# required scope: channel_subscriptions
6672
@query
6773
def get_channel_subscribers(channel_id, limit=25, offset=0, direction=Direction.ASC):
6874
q = Qry('channels/{channel_id}/subscriptions')
@@ -73,15 +79,16 @@ def get_channel_subscribers(channel_id, limit=25, offset=0, direction=Direction.
7379
return q
7480

7581

76-
# Needs Authentication
82+
# required scope: channel_check_subscription
7783
@query
78-
def check_channel_subscription(channel_id, user_id):
84+
def check_subscription(channel_id, user_id):
7985
q = Qry('channels/{channel_id}/subscriptions/{user_id}')
8086
q.add_urlkw(keys.CHANNEL_ID, channel_id)
8187
q.add_urlkw(keys.USER_ID, user_id)
8288
return q
8389

8490

91+
# required scope: none
8592
@query
8693
def get_channel_videos(channel_id, limit=10, offset=0,
8794
broadcast_type=BroadcastType.HIGHLIGHT,
@@ -98,6 +105,7 @@ def get_channel_videos(channel_id, limit=10, offset=0,
98105
return q
99106

100107

108+
# required scope: channel_commercial
101109
@query
102110
def start_commercial(channel_id, duration=30):
103111
q = Qry('channels/{channel_id}/commercial', method=methods.POST)
@@ -106,20 +114,23 @@ def start_commercial(channel_id, duration=30):
106114
return q
107115

108116

117+
# required scope: channel_stream
109118
@query
110119
def reset_stream_key(channel_id):
111120
q = Qry('channels/{channel_id}/stream_key', method=methods.DELETE)
112121
q.add_urlkw(keys.CHANNEL_ID, channel_id)
113122
return q
114123

115124

125+
# required scope: channel_editor
116126
@query
117127
def get_channel_community(channel_id):
118128
q = Qry('channels/{channel_id}/community')
119129
q.add_urlkw(keys.CHANNEL_ID, channel_id)
120130
return q
121131

122132

133+
# required scope: channel_editor
123134
@query
124135
def set_channel_community(channel_id, community_id):
125136
q = Qry('channels/{channel_id}/community/{community_id}', method=methods.PUT)
@@ -128,6 +139,7 @@ def set_channel_community(channel_id, community_id):
128139
return q
129140

130141

142+
# required scope: channel_editor
131143
@query
132144
def delete_channel_from_community(channel_id):
133145
q = Qry('channels/{channel_id}/community', method=methods.DELETE)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@
66
from twitch.queries import query
77

88

9+
# required scope: none
910
@query
1011
def get_emoticons_by_set(emotesets=None):
1112
q = Qry('chat/emoticon_images')
1213
q.add_param(keys.EMOTESETS, emotesets, None)
1314
return q
1415

1516

17+
# required scope: none
1618
@query
1719
def get_badges_by_channel(channel_id):
1820
q = Qry('chat/{channel_id}/badges')
1921
q.add_urlkw(keys.CHANNEL_ID, channel_id)
2022
return q
2123

2224

25+
# required scope: none
2326
@query
2427
def get_all_emoticons():
2528
q = Qry('chat/emoticons')

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
# https://dev.twitch.tv/docs/v5/reference/collections/
33

44
from twitch import keys, methods
5+
from twitch.api.parameters import Boolean, Cursor
56
from twitch.queries import V5Query as Qry
67
from twitch.queries import query
7-
from twitch.api.parameters import Boolean, Cursor
88

99

10+
# required scope: none
1011
@query
1112
def get_collection_metadata(collection_id):
1213
q = Qry('collections/{collection_id}')
1314
q.add_urlkw(keys.COLLECTION_ID, collection_id)
1415
return q
1516

1617

18+
# required scope: none
1719
@query
1820
def get_collection(collection_id, include_all=Boolean.FALSE):
1921
q = Qry('collections/{collection_id}/items')
@@ -22,6 +24,7 @@ def get_collection(collection_id, include_all=Boolean.FALSE):
2224
return q
2325

2426

27+
# required scope: none
2528
@query
2629
def get_collections(channel_id, limit=10, cursor='MA==', containing_item=None):
2730
q = Qry('channels/{channel_id}/collections')
@@ -32,6 +35,7 @@ def get_collections(channel_id, limit=10, cursor='MA==', containing_item=None):
3235
return q
3336

3437

38+
# required scope: collections_edit
3539
@query
3640
def create_collection(channel_id, title):
3741
q = Qry('channels/{channel_id}/collections', method=methods.POST)
@@ -40,6 +44,7 @@ def create_collection(channel_id, title):
4044
return q
4145

4246

47+
# required scope: collections_edit
4348
@query
4449
def update_collection(collection_id, title):
4550
q = Qry('collections/{collection_id}', method=methods.PUT)
@@ -48,6 +53,7 @@ def update_collection(collection_id, title):
4853
return q
4954

5055

56+
# required scope: collections_edit
5157
@query
5258
def create_collection_thumbnail(collection_id, item_id):
5359
q = Qry('collections/{collection_id}/thumbnail', method=methods.PUT)
@@ -56,13 +62,15 @@ def create_collection_thumbnail(collection_id, item_id):
5662
return q
5763

5864

65+
# required scope: collections_edit
5966
@query
60-
def create_collection(collection_id):
67+
def delete_collection(collection_id):
6168
q = Qry('collections/{collection_id}', method=methods.DELETE)
6269
q.add_urlkw(keys.COLLECTION_ID, collection_id)
6370
return q
6471

6572

73+
# required scope: collections_edit
6674
@query
6775
def add_to_collection(collection_id, video_id):
6876
q = Qry('collections/{collection_id}/items', method=methods.POST)
@@ -72,6 +80,7 @@ def add_to_collection(collection_id, video_id):
7280
return q
7381

7482

83+
# required scope: collections_edit
7584
@query
7685
def delete_from_collection(collection_id, item_id):
7786
q = Qry('collections/{collection_id}/items/{item_id}', method=methods.DELETE)
@@ -80,6 +89,7 @@ def delete_from_collection(collection_id, item_id):
8089
return q
8190

8291

92+
# required scope: collections_edit
8393
@query
8494
def move_in_collection(collection_id, item_id, position):
8595
q = Qry('collections/{collection_id}/items/{item_id}', method=methods.PUT)

0 commit comments

Comments
 (0)