slack-ruby-client 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +3 -0
  4. data/.rubocop_todo.yml +40 -39
  5. data/.travis.yml +1 -9
  6. data/CHANGELOG.md +24 -0
  7. data/CONTRIBUTING.md +2 -2
  8. data/Gemfile +3 -1
  9. data/README.md +40 -12
  10. data/Rakefile +1 -1
  11. data/UPGRADING.md +1 -1
  12. data/bin/commands/api.rb +2 -2
  13. data/bin/commands/apps_permissions.rb +22 -0
  14. data/bin/commands/auth.rb +4 -4
  15. data/bin/commands/bots.rb +2 -2
  16. data/bin/commands/channels.rb +52 -40
  17. data/bin/commands/chat.rb +63 -25
  18. data/bin/commands/conversations.rb +178 -0
  19. data/bin/commands/dialog.rb +14 -0
  20. data/bin/commands/dnd.rb +8 -8
  21. data/bin/commands/emoji.rb +2 -2
  22. data/bin/commands/files.rb +38 -17
  23. data/bin/commands/files_comments.rb +6 -6
  24. data/bin/commands/groups.rb +44 -51
  25. data/bin/commands/im.rb +16 -13
  26. data/bin/commands/migration.rb +14 -0
  27. data/bin/commands/mpim.rb +11 -11
  28. data/bin/commands/oauth.rb +15 -2
  29. data/bin/commands/pins.rb +6 -6
  30. data/bin/commands/reactions.rb +13 -13
  31. data/bin/commands/reminders.rb +10 -10
  32. data/bin/commands/rtm.rb +9 -6
  33. data/bin/commands/search.rb +9 -9
  34. data/bin/commands/stars.rb +8 -8
  35. data/bin/commands/team.rb +10 -10
  36. data/bin/commands/team_profile.rb +2 -2
  37. data/bin/commands/usergroups.rb +16 -16
  38. data/bin/commands/usergroups_users.rb +4 -4
  39. data/bin/commands/users.rb +40 -36
  40. data/bin/commands/users_admin.rb +28 -0
  41. data/bin/commands/users_prefs.rb +12 -0
  42. data/bin/commands/users_profile.rb +7 -7
  43. data/bin/commands.rb +7 -1
  44. data/bin/slack +1 -1
  45. data/examples/hi_real_time/hi.rb +1 -1
  46. data/examples/hi_real_time_and_web/hi.rb +1 -1
  47. data/examples/hi_real_time_async_celluloid/hi.rb +1 -1
  48. data/examples/hi_real_time_async_eventmachine/hi.rb +1 -1
  49. data/examples/hi_web/hi.rb +1 -1
  50. data/examples/new_ticket/new_ticket.rb +1 -1
  51. data/lib/slack/messages/formatting.rb +4 -4
  52. data/lib/slack/messages/message.rb +1 -2
  53. data/lib/slack/real_time/api/templates/event_handler.erb +1 -1
  54. data/lib/slack/real_time/client.rb +11 -10
  55. data/lib/slack/real_time/concurrency/celluloid.rb +6 -2
  56. data/lib/slack/real_time/config.rb +11 -11
  57. data/lib/slack/real_time/models/base.rb +1 -2
  58. data/lib/slack/real_time/socket.rb +2 -2
  59. data/lib/slack/real_time/stores/base.rb +1 -2
  60. data/lib/slack/real_time/stores/starter.rb +92 -72
  61. data/lib/slack/real_time/stores/store.rb +120 -90
  62. data/lib/slack/version.rb +1 -1
  63. data/lib/slack/web/api/endpoints/api.rb +2 -2
  64. data/lib/slack/web/api/endpoints/apps_permissions.rb +35 -0
  65. data/lib/slack/web/api/endpoints/auth.rb +4 -4
  66. data/lib/slack/web/api/endpoints/bots.rb +2 -2
  67. data/lib/slack/web/api/endpoints/channels.rb +57 -34
  68. data/lib/slack/web/api/endpoints/chat.rb +107 -37
  69. data/lib/slack/web/api/endpoints/conversations.rb +301 -0
  70. data/lib/slack/web/api/endpoints/dialog.rb +32 -0
  71. data/lib/slack/web/api/endpoints/dnd.rb +9 -9
  72. data/lib/slack/web/api/endpoints/emoji.rb +2 -2
  73. data/lib/slack/web/api/endpoints/files.rb +53 -23
  74. data/lib/slack/web/api/endpoints/files_comments.rb +11 -11
  75. data/lib/slack/web/api/endpoints/groups.rb +38 -50
  76. data/lib/slack/web/api/endpoints/im.rb +27 -17
  77. data/lib/slack/web/api/endpoints/migration.rb +25 -0
  78. data/lib/slack/web/api/endpoints/mpim.rb +13 -15
  79. data/lib/slack/web/api/endpoints/oauth.rb +24 -3
  80. data/lib/slack/web/api/endpoints/pins.rb +6 -8
  81. data/lib/slack/web/api/endpoints/presence.rb +1 -1
  82. data/lib/slack/web/api/endpoints/reactions.rb +18 -20
  83. data/lib/slack/web/api/endpoints/reminders.rb +10 -10
  84. data/lib/slack/web/api/endpoints/rtm.rb +14 -8
  85. data/lib/slack/web/api/endpoints/search.rb +12 -12
  86. data/lib/slack/web/api/endpoints/stars.rb +10 -12
  87. data/lib/slack/web/api/endpoints/team.rb +12 -13
  88. data/lib/slack/web/api/endpoints/team_profile.rb +2 -2
  89. data/lib/slack/web/api/endpoints/usergroups.rb +22 -22
  90. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -4
  91. data/lib/slack/web/api/endpoints/users.rb +34 -24
  92. data/lib/slack/web/api/endpoints/users_admin.rb +46 -0
  93. data/lib/slack/web/api/endpoints/users_prefs.rb +19 -0
  94. data/lib/slack/web/api/endpoints/users_profile.rb +10 -10
  95. data/lib/slack/web/api/endpoints.rb +14 -2
  96. data/lib/slack/web/api/mixins/ids.id.rb +1 -1
  97. data/lib/slack/web/api/mixins/users.search.rb +38 -36
  98. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +1 -1
  99. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +4 -3
  100. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +17 -0
  101. data/lib/slack/web/api/patches/dialog.1.open-json-support.patch +17 -0
  102. data/lib/slack/web/api/templates/command.erb +4 -3
  103. data/lib/slack/web/api/templates/commands.erb +1 -1
  104. data/lib/slack/web/api/templates/endpoints.erb +2 -2
  105. data/lib/slack/web/api/templates/method.erb +18 -3
  106. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  107. data/lib/slack/web/config.rb +16 -12
  108. data/lib/slack/web/faraday/connection.rb +1 -1
  109. data/lib/slack/web/faraday/response/raise_error.rb +3 -3
  110. data/lib/slack/web/pagination/cursor.rb +48 -0
  111. data/lib/slack-ruby-client.rb +6 -0
  112. data/lib/tasks/git.rake +1 -1
  113. data/lib/tasks/real_time.rake +1 -1
  114. data/lib/tasks/web.rake +4 -1
  115. data/slack-ruby-client.gemspec +2 -3
  116. data/spec/fixtures/slack/web/paginated_users_list.yml +181 -0
  117. data/spec/integration/integration_spec.rb +1 -1
  118. data/spec/slack/messages/formatting_spec.rb +1 -1
  119. data/spec/slack/real_time/client_spec.rb +62 -63
  120. data/spec/slack/real_time/concurrency/celluloid_spec.rb +41 -31
  121. data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +1 -1
  122. data/spec/slack/real_time/event_handlers/bot_spec.rb +4 -2
  123. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  124. data/spec/slack/real_time/event_handlers/user_spec.rb +4 -2
  125. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +15 -0
  126. data/spec/slack/web/api/endpoints/conversations_spec.rb +100 -0
  127. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +37 -1
  128. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +28 -0
  129. data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +16 -6
  130. data/spec/slack/web/api/endpoints/files_comments_spec.rb +8 -8
  131. data/spec/slack/web/api/endpoints/files_spec.rb +16 -5
  132. data/spec/slack/web/api/endpoints/migration_spec.rb +12 -0
  133. data/spec/slack/web/api/endpoints/oauth_spec.rb +11 -0
  134. data/spec/slack/web/api/endpoints/users_admin_spec.rb +17 -0
  135. data/spec/slack/web/api/endpoints/users_prefs_spec.rb +7 -0
  136. data/spec/slack/web/api/error_spec.rb +1 -1
  137. data/spec/slack/web/api/errors/slack_error_spec.rb +1 -1
  138. data/spec/slack/web/api/mixins/users_spec.rb +6 -4
  139. data/spec/slack/web/api/pagination/cursor_spec.rb +70 -0
  140. data/spec/support/queue_with_timeout.rb +1 -1
  141. data/spec/support/real_time/concurrency/mock.rb +1 -2
  142. metadata +47 -30
