|
24 | 24 |
|
25 | 25 | __all__ = ['Error', 'Response', 'BaseAPI', 'API', 'Auth', 'Users', 'Groups',
|
26 | 26 | 'Channels', 'Chat', 'IM', 'IncomingWebhook', 'Search', 'Files',
|
27 |
| - 'Stars', 'Emoji', 'Presence', 'RTM', 'Team', 'OAuth', 'Slacker'] |
| 27 | + 'Stars', 'Emoji', 'Presence', 'RTM', 'Team', 'Reactions', 'OAuth', |
| 28 | + 'Slacker'] |
28 | 29 |
|
29 | 30 |
|
30 | 31 | class Error(Exception):
|
@@ -396,6 +397,58 @@ def access_logs(self, count=None, page=None):
|
396 | 397 | params={'count': count, 'page': page})
|
397 | 398 |
|
398 | 399 |
|
| 400 | +class Reactions(BaseAPI): |
| 401 | + def add(self, name, file_=None, file_comment=None, channel=None, |
| 402 | + timestamp=None): |
| 403 | + # One of file, file_comment, or the combination of channel and timestamp |
| 404 | + # must be specified |
| 405 | + assert (file_ or file_comment) or (channel and timestamp) |
| 406 | + |
| 407 | + return self.post('reactions.add', |
| 408 | + params={ |
| 409 | + 'name': name, |
| 410 | + 'file': file_, |
| 411 | + 'file_comment': file_comment, |
| 412 | + 'channel': channel, |
| 413 | + 'timestamp': timestamp, |
| 414 | + }) |
| 415 | + |
| 416 | + def get(self, file_=None, file_comment=None, channel=None, timestamp=None, |
| 417 | + full=None): |
| 418 | + return super(Reactions, self).get('reactions.get', |
| 419 | + params={ |
| 420 | + 'file': file_, |
| 421 | + 'file_comment': file_comment, |
| 422 | + 'channel': channel, |
| 423 | + 'timestamp': timestamp, |
| 424 | + 'full': full, |
| 425 | + }) |
| 426 | + |
| 427 | + def list(self, user=None, full=None, count=None, page=None): |
| 428 | + return super(Reactions, self).get('reactions.list', |
| 429 | + params={ |
| 430 | + 'user': user, |
| 431 | + 'full': full, |
| 432 | + 'count': count, |
| 433 | + 'page': page, |
| 434 | + }) |
| 435 | + |
| 436 | + def remove(self, name, file_=None, file_comment=None, channel=None, |
| 437 | + timestamp=None): |
| 438 | + # One of file, file_comment, or the combination of channel and timestamp |
| 439 | + # must be specified |
| 440 | + assert (file_ or file_comment) or (channel and timestamp) |
| 441 | + |
| 442 | + return self.post('reactions.remove', |
| 443 | + params={ |
| 444 | + 'name': name, |
| 445 | + 'file': file_, |
| 446 | + 'file_comment': file_comment, |
| 447 | + 'channel': channel, |
| 448 | + 'timestamp': timestamp, |
| 449 | + }) |
| 450 | + |
| 451 | + |
399 | 452 | class OAuth(BaseAPI):
|
400 | 453 | def access(self, client_id, client_secret, code, redirect_uri=None):
|
401 | 454 | return self.post('oauth.access',
|
@@ -440,4 +493,5 @@ def __init__(self, token, incoming_webhook_url=None):
|
440 | 493 | self.groups = Groups(token=token)
|
441 | 494 | self.channels = Channels(token=token)
|
442 | 495 | self.presence = Presence(token=token)
|
| 496 | + self.reactions = Reactions(token=token) |
443 | 497 | self.incomingwebhook = IncomingWebhook(url=incoming_webhook_url)
|
0 commit comments