Skip to content

Commit 3f9cd7a

Browse files
committed
simplify function naming
1 parent 25f3e65 commit 3f9cd7a

10 files changed

Lines changed: 61 additions & 61 deletions

File tree

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99

1010
# required scope: channel_read
1111
@query
12-
def get_channel():
12+
def channel():
1313
q = Qry('channels')
1414
return q
1515

1616

1717
# required scope: none
1818
@query
19-
def get_channel_by_id(channel_id):
19+
def by_id(channel_id):
2020
q = Qry('channels/{channel_id}')
2121
q.add_urlkw(keys.CHANNEL_ID, channel_id)
2222
return q
2323

2424

2525
# required scope: channel_editor
2626
@query
27-
def update_channel(channel_id, status=None, game=None, delay=None, channel_feed_enabled=None):
27+
def update(channel_id, status=None, game=None, delay=None, channel_feed_enabled=None):
2828
q = Qry('channels/{channel_id}', method=methods.PUT)
2929
q.add_urlkw(keys.CHANNEL_ID, channel_id)
3030
channel = {}
@@ -42,15 +42,15 @@ def update_channel(channel_id, status=None, game=None, delay=None, channel_feed_
4242

4343
# required scope: channel_read
4444
@query
45-
def get_channel_editors(channel_id):
45+
def get_editors(channel_id):
4646
q = Qry('channels/{channel_id}/editors')
4747
q.add_urlkw(keys.CHANNEL_ID, channel_id)
4848
return q
4949

5050

5151
# required scope: none
5252
@query
53-
def get_channel_followers(channel_id, limit=25, offset=0, cursor='MA==', direction=Direction.DESC):
53+
def get_followers(channel_id, limit=25, offset=0, cursor='MA==', direction=Direction.DESC):
5454
q = Qry('channels/{channel_id}/follows')
5555
q.add_urlkw(keys.CHANNEL_ID, channel_id)
5656
q.add_param(keys.LIMIT, limit, 25)
@@ -62,15 +62,15 @@ def get_channel_followers(channel_id, limit=25, offset=0, cursor='MA==', directi
6262

6363
# required scope: none
6464
@query
65-
def get_channel_teams(channel_id):
65+
def get_teams(channel_id):
6666
q = Qry('channels/{channel_id}/teams')
6767
q.add_urlkw(keys.CHANNEL_ID, channel_id)
6868
return q
6969

7070

7171
# required scope: channel_subscriptions
7272
@query
73-
def get_channel_subscribers(channel_id, limit=25, offset=0, direction=Direction.ASC):
73+
def get_subscribers(channel_id, limit=25, offset=0, direction=Direction.ASC):
7474
q = Qry('channels/{channel_id}/subscriptions')
7575
q.add_urlkw(keys.CHANNEL_ID, channel_id)
7676
q.add_param(keys.LIMIT, limit, 25)
@@ -90,10 +90,10 @@ def check_subscription(channel_id, user_id):
9090

9191
# required scope: none
9292
@query
93-
def get_channel_videos(channel_id, limit=10, offset=0,
94-
broadcast_type=BroadcastType.HIGHLIGHT,
95-
hls=Boolean.FALSE, sort_by=VideoSort.TIME,
96-
language=Language.ALL):
93+
def get_videos(channel_id, limit=10, offset=0,
94+
broadcast_type=BroadcastType.HIGHLIGHT,
95+
hls=Boolean.FALSE, sort_by=VideoSort.TIME,
96+
language=Language.ALL):
9797
q = Qry('channels/{id}/videos')
9898
q.add_urlkw(keys.ID, channel_id)
9999
q.add_param(keys.LIMIT, limit, 10)
@@ -124,15 +124,15 @@ def reset_stream_key(channel_id):
124124

125125
# required scope: channel_editor
126126
@query
127-
def get_channel_community(channel_id):
127+
def get_community(channel_id):
128128
q = Qry('channels/{channel_id}/community')
129129
q.add_urlkw(keys.CHANNEL_ID, channel_id)
130130
return q
131131

132132

133133
# required scope: channel_editor
134134
@query
135-
def set_channel_community(channel_id, community_id):
135+
def set_community(channel_id, community_id):
136136
q = Qry('channels/{channel_id}/community/{community_id}', method=methods.PUT)
137137
q.add_urlkw(keys.CHANNEL_ID, channel_id)
138138
q.add_urlkw(keys.COMMUNITY_ID, community_id)
@@ -141,7 +141,7 @@ def set_channel_community(channel_id, community_id):
141141

142142
# required scope: channel_editor
143143
@query
144-
def delete_channel_from_community(channel_id):
144+
def delete_from_community(channel_id):
145145
q = Qry('channels/{channel_id}/community', method=methods.DELETE)
146146
q.add_urlkw(keys.CHANNEL_ID, channel_id)
147147
return q

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ def get_emoticons_by_set(emotesets=None):
1616

1717
# required scope: none
1818
@query
19-
def get_badges_by_channel(channel_id):
19+
def get_badges(channel_id):
2020
q = Qry('chat/{channel_id}/badges')
2121
q.add_urlkw(keys.CHANNEL_ID, channel_id)
2222
return q
2323

2424

2525
# required scope: none
2626
@query
27-
def get_all_emoticons():
27+
def get_emoticons():
2828
q = Qry('chat/emoticons')
2929
return q

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
# required scope: none
1111
@query
12-
def get_collection_metadata(collection_id):
12+
def get_metadata(collection_id):
1313
q = Qry('collections/{collection_id}')
1414
q.add_urlkw(keys.COLLECTION_ID, collection_id)
1515
return q
1616

1717

1818
# required scope: none
1919
@query
20-
def get_collection(collection_id, include_all=Boolean.FALSE):
20+
def by_id(collection_id, include_all=Boolean.FALSE):
2121
q = Qry('collections/{collection_id}/items')
2222
q.add_urlkw(keys.COLLECTION_ID, collection_id)
2323
q.add_param(keys.INCLUDE_ALL_ITEMS, Boolean.validate(include_all), Boolean.FALSE)
@@ -37,7 +37,7 @@ def get_collections(channel_id, limit=10, cursor='MA==', containing_item=None):
3737

3838
# required scope: collections_edit
3939
@query
40-
def create_collection(channel_id, title):
40+
def create(channel_id, title):
4141
q = Qry('channels/{channel_id}/collections', method=methods.POST)
4242
q.add_urlkw(keys.CHANNEL_ID, channel_id)
4343
q.add_data(keys.TITLE, title)
@@ -46,7 +46,7 @@ def create_collection(channel_id, title):
4646

4747
# required scope: collections_edit
4848
@query
49-
def update_collection(collection_id, title):
49+
def update(collection_id, title):
5050
q = Qry('collections/{collection_id}', method=methods.PUT)
5151
q.add_urlkw(keys.COLLECTION_ID, collection_id)
5252
q.add_data(keys.TITLE, title)
@@ -55,7 +55,7 @@ def update_collection(collection_id, title):
5555

5656
# required scope: collections_edit
5757
@query
58-
def create_collection_thumbnail(collection_id, item_id):
58+
def create_thumbnail(collection_id, item_id):
5959
q = Qry('collections/{collection_id}/thumbnail', method=methods.PUT)
6060
q.add_urlkw(keys.COLLECTION_ID, collection_id)
6161
q.add_data(keys.ITEM_ID, item_id)
@@ -64,7 +64,7 @@ def create_collection_thumbnail(collection_id, item_id):
6464

6565
# required scope: collections_edit
6666
@query
67-
def delete_collection(collection_id):
67+
def delete(collection_id):
6868
q = Qry('collections/{collection_id}', method=methods.DELETE)
6969
q.add_urlkw(keys.COLLECTION_ID, collection_id)
7070
return q

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99

1010
# required scope: none
1111
@query
12-
def get_community_by_name(name):
12+
def by_name(name):
1313
q = Qry('communities')
1414
q.add_param(keys.NAME, name)
1515
return q
1616

1717

1818
# required scope: none
1919
@query
20-
def get_community_by_id(community_id):
20+
def by_id(community_id):
2121
q = Qry('communities/{community_id}')
2222
q.add_urlkw(keys.COMMUNITY_ID, community_id)
2323
return q
2424

2525

2626
# required scope: communities_edit
2727
@query
28-
def update_community(community_id, summary=None, description=None,
29-
rules=None, email=None):
28+
def update(community_id, summary=None, description=None,
29+
rules=None, email=None):
3030
q = Qry('communities/{community_id}', method=methods.PUT)
3131
q.add_urlkw(keys.COMMUNITY_ID, community_id)
3232
q.add_data(keys.SUMMARY, summary)
@@ -38,7 +38,7 @@ def update_community(community_id, summary=None, description=None,
3838

3939
# required scope: none
4040
@query
41-
def get_top_communities(limit=10, cursor='MA=='):
41+
def get_top(limit=10, cursor='MA=='):
4242
q = Qry('communities/top')
4343
q.add_param(keys.LIMIT, limit, 10)
4444
q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
@@ -47,7 +47,7 @@ def get_top_communities(limit=10, cursor='MA=='):
4747

4848
# required scope: communities_moderate
4949
@query
50-
def get_community_bans(community_id, limit=10, cursor='MA=='):
50+
def get_bans(community_id, limit=10, cursor='MA=='):
5151
q = Qry('communities/{community_id}/bans')
5252
q.add_urlkw(keys.COMMUNITY_ID, community_id)
5353
q.add_param(keys.LIMIT, limit, 10)
@@ -57,7 +57,7 @@ def get_community_bans(community_id, limit=10, cursor='MA=='):
5757

5858
# required scope: communities_moderate
5959
@query
60-
def ban_community_user(community_id, user_id):
60+
def ban_user(community_id, user_id):
6161
q = Qry('communities/{community_id}/bans/{user_id}', method=methods.PUT)
6262
q.add_urlkw(keys.COMMUNITY_ID, community_id)
6363
q.add_urlkw(keys.USER_ID, user_id)
@@ -66,7 +66,7 @@ def ban_community_user(community_id, user_id):
6666

6767
# required scope: communities_moderate
6868
@query
69-
def unban_community_user(community_id, user_id):
69+
def unban_user(community_id, user_id):
7070
q = Qry('communities/{community_id}/bans/{user_id}', method=methods.DELETE)
7171
q.add_urlkw(keys.COMMUNITY_ID, community_id)
7272
q.add_urlkw(keys.USER_ID, user_id)
@@ -75,7 +75,7 @@ def unban_community_user(community_id, user_id):
7575

7676
# required scope: communities_edit
7777
@query
78-
def create_community_avatar(community_id, avatar_image):
78+
def create_avatar(community_id, avatar_image):
7979
q = Qry('communities/{community_id}/images/avatar', method=methods.POST)
8080
q.add_urlkw(keys.COMMUNITY_ID, community_id)
8181
q.add_urlkw(keys.AVATAR_IMAGE, avatar_image)
@@ -84,15 +84,15 @@ def create_community_avatar(community_id, avatar_image):
8484

8585
# required scope: communities_edit
8686
@query
87-
def delete_community_avatar(community_id):
87+
def delete_avatar(community_id):
8888
q = Qry('communities/{community_id}/images/avatar', method=methods.DELETE)
8989
q.add_urlkw(keys.COMMUNITY_ID, community_id)
9090
return q
9191

9292

9393
# required scope: communities_edit
9494
@query
95-
def create_community_cover(community_id, cover_image):
95+
def create_cover(community_id, cover_image):
9696
q = Qry('communities/{community_id}/images/cover', method=methods.POST)
9797
q.add_urlkw(keys.COMMUNITY_ID, community_id)
9898
q.add_urlkw(keys.COVER_IMAGE, cover_image)
@@ -101,23 +101,23 @@ def create_community_cover(community_id, cover_image):
101101

102102
# required scope: communities_edit
103103
@query
104-
def delete_community_cover(community_id):
104+
def delete_cover(community_id):
105105
q = Qry('communities/{community_id}/images/cover', method=methods.DELETE)
106106
q.add_urlkw(keys.COMMUNITY_ID, community_id)
107107
return q
108108

109109

110110
# required scope: communities_edit
111111
@query
112-
def get_community_moderators(community_id):
112+
def get_moderators(community_id):
113113
q = Qry('communities/{community_id}/moderators')
114114
q.add_urlkw(keys.COMMUNITY_ID, community_id)
115115
return q
116116

117117

118118
# required scope: communities_edit
119119
@query
120-
def add_community_moderator(community_id, user_id):
120+
def add_moderator(community_id, user_id):
121121
q = Qry('communities/{community_id}/moderators/{user_id}', method=methods.PUT)
122122
q.add_urlkw(keys.COMMUNITY_ID, community_id)
123123
q.add_urlkw(keys.USER_ID, user_id)
@@ -126,7 +126,7 @@ def add_community_moderator(community_id, user_id):
126126

127127
# required scope: communities_edit
128128
@query
129-
def delete_community_moderator(community_id, user_id):
129+
def delete_moderator(community_id, user_id):
130130
q = Qry('communities/{community_id}/moderators/{user_id}', method=methods.DELETE)
131131
q.add_urlkw(keys.COMMUNITY_ID, community_id)
132132
q.add_urlkw(keys.USER_ID, user_id)
@@ -135,15 +135,15 @@ def delete_community_moderator(community_id, user_id):
135135

136136
# required scope: any
137137
@query
138-
def get_community_permissions(community_id):
138+
def get_permissions(community_id):
139139
q = Qry('communities/{community_id}/permissions')
140140
q.add_urlkw(keys.COMMUNITY_ID, community_id)
141141
return q
142142

143143

144144
# required scope: none
145145
@query
146-
def report_community_violation(community_id, channel_id):
146+
def report_violation(community_id, channel_id):
147147
q = Qry('communities/{community_id}/report_channel', method=methods.POST)
148148
q.add_urlkw(keys.COMMUNITY_ID, community_id)
149149
q.add_data(keys.CHANNEL_ID, channel_id)
@@ -152,7 +152,7 @@ def report_community_violation(community_id, channel_id):
152152

153153
# required scope: communities_moderate
154154
@query
155-
def get_community_timeouts(community_id, limit=10, cursor='MA=='):
155+
def get_timeouts(community_id, limit=10, cursor='MA=='):
156156
q = Qry('communities/{community_id}/timeouts')
157157
q.add_urlkw(keys.COMMUNITY_ID, community_id)
158158
q.add_param(keys.LIMIT, limit, 10)
@@ -162,7 +162,7 @@ def get_community_timeouts(community_id, limit=10, cursor='MA=='):
162162

163163
# required scope: communities_moderate
164164
@query
165-
def add_community_timeout(community_id, user_id, duration=1, reason=None):
165+
def add_timeout(community_id, user_id, duration=1, reason=None):
166166
q = Qry('communities/{community_id}/timeouts/{user_id}', method=methods.PUT)
167167
q.add_urlkw(keys.COMMUNITY_ID, community_id)
168168
q.add_urlkw(keys.USER_ID, user_id)
@@ -173,7 +173,7 @@ def add_community_timeout(community_id, user_id, duration=1, reason=None):
173173

174174
# required scope: communities_moderate
175175
@query
176-
def delete_community_timeout(community_id, user_id):
176+
def delete_timeout(community_id, user_id):
177177
q = Qry('communities/{community_id}/timeouts/{user_id}', method=methods.DELETE)
178178
q.add_urlkw(keys.COMMUNITY_ID, community_id)
179179
q.add_urlkw(keys.USER_ID, user_id)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# required scope: none
1010
@query
11-
def get_top_games(limit=10, offset=0):
11+
def get_top(limit=10, offset=0):
1212
q = Qry('games/top')
1313
q.add_param(keys.LIMIT, limit, 10)
1414
q.add_param(keys.OFFSET, offset, 0)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
# required scope: none
99
@query
10-
def get_ingest_servers():
10+
def ingests():
1111
q = Qry('ingests')
1212
return q

0 commit comments

Comments
 (0)