data/bin/commands/chat.rb CHANGED
@@ -2,19 +2,40 @@
2
2
 
3
3
  desc 'Post chat messages to Slack.'
4
4
  command 'chat' do |g|
5
- g.desc 'This method deletes a message from a channel.'
6
- g.long_desc %( This method deletes a message from a channel. )
5
+ g.desc 'Execute a slash command in a public channel (undocumented)'
6
+ g.long_desc %( Execute a slash command in a public channel )
7
+ g.command 'command' do |c|
8
+ c.flag 'channel', desc: 'Channel to execute the command in.'
9
+ c.flag 'command', desc: 'Slash command to be executed. Leading backslash is required.'
10
+ c.flag 'text', desc: 'Additional parameters provided to the slash command.'
11
+ c.action do |_global_options, options, _args|
12
+ puts JSON.dump($client.chat_command(options))
13
+ end
14
+ end
15
+
16
+ g.desc 'Deletes a message.'
17
+ g.long_desc %( Deletes a message. )
7
18
  g.command 'delete' do |c|
8
- c.flag 'ts', desc: 'Timestamp of the message to be deleted.'
9
19
  c.flag 'channel', desc: 'Channel containing the message to be deleted.'
10
- c.flag 'as_user', desc: 'Pass true to delete the message as the authed user. Bot users in this context are considered authed users.'
20
+ c.flag 'ts', desc: 'Timestamp of the message to be deleted.'
21
+ c.flag 'as_user', desc: 'Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope.'
11
22
  c.action do |_global_options, options, _args|
