12
12
13
13
from ... import keys , methods
14
14
from ...api .parameters import Cursor
15
+ from ...log import log
15
16
from ...queries import V5Query as Qry
16
17
from ...queries import query
17
18
19
+ # This endpoint is deprecated
18
20
19
21
# required scope: none
22
+ # deprecated
20
23
@query
21
24
def by_name (name ):
25
+ log .deprecated_endpoint ('communities' )
22
26
q = Qry ('communities' , use_token = False )
23
27
q .add_param (keys .NAME , name )
24
28
return q
25
29
26
30
27
31
# required scope: none
32
+ # deprecated
28
33
@query
29
34
def by_id (community_id ):
35
+ log .deprecated_endpoint ('communities' )
30
36
q = Qry ('communities/{community_id}' , use_token = False )
31
37
q .add_urlkw (keys .COMMUNITY_ID , community_id )
32
38
return q
33
39
34
40
35
41
# required scope: communities_edit
42
+ # deprecated
36
43
@query
37
44
def update (community_id , summary = None , description = None ,
38
45
rules = None , email = None ):
46
+ log .deprecated_endpoint ('communities' )
39
47
q = Qry ('communities/{community_id}' , method = methods .PUT )
40
48
q .add_urlkw (keys .COMMUNITY_ID , community_id )
41
49
q .add_data (keys .SUMMARY , summary )
@@ -46,17 +54,21 @@ def update(community_id, summary=None, description=None,
46
54
47
55
48
56
# required scope: none
57
+ # deprecated
49
58
@query
50
59
def get_top (limit = 10 , cursor = 'MA==' ):
60
+ log .deprecated_endpoint ('communities' )
51
61
q = Qry ('communities/top' , use_token = False )
52
62
q .add_param (keys .LIMIT , limit , 10 )
53
63
q .add_param (keys .CURSOR , Cursor .validate (cursor ), 'MA==' )
54
64
return q
55
65
56
66
57
67
# required scope: communities_moderate
68
+ # deprecated
58
69
@query
59
70
def get_bans (community_id , limit = 10 , cursor = 'MA==' ):
71
+ log .deprecated_endpoint ('communities' )
60
72
q = Qry ('communities/{community_id}/bans' )
61
73
q .add_urlkw (keys .COMMUNITY_ID , community_id )
62
74
q .add_param (keys .LIMIT , limit , 10 )
@@ -65,103 +77,127 @@ def get_bans(community_id, limit=10, cursor='MA=='):
65
77
66
78
67
79
# required scope: communities_moderate
80
+ # deprecated
68
81
@query
69
82
def ban_user (community_id , user_id ):
83
+ log .deprecated_endpoint ('communities' )
70
84
q = Qry ('communities/{community_id}/bans/{user_id}' , method = methods .PUT )
71
85
q .add_urlkw (keys .COMMUNITY_ID , community_id )
72
86
q .add_urlkw (keys .USER_ID , user_id )
73
87
return q
74
88
75
89
76
90
# required scope: communities_moderate
91
+ # deprecated
77
92
@query
78
93
def unban_user (community_id , user_id ):
94
+ log .deprecated_endpoint ('communities' )
79
95
q = Qry ('communities/{community_id}/bans/{user_id}' , method = methods .DELETE )
80
96
q .add_urlkw (keys .COMMUNITY_ID , community_id )
81
97
q .add_urlkw (keys .USER_ID , user_id )
82
98
return q
83
99
84
100
85
101
# required scope: communities_edit
102
+ # deprecated
86
103
@query
87
104
def create_avatar (community_id , avatar_image ):
105
+ log .deprecated_endpoint ('communities' )
88
106
q = Qry ('communities/{community_id}/images/avatar' , method = methods .POST )
89
107
q .add_urlkw (keys .COMMUNITY_ID , community_id )
90
108
q .add_urlkw (keys .AVATAR_IMAGE , avatar_image )
91
109
return q
92
110
93
111
94
112
# required scope: communities_edit
113
+ # deprecated
95
114
@query
96
115
def delete_avatar (community_id ):
116
+ log .deprecated_endpoint ('communities' )
97
117
q = Qry ('communities/{community_id}/images/avatar' , method = methods .DELETE )
98
118
q .add_urlkw (keys .COMMUNITY_ID , community_id )
99
119
return q
100
120
101
121
102
122
# required scope: communities_edit
123
+ # deprecated
103
124
@query
104
125
def create_cover (community_id , cover_image ):
126
+ log .deprecated_endpoint ('communities' )
105
127
q = Qry ('communities/{community_id}/images/cover' , method = methods .POST )
106
128
q .add_urlkw (keys .COMMUNITY_ID , community_id )
107
129
q .add_urlkw (keys .COVER_IMAGE , cover_image )
108
130
return q
109
131
110
132
111
133
# required scope: communities_edit
134
+ # deprecated
112
135
@query
113
136
def delete_cover (community_id ):
137
+ log .deprecated_endpoint ('communities' )
114
138
q = Qry ('communities/{community_id}/images/cover' , method = methods .DELETE )
115
139
q .add_urlkw (keys .COMMUNITY_ID , community_id )
116
140
return q
117
141
118
142
119
143
# required scope: communities_edit
144
+ # deprecated
120
145
@query
121
146
def get_moderators (community_id ):
147
+ log .deprecated_endpoint ('communities' )
122
148
q = Qry ('communities/{community_id}/moderators' )
123
149
q .add_urlkw (keys .COMMUNITY_ID , community_id )
124
150
return q
125
151
126
152
127
153
# required scope: communities_edit
154
+ # deprecated
128
155
@query
129
156
def add_moderator (community_id , user_id ):
157
+ log .deprecated_endpoint ('communities' )
130
158
q = Qry ('communities/{community_id}/moderators/{user_id}' , method = methods .PUT )
131
159
q .add_urlkw (keys .COMMUNITY_ID , community_id )
132
160
q .add_urlkw (keys .USER_ID , user_id )
133
161
return q
134
162
135
163
136
164
# required scope: communities_edit
165
+ # deprecated
137
166
@query
138
167
def delete_moderator (community_id , user_id ):
168
+ log .deprecated_endpoint ('communities' )
139
169
q = Qry ('communities/{community_id}/moderators/{user_id}' , method = methods .DELETE )
140
170
q .add_urlkw (keys .COMMUNITY_ID , community_id )
141
171
q .add_urlkw (keys .USER_ID , user_id )
142
172
return q
143
173
144
174
145
175
# required scope: any
176
+ # deprecated
146
177
@query
147
178
def get_permissions (community_id ):
179
+ log .deprecated_endpoint ('communities' )
148
180
q = Qry ('communities/{community_id}/permissions' )
149
181
q .add_urlkw (keys .COMMUNITY_ID , community_id )
150
182
return q
151
183
152
184
153
185
# required scope: none
186
+ # deprecated
154
187
@query
155
188
def report_violation (community_id , channel_id ):
189
+ log .deprecated_endpoint ('communities' )
156
190
q = Qry ('communities/{community_id}/report_channel' , use_token = False , method = methods .POST )
157
191
q .add_urlkw (keys .COMMUNITY_ID , community_id )
158
192
q .add_data (keys .CHANNEL_ID , channel_id )
159
193
return q
160
194
161
195
162
196
# required scope: communities_moderate
197
+ # deprecated
163
198
@query
164
199
def get_timeouts (community_id , limit = 10 , cursor = 'MA==' ):
200
+ log .deprecated_endpoint ('communities' )
165
201
q = Qry ('communities/{community_id}/timeouts' )
166
202
q .add_urlkw (keys .COMMUNITY_ID , community_id )
167
203
q .add_param (keys .LIMIT , limit , 10 )
@@ -170,8 +206,10 @@ def get_timeouts(community_id, limit=10, cursor='MA=='):
170
206
171
207
172
208
# required scope: communities_moderate
209
+ # deprecated
173
210
@query
174
211
def add_timeout (community_id , user_id , duration = 1 , reason = None ):
212
+ log .deprecated_endpoint ('communities' )
175
213
q = Qry ('communities/{community_id}/timeouts/{user_id}' , method = methods .PUT )
176
214
q .add_urlkw (keys .COMMUNITY_ID , community_id )
177
215
q .add_urlkw (keys .USER_ID , user_id )
@@ -181,8 +219,10 @@ def add_timeout(community_id, user_id, duration=1, reason=None):
181
219
182
220
183
221
# required scope: communities_moderate
222
+ # deprecated
184
223
@query
185
224
def delete_timeout (community_id , user_id ):
225
+ log .deprecated_endpoint ('communities' )
186
226
q = Qry ('communities/{community_id}/timeouts/{user_id}' , method = methods .DELETE )
187
227
q .add_urlkw (keys .COMMUNITY_ID , community_id )
188
228
q .add_urlkw (keys .USER_ID , user_id )
0 commit comments