12
23
  puts JSON.dump($client.chat_delete(options))
13
24
  end
14
25
  end
15
26
 
16
- g.desc 'This method sends a me message to a channel from the calling user.'
17
- g.long_desc %( This method sends a me message to a channel from the calling user. )
27
+ g.desc 'Retrieve a permalink URL for a specific extant message'
28
+ g.long_desc %( Retrieve a permalink URL for a specific extant message )
29
+ g.command 'getPermalink' do |c|
30
+ c.flag 'channel', desc: 'The ID of the conversation or channel containing the message.'
31
+ c.flag 'message_ts', desc: "A message's ts value, uniquely identifying it within a channel."
32
+ c.action do |_global_options, options, _args|
33
+ puts JSON.dump($client.chat_getPermalink(options))
34
+ end
35
+ end
36
+
37
+ g.desc 'Share a me message into a channel.'
38
+ g.long_desc %( Share a me message into a channel. )
18
39
  g.command 'meMessage' do |c|
19
40
  c.flag 'channel', desc: 'Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.'
20
41
  c.flag 'text', desc: 'Text of the message to send.'
@@ -23,49 +44,66 @@ command 'chat' do |g|
23
44
  end
24
45
  end
25
46
 
26
- g.desc 'This method posts a message to a public channel, private channel, or direct message/IM channel.'
27
- g.long_desc %( This method posts a message to a public channel, private channel, or direct message/IM channel. )
47
+ g.desc 'Sends an ephemeral message to a user in a channel.'
48
+ g.long_desc %( Sends an ephemeral message to a user in a channel. )
49
+ g.command 'postEphemeral' do |c|
50
+ c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.'
51
+ c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead."
52
+ c.flag 'user', desc: 'id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.'
53
+ c.flag 'as_user', desc: 'Pass true to post the message as the authed bot. Defaults to false.'
54
+ c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
55
+ c.flag 'link_names', desc: 'Find and link channel names and usernames.'
56
+ c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
57
+ c.action do |_global_options, options, _args|
58
+ puts JSON.dump($client.chat_postEphemeral(options))
59
+ end
60
+ end
61
+
62
+ g.desc 'Sends a message to a channel.'
63
+ g.long_desc %( Sends a message to a channel. )
28
64
  g.command 'postMessage' do |c|
29
65
  c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.'
30
66
  c.flag 'text', desc: "Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead."
31
- c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
67
+ c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.'
68
+ c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
69
+ c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
70
+ c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
32
71
  c.flag 'link_names', desc: 'Find and link channel names and usernames.'
33
- c.flag 'attachments', desc: 'Structured message attachments.'
72
+ c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
73
+ c.flag 'reply_broadcast', desc: 'Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.'
74
+ c.flag 'thread_ts', desc: "Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead."
34
75
  c.flag 'unfurl_links', desc: 'Pass true to enable unfurling of primarily text-based content.'
35
76
  c.flag 'unfurl_media', desc: 'Pass false to disable unfurling of media content.'
36
77
  c.flag 'username', desc: "Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below."
37
- c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.'
38
- c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
39
- c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.'
40
- c.flag 'thread_ts', desc: "Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead."
41
- c.flag 'reply_broadcast', desc: 'Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.'
42
78
  c.action do |_global_options, options, _args|
43
79
  puts JSON.dump($client.chat_postMessage(options))
44
80
  end
45
81
  end
46
82
 
47
- g.desc 'This method attaches Slack app unfurl behavior to a specified and relevant message. A user token is required as this method does not support bot user tokens.'
48
- g.long_desc %( This method attaches Slack app unfurl behavior to a specified and relevant message. A user token is required as this method does not support bot user tokens. )
83
+ g.desc 'Provide custom unfurl behavior for user-posted URLs'
84
+ g.long_desc %( Provide custom unfurl behavior for user-posted URLs )
49
85
  g.command 'unfurl' do |c|
50
86
  c.flag 'channel', desc: 'Channel ID of the message.'
51
87
  c.flag 'ts', desc: 'Timestamp of the message to add unfurl behavior to.'
52
- c.flag 'unfurls', desc: 'JSON mapping a set of URLs from the message to their unfurl attachments.'
88
+ c.flag 'unfurls', desc: 'URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl message attachments.'
89
+ c.flag 'user_auth_message', desc: 'Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.'
53
90
  c.flag 'user_auth_required', desc: 'Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.'
91
+ c.flag 'user_auth_url', desc: 'Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.'
54
92
  c.action do |_global_options, options, _args|
55
93
  puts JSON.dump($client.chat_unfurl(options))
56
94
  end
57
95
  end
58
96
 
59
- g.desc 'This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently.'
60
- g.long_desc %( This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently. )
97
+ g.desc 'Updates a message.'
98
+ g.long_desc %( Updates a message. )
61
99
  g.command 'update' do |c|
62
- c.flag 'ts', desc: 'Timestamp of the message to be updated.'
63
100
  c.flag 'channel', desc: 'Channel containing the message to be updated.'
64
- c.flag 'text', desc: 'New text for the message, using the default formatting rules.'
65
- c.flag 'attachments', desc: 'Structured message attachments.'
66
- c.flag 'parse', desc: 'Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.'
67
- c.flag 'link_names', desc: 'Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full.'
101
+ c.flag 'text', desc: "New text for the message, using the default formatting rules. It's not required when presenting attachments."
102
+ c.flag 'ts', desc: 'Timestamp of the message to be updated.'
68
103
  c.flag 'as_user', desc: 'Pass true to update the message as the authed user. Bot users in this context are considered authed users.'
104
+ c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text.'
105
+ c.flag 'link_names', desc: 'Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full.'
106
+ c.flag 'parse', desc: 'Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.'
69
107
  c.action do |_global_options, options, _args|
70
108
  puts JSON.dump($client.chat_update(options))
71
109
  end
@@ -0,0 +1,178 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ desc "Interface with all kinds of conversations the same way, whether they're public or private channels, direct messages, or otherwise."
4
+ command 'conversations' do |g|
5
+ g.desc 'Archives a conversation.'
6
+ g.long_desc %( Archives a conversation. )
7
+ g.command 'archive' do |c|
8
+ c.flag 'channel', desc: 'ID of conversation to archive.'
9
+ c.action do |_global_options, options, _args|
10
+ puts JSON.dump($client.conversations_archive(options))
11
+ end
12
+ end
13
+
14
+ g.desc 'Closes a direct message or multi-person direct message.'
15
+ g.long_desc %( Closes a direct message or multi-person direct message. )
16
+ g.command 'close' do |c|
17
+ c.flag 'channel', desc: 'Conversation to close.'
18
+ c.action do |_global_options, options, _args|
19
+ puts JSON.dump($client.conversations_close(options))
20
+ end
21
+ end
22
+
23
+ g.desc 'Initiates a public or private channel-based conversation'
24
+ g.long_desc %( Initiates a public or private channel-based conversation )
25
+ g.command 'create' do |c|
26
+ c.flag 'name', desc: 'Name of the public or private channel to create.'
27
+ c.flag 'is_private', desc: 'Create a private channel instead of a public one.'
28
+ c.action do |_global_options, options, _args|
29
+ puts JSON.dump($client.conversations_create(options))
30
+ end
31
+ end
32
+
33
+ g.desc "Fetches a conversation's history of messages and events."
34
+ g.long_desc %( Fetches a conversation's history of messages and events. )
35
+ g.command 'history' do |c|
36
+ c.flag 'channel', desc: 'Conversation ID to fetch history for.'
37
+ c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
38
+ c.flag 'latest', desc: 'End of time range of messages to include in results.'
39
+ c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
40
+ c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
41
+ c.action do |_global_options, options, _args|
42
+ puts JSON.dump($client.conversations_history(options))
43
+ end
44
+ end
45
+
46
+ g.desc 'Retrieve information about a conversation.'
47
+ g.long_desc %( Retrieve information about a conversation. )
48
+ g.command 'info' do |c|
49
+ c.flag 'channel', desc: 'Conversation ID to learn more about.'
50
+ c.flag 'include_locale', desc: 'Set this to true to receive the locale for this conversation. Defaults to false.'
51
+ c.action do |_global_options, options, _args|
52
+ puts JSON.dump($client.conversations_info(options))
53
+ end
54
+ end
55
+
56
+ g.desc 'Invites users to a channel.'
57
+ g.long_desc %( Invites users to a channel. )
58
+ g.command 'invite' do |c|
59
+ c.flag 'channel', desc: 'The ID of the public or private channel to invite user(s) to.'
60
+ c.flag 'users', desc: 'A comma separated list of user IDs. Up to 30 users may be listed.'
61
+ c.action do |_global_options, options, _args|
62
+ puts JSON.dump($client.conversations_invite(options))
63
+ end
64
+ end
65
+
66
+ g.desc 'Joins an existing conversation.'
67
+ g.long_desc %( Joins an existing conversation. )
68
+ g.command 'join' do |c|
69
+ c.flag 'channel', desc: 'ID of conversation to join.'
70
+ c.action do |_global_options, options, _args|
71
+ puts JSON.dump($client.conversations_join(options))
72
+ end
73
+ end
74
+
75
+ g.desc 'Removes a user from a conversation.'
76
+ g.long_desc %( Removes a user from a conversation. )
77
+ g.command 'kick' do |c|
78
+ c.flag 'channel', desc: 'ID of conversation to remove user from.'
79
+ c.flag 'user', desc: 'User ID to be removed.'
80
+ c.action do |_global_options, options, _args|
81
+ puts JSON.dump($client.conversations_kick(options))
82
+ end
83
+ end
84
+
85
+ g.desc 'Leaves a conversation.'
86
+ g.long_desc %( Leaves a conversation. )
87
+ g.command 'leave' do |c|
88
+ c.flag 'channel', desc: 'Conversation to leave.'
89
+ c.action do |_global_options, options, _args|
90
+ puts JSON.dump($client.conversations_leave(options))
91
+ end
92
+ end
93
+
94
+ g.desc 'Lists all channels in a Slack team.'
95
+ g.long_desc %( Lists all channels in a Slack team. )
96
+ g.command 'list' do |c|
97
+ c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
98
+ c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
99
+ c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached. Must be an integer no larger than 1000."
100
+ c.flag 'types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.'
101
+ c.action do |_global_options, options, _args|
102
+ puts JSON.dump($client.conversations_list(options))
103
+ end
104
+ end
105
+
106
+ g.desc 'Retrieve members of a conversation.'
107
+ g.long_desc %( Retrieve members of a conversation. )
108
+ g.command 'members' do |c|
109
+ c.flag 'channel', desc: 'ID of the conversation to retrieve members for.'
110
+ c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
111
+ c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
112
+ c.action do |_global_options, options, _args|
113
+ puts JSON.dump($client.conversations_members(options))
114
+ end
115
+ end
116
+
117
+ g.desc 'Opens or resumes a direct message or multi-person direct message.'
118
+ g.long_desc %( Opens or resumes a direct message or multi-person direct message. )
119
+ g.command 'open' do |c|
120
+ c.flag 'channel', desc: "Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead."
121
+ c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
122
+ c.flag 'users', desc: 'Comma separated lists of users. If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users.'
123
+ c.action do |_global_options, options, _args|
124
+ puts JSON.dump($client.conversations_open(options))
125
+ end
126
+ end
127
+
128
+ g.desc 'Renames a conversation.'
129
+ g.long_desc %( Renames a conversation. )
130
+ g.command 'rename' do |c|
131
+ c.flag 'channel', desc: 'ID of conversation to rename.'
132
+ c.flag 'name', desc: 'New name for conversation.'
133
+ c.action do |_global_options, options, _args|
134
+ puts JSON.dump($client.conversations_rename(options))
135
+ end
136
+ end
137
+
138
+ g.desc 'Retrieve a thread of messages posted to a conversation'
139
+ g.long_desc %( Retrieve a thread of messages posted to a conversation )
140
+ g.command 'replies' do |c|
141
+ c.flag 'channel', desc: 'Conversation ID to fetch thread from.'
142
+ c.flag 'ts', desc: "Unique identifier of a thread's parent message."
143
+ c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
144
+ c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
145
+ c.action do |_global_options, options, _args|
146
+ puts JSON.dump($client.conversations_replies(options))
147
+ end
148
+ end
149
+
150
+ g.desc 'Sets the purpose for a conversation.'
151
+ g.long_desc %( Sets the purpose for a conversation. )
152
+ g.command 'setPurpose' do |c|
153
+ c.flag 'channel', desc: 'Conversation to set the purpose of.'
154
+ c.flag 'purpose', desc: 'A new, specialer purpose.'
155
+ c.action do |_global_options, options, _args|
156
+ puts JSON.dump($client.conversations_setPurpose(options))
157
+ end
158
+ end
159
+
160
+ g.desc 'Sets the topic for a conversation.'
161
+ g.long_desc %( Sets the topic for a conversation. )
162
+ g.command 'setTopic' do |c|
163
+ c.flag 'channel', desc: 'Conversation to set the topic of.'
164
+ c.flag 'topic', desc: 'The new topic string. Does not support formatting or linkification.'
165
+ c.action do |_global_options, options, _args|
166
+ puts JSON.dump($client.conversations_setTopic(options))
167
+ end
168
+ end
169
+
170
+ g.desc 'Reverses conversation archival.'
171
+ g.long_desc %( Reverses conversation archival. )
172
+ g.command 'unarchive' do |c|
173
+ c.flag 'channel', desc: 'ID of conversation to unarchive.'
174
+ c.action do |_global_options, options, _args|
175
+ puts JSON.dump($client.conversations_unarchive(options))
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,14 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ desc 'Dialog methods.'
4
+ command 'dialog' do |g|
5
+ g.desc 'Open a dialog with a user'
6
+ g.long_desc %( Open a dialog with a user )
7
+ g.command 'open' do |c|
8
+ c.flag 'dialog', desc: 'The dialog definition. This must be a JSON-encoded string.'
9
+ c.flag 'trigger_id', desc: 'Exchange a trigger to post to the user.'
10
+ c.action do |_global_options, options, _args|
11
+ puts JSON.dump($client.dialog_open(options))
12
+ end
13
+ end
14
+ end
data/bin/commands/dnd.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Adjust and view Do Not Disturb settings for team members.'
4
4
  command 'dnd' do |g|
5
- g.desc "Ends the user's currently scheduled Do Not Disturb session immediately."
6
- g.long_desc %( Ends the user's currently scheduled Do Not Disturb session immediately. )
5
+ g.desc "Ends the current user's Do Not Disturb session immediately."
6
+ g.long_desc %( Ends the current user's Do Not Disturb session immediately. )
7
7
  g.command 'endDnd' do |c|
8
8
  c.action do |_global_options, options, _args|
9
9
  puts JSON.dump($client.dnd_endDnd(options))
@@ -18,8 +18,8 @@ command 'dnd' do |g|
18
18
  end
19
19
  end
20
20
 
21
- g.desc "Provides information about a user's current Do Not Disturb settings."
22
- g.long_desc %( Provides information about a user's current Do Not Disturb settings. )
21
+ g.desc "Retrieves a user's current Do Not Disturb status."
22
+ g.long_desc %( Retrieves a user's current Do Not Disturb status. )
23
23
  g.command 'info' do |c|
24
24
  c.flag 'user', desc: 'User to fetch status for (defaults to current user).'
25
25
  c.action do |_global_options, options, _args|
@@ -27,8 +27,8 @@ command 'dnd' do |g|
27
27
  end
28
28
  end
29
29
 
30
- g.desc "Adjusts the snooze duration for a user's Do Not Disturb settings. If a snooze session is not already active for the user, invoking this method will begin one for the specified duration."
31
- g.long_desc %( Adjusts the snooze duration for a user's Do Not Disturb settings. If a snooze session is not already active for the user, invoking this method will begin one for the specified duration. )
30
+ g.desc 'Turns on Do Not Disturb mode for the current user, or changes its duration.'
31
+ g.long_desc %( Turns on Do Not Disturb mode for the current user, or changes its duration. )
32
32
  g.command 'setSnooze' do |c|
33
33
  c.flag 'num_minutes', desc: 'Number of minutes, from now, to snooze until.'
34
34
  c.action do |_global_options, options, _args|
@@ -36,8 +36,8 @@ command 'dnd' do |g|
36
36
  end
37
37
  end
38
38
 
39
- g.desc 'Provides information about the current Do Not Disturb settings for users of a Slack team.'
40
- g.long_desc %( Provides information about the current Do Not Disturb settings for users of a Slack team. )
39
+ g.desc 'Retrieves the Do Not Disturb status for users on a team.'
40
+ g.long_desc %( Retrieves the Do Not Disturb status for users on a team. )
41
41
  g.command 'teamInfo' do |c|
42
42
  c.flag 'users', desc: 'Comma-separated list of users to fetch Do Not Disturb status for.'
43
43
  c.action do |_global_options, options, _args|
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Emoji methods.'
4
4
  command 'emoji' do |g|
5
- g.desc 'This method lists the custom emoji for a team.'
6
- g.long_desc %( This method lists the custom emoji for a team. )
5
+ g.desc 'Lists custom emoji for a team.'
6
+ g.long_desc %( Lists custom emoji for a team. )
7
7
  g.command 'list' do |c|
8
8
  c.action do |_global_options, options, _args|
9
9
  puts JSON.dump($client.emoji_list(options))
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Get info on files uploaded to Slack, upload new files to Slack.'
4
4
  command 'files' do |g|
5
- g.desc 'This method deletes a file from your team.'
6
- g.long_desc %( This method deletes a file from your team. )
5
+ g.desc 'Deletes a file.'
6
+ g.long_desc %( Deletes a file. )
7
7
  g.command 'delete' do |c|
8
8
  c.flag 'file', desc: 'ID of file to delete.'
9
9
  c.action do |_global_options, options, _args|
@@ -11,8 +11,19 @@ command 'files' do |g|
11
11
  end
12
12
  end
13
13
 
14
- g.desc 'This method returns information about a file in your team.'
15
- g.long_desc %( This method returns information about a file in your team. )
14
+ g.desc 'Change the properties of a file (undocumented)'
15
+ g.long_desc %( Change the properties of a file )
16
+ g.command 'edit' do |c|
17
+ c.flag 'file', desc: 'ID of the file to be edited'
18
+ c.flag 'title', desc: 'New title of the file'
19
+ c.flag 'filetype', desc: 'New filetype of the file. See https://api.slack.com/types/file#file_types for a list of all supported types.'
20
+ c.action do |_global_options, options, _args|
21
+ puts JSON.dump($client.files_edit(options))
22
+ end
23
+ end
24
+
25
+ g.desc 'Gets information about a team file.'
26
+ g.long_desc %( Gets information about a team file. )
16
27
  g.command 'info' do |c|
17
28
  c.flag 'file', desc: 'Specify a file by providing its ID.'
18
29
  c.action do |_global_options, options, _args|
@@ -20,10 +31,9 @@ command 'files' do |g|
20
31
  end
21
32
  end
22
33
 
23
- g.desc 'This method returns a list of files within the team. It can be filtered and sliced in various ways.'
24
- g.long_desc %( This method returns a list of files within the team. It can be filtered and sliced in various ways. )
34
+ g.desc 'Lists & filters team files.'
35
+ g.long_desc %( Lists & filters team files. )
25
36
  g.command 'list' do |c|
26
- c.flag 'user', desc: 'Filter files created by a single user.'
27
37
  c.flag 'channel', desc: 'Filter files appearing in a specific channel, indicated by its ID.'
28
38
  c.flag 'ts_from', desc: 'Filter files created after this timestamp (inclusive).'
29
39
  c.flag 'ts_to', desc: 'Filter files created before this timestamp (inclusive).'
@@ -40,13 +50,14 @@ pdfs - PDF files
40
50
 
41
51
  You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list.
42
52
  .'
53
+ c.flag 'user', desc: 'Filter files created by a single user.'
43
54
  c.action do |_global_options, options, _args|
44
55
  puts JSON.dump($client.files_list(options))
45
56
  end
46
57
  end
47
58
 
48
- g.desc 'This method disables public/external sharing for a file.'
49
- g.long_desc %( This method disables public/external sharing for a file. )
59
+ g.desc 'Revokes public/external sharing access for a file'
60
+ g.long_desc %( Revokes public/external sharing access for a file )
50
61
  g.command 'revokePublicURL' do |c|
51
62
  c.flag 'file', desc: 'File to revoke.'
52
63
  c.action do |_global_options, options, _args|
@@ -54,8 +65,18 @@ You can pass multiple values in the types argument, like types=spaces,snippets.T
54
65
  end
55
66
  end
56
67
 
57
- g.desc 'This method enables public/external sharing for a file.'
58
- g.long_desc %( This method enables public/external sharing for a file. )
68
+ g.desc 'Share an existing file in a channel (undocumented)'
69
+ g.long_desc %( Share an existing file in a channel )
70
+ g.command 'share' do |c|
71
+ c.flag 'file', desc: 'ID of the file to be shared'
72
+ c.flag 'channel', desc: 'Channel to share the file in. Works with both public (channel ID) and private channels (group ID).'
73
+ c.action do |_global_options, options, _args|
74
+ puts JSON.dump($client.files_share(options))
75
+ end
76
+ end
77
+
78
+ g.desc 'Enables a file for public/external sharing.'
79
+ g.long_desc %( Enables a file for public/external sharing. )
59
80
  g.command 'sharedPublicURL' do |c|
60
81
  c.flag 'file', desc: 'File to share.'
61
82
  c.action do |_global_options, options, _args|
@@ -63,16 +84,16 @@ You can pass multiple values in the types argument, like types=spaces,snippets.T
63
84
  end
64
85
  end
65
86
 
66
- g.desc 'This method allows you to create or upload an existing file.'
67
- g.long_desc %( This method allows you to create or upload an existing file. )
87
+ g.desc 'Uploads or creates a file.'
88
+ g.long_desc %( Uploads or creates a file. )
68
89
  g.command 'upload' do |c|
69
- c.flag 'file', desc: 'File contents via multipart/form-data. If omitting this parameter, you must submit content.'
90
+ c.flag 'channels', desc: 'Comma-separated list of channel names or IDs where the file will be shared.'
70
91
  c.flag 'content', desc: 'File contents via a POST variable. If omitting this parameter, you must provide a file.'
71
- c.flag 'filetype', desc: 'A file type identifier.'
92
+ c.flag 'file', desc: 'File contents via multipart/form-data. If omitting this parameter, you must submit content.'
72
93
  c.flag 'filename', desc: 'Filename of file.'
73
- c.flag 'title', desc: 'Title of file.'
94
+ c.flag 'filetype', desc: 'A file type identifier.'
74
95
  c.flag 'initial_comment', desc: 'Initial comment to add to file.'
75
- c.flag 'channels', desc: 'Comma-separated list of channel names or IDs where the file will be shared.'
96
+ c.flag 'title', desc: 'Title of file.'
76
97
  c.action do |_global_options, options, _args|
77
98
  puts JSON.dump($client.files_upload(options))
78
99
  end
@@ -5,15 +5,15 @@ command 'files_comments' do |g|
5
5
  g.desc 'Add a comment to an existing file.'
6
6
  g.long_desc %( Add a comment to an existing file. )
7
7
  g.command 'add' do |c|
8
- c.flag 'file', desc: 'File to add a comment to.'
9
8
  c.flag 'comment', desc: 'Text of the comment to add.'
9
+ c.flag 'file', desc: 'File to add a comment to.'
10
10
  c.action do |_global_options, options, _args|
11
11
  puts JSON.dump($client.files_comments_add(options))
12
12
  end
13
13
  end
14
14
 
15
- g.desc 'Delete an existing comment on a file. Only the original author of the comment or a Team Administrator may delete a file comment.'
16
- g.long_desc %( Delete an existing comment on a file. Only the original author of the comment or a Team Administrator may delete a file comment. )
15
+ g.desc 'Deletes an existing comment on a file.'
16
+ g.long_desc %( Deletes an existing comment on a file. )
17
17
  g.command 'delete' do |c|
18
18
  c.flag 'file', desc: 'File to delete a comment from.'
19
19
  c.flag 'id', desc: 'The comment to delete.'
@@ -22,12 +22,12 @@ command 'files_comments' do |g|
22
22
  end
23
23
  end
24
24
 
25
- g.desc 'Edit an existing comment on a file. Only the user who created a comment may make edits. Teams may configure a limited time window during which file comment edits are allowed.'
26
- g.long_desc %( Edit an existing comment on a file. Only the user who created a comment may make edits. Teams may configure a limited time window during which file comment edits are allowed. )
25
+ g.desc 'Edit an existing file comment.'
26
+ g.long_desc %( Edit an existing file comment. )
27
27
  g.command 'edit' do |c|
28
+ c.flag 'comment', desc: 'Text of the comment to edit.'
28
29
  c.flag 'file', desc: 'File containing the comment to edit.'
29
30
  c.flag 'id', desc: 'The comment to edit.'
30
- c.flag 'comment', desc: 'Text of the comment to edit.'
31
31
  c.action do |_global_options, options, _args|
32
32
  puts JSON.dump($client.files_comments_edit(options))
33
33
  end