slack-ruby-client-bhe 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +17 -0
  2. data/.gitignore +4 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +6 -0
  6. data/.rubocop_todo.yml +78 -0
  7. data/.travis.yml +26 -0
  8. data/CHANGELOG.md +79 -0
  9. data/CONTRIBUTING.md +157 -0
  10. data/Gemfile +5 -0
  11. data/LICENSE.md +22 -0
  12. data/README.md +385 -0
  13. data/RELEASING.md +69 -0
  14. data/Rakefile +19 -0
  15. data/UPGRADING.md +26 -0
  16. data/bin/commands.rb +21 -0
  17. data/bin/commands/api.rb +14 -0
  18. data/bin/commands/auth.rb +12 -0
  19. data/bin/commands/channels.rb +149 -0
  20. data/bin/commands/chat.rb +47 -0
  21. data/bin/commands/dnd.rb +47 -0
  22. data/bin/commands/emoji.rb +12 -0
  23. data/bin/commands/files.rb +72 -0
  24. data/bin/commands/groups.rb +167 -0
  25. data/bin/commands/im.rb +53 -0
  26. data/bin/commands/mpim.rb +53 -0
  27. data/bin/commands/oauth.rb +16 -0
  28. data/bin/commands/pins.rb +37 -0
  29. data/bin/commands/reactions.rb +53 -0
  30. data/bin/commands/rtm.rb +15 -0
  31. data/bin/commands/search.rb +40 -0
  32. data/bin/commands/stars.rb +37 -0
  33. data/bin/commands/team.rb +32 -0
  34. data/bin/commands/usergroups.rb +73 -0
  35. data/bin/commands/users.rb +57 -0
  36. data/bin/slack +50 -0
  37. data/examples/hi_real_time/Gemfile +5 -0
  38. data/examples/hi_real_time/hi.gif +0 -0
  39. data/examples/hi_real_time/hi.rb +32 -0
  40. data/examples/hi_real_time_and_web/Gemfile +5 -0
  41. data/examples/hi_real_time_and_web/hi.gif +0 -0
  42. data/examples/hi_real_time_and_web/hi.rb +24 -0
  43. data/examples/hi_real_time_async/Gemfile +5 -0
  44. data/examples/hi_real_time_async/hi.rb +29 -0
  45. data/examples/hi_web/Gemfile +3 -0
  46. data/examples/hi_web/hi.gif +0 -0
  47. data/examples/hi_web/hi.rb +12 -0
  48. data/examples/new_ticket/Gemfile +3 -0
  49. data/examples/new_ticket/new_ticket.rb +25 -0
  50. data/lib/slack-ruby-client.rb +29 -0
  51. data/lib/slack.rb +1 -0
  52. data/lib/slack/config.rb +21 -0
  53. data/lib/slack/messages/formatting.rb +30 -0
  54. data/lib/slack/real_time/api/message.rb +20 -0
  55. data/lib/slack/real_time/api/message_id.rb +14 -0
  56. data/lib/slack/real_time/api/ping.rb +16 -0
  57. data/lib/slack/real_time/api/typing.rb +17 -0
  58. data/lib/slack/real_time/client.rb +152 -0
  59. data/lib/slack/real_time/concurrency.rb +8 -0
  60. data/lib/slack/real_time/concurrency/celluloid.rb +93 -0
  61. data/lib/slack/real_time/concurrency/eventmachine.rb +39 -0
  62. data/lib/slack/real_time/config.rb +55 -0
  63. data/lib/slack/real_time/socket.rb +81 -0
  64. data/lib/slack/version.rb +3 -0
  65. data/lib/slack/web/api/endpoints.rb +53 -0
  66. data/lib/slack/web/api/endpoints/api.rb +24 -0
  67. data/lib/slack/web/api/endpoints/auth.rb +20 -0
  68. data/lib/slack/web/api/endpoints/channels.rb +220 -0
  69. data/lib/slack/web/api/endpoints/chat.rb +91 -0
  70. data/lib/slack/web/api/endpoints/dnd.rb +64 -0
  71. data/lib/slack/web/api/endpoints/emoji.rb +20 -0
  72. data/lib/slack/web/api/endpoints/files.rb +108 -0
  73. data/lib/slack/web/api/endpoints/groups.rb +247 -0
  74. data/lib/slack/web/api/endpoints/im.rb +85 -0
  75. data/lib/slack/web/api/endpoints/mpim.rb +84 -0
  76. data/lib/slack/web/api/endpoints/oauth.rb +32 -0
  77. data/lib/slack/web/api/endpoints/pins.rb +64 -0
  78. data/lib/slack/web/api/endpoints/presence.rb +23 -0
  79. data/lib/slack/web/api/endpoints/reactions.rb +89 -0
  80. data/lib/slack/web/api/endpoints/rtm.rb +27 -0
  81. data/lib/slack/web/api/endpoints/search.rb +65 -0
  82. data/lib/slack/web/api/endpoints/stars.rb +61 -0
  83. data/lib/slack/web/api/endpoints/team.rb +47 -0
  84. data/lib/slack/web/api/endpoints/usergroups.rb +113 -0
  85. data/lib/slack/web/api/endpoints/users.rb +73 -0
  86. data/lib/slack/web/api/error.rb +14 -0
  87. data/lib/slack/web/api/mixins.rb +3 -0
  88. data/lib/slack/web/api/mixins/channels.id.json +20 -0
  89. data/lib/slack/web/api/mixins/channels.id.rb +26 -0
  90. data/lib/slack/web/api/mixins/groups.id.json +20 -0
  91. data/lib/slack/web/api/mixins/groups.id.rb +26 -0
  92. data/lib/slack/web/api/mixins/users.id.json +20 -0
  93. data/lib/slack/web/api/mixins/users.id.rb +26 -0
  94. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +13 -0
  95. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +17 -0
  96. data/lib/slack/web/api/schema/group.json +14 -0
  97. data/lib/slack/web/api/schema/method.json +45 -0
  98. data/lib/slack/web/api/tasks/generate.rake +61 -0
  99. data/lib/slack/web/api/templates/command.erb +34 -0
  100. data/lib/slack/web/api/templates/commands.erb +5 -0
  101. data/lib/slack/web/api/templates/endpoints.erb +21 -0
  102. data/lib/slack/web/api/templates/method.erb +49 -0
  103. data/lib/slack/web/client.rb +28 -0
  104. data/lib/slack/web/config.rb +41 -0
  105. data/lib/slack/web/faraday/connection.rb +29 -0
  106. data/lib/slack/web/faraday/request.rb +39 -0
  107. data/lib/slack/web/faraday/response/raise_error.rb +15 -0
  108. data/lib/slack_ruby_client.rb +1 -0
  109. data/screenshots/register-bot.png +0 -0
  110. data/slack-ruby-client.gemspec +31 -0
  111. data/slack.png +0 -0
  112. data/spec/fixtures/slack/web/429_error.yml +83 -0
  113. data/spec/fixtures/slack/web/auth_test_error.yml +48 -0
  114. data/spec/fixtures/slack/web/auth_test_success.yml +57 -0
  115. data/spec/fixtures/slack/web/channels_info.yml +46 -0
  116. data/spec/fixtures/slack/web/groups_info.yml +43 -0
  117. data/spec/fixtures/slack/web/rtm_start.yml +73 -0
  118. data/spec/fixtures/slack/web/users_info.yml +130 -0
  119. data/spec/fixtures/slack/web/users_list.yml +72 -0
  120. data/spec/integration/integration_spec.rb +107 -0
  121. data/spec/slack/config_spec.rb +14 -0
  122. data/spec/slack/messages/formatting_spec.rb +43 -0
  123. data/spec/slack/real_time/api/message_spec.rb +15 -0
  124. data/spec/slack/real_time/api/ping_spec.rb +15 -0
  125. data/spec/slack/real_time/api/typing_spec.rb +15 -0
  126. data/spec/slack/real_time/client_spec.rb +198 -0
  127. data/spec/slack/real_time/concurrency/celluloid_spec.rb +58 -0
  128. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +49 -0
  129. data/spec/slack/slack_spec.rb +58 -0
  130. data/spec/slack/version_spec.rb +7 -0
  131. data/spec/slack/web/api/endpoints/auth_spec.rb +20 -0
  132. data/spec/slack/web/api/endpoints/channels_spec.rb +11 -0
  133. data/spec/slack/web/api/endpoints/chat_spec.rb +33 -0
  134. data/spec/slack/web/api/endpoints/groups_spec.rb +11 -0
  135. data/spec/slack/web/api/endpoints/users_spec.rb +17 -0
  136. data/spec/slack/web/api/error_spec.rb +14 -0
  137. data/spec/slack/web/api/mixins/channels_spec.rb +31 -0
  138. data/spec/slack/web/api/mixins/groups_spec.rb +31 -0
  139. data/spec/slack/web/api/mixins/users_spec.rb +31 -0
  140. data/spec/slack/web/client_spec.rb +134 -0
  141. data/spec/spec_helper.rb +14 -0
  142. data/spec/support/queue_with_timeout.rb +34 -0
  143. data/spec/support/real_time/concurrency/mock.rb +31 -0
  144. data/spec/support/real_time/connected_client.rb +16 -0
  145. data/spec/support/token.rb +10 -0
  146. data/spec/support/vcr.rb +8 -0
  147. metadata +392 -0
@@ -0,0 +1,84 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Mpim
8
+ #
9
+ # This method closes a multiparty direct message channel.
10
+ #
11
+ # @option options [channel] :channel
12
+ # MPIM to close.
13
+ # @see https://api.slack.com/methods/mpim.close
14
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/mpim.close.json
15
+ def mpim_close(options = {})
16
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
17
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
18
+ post('mpim.close', options)
19
+ end
20
+
21
+ #
22
+ # This method returns a portion of messages/events from the specified multiparty direct message channel.
23
+ # To read the entire history for a multiparty direct message, call the method with no latest or
24
+ # oldest arguments, and then continue paging using the instructions below.
25
+ #
26
+ # @option options [channel] :channel
27
+ # Multiparty direct message to fetch history for.
28
+ # @option options [timestamp] :latest
29
+ # End of time range of messages to include in results.
30
+ # @option options [timestamp] :oldest
31
+ # Start of time range of messages to include in results.
32
+ # @option options [Object] :inclusive
33
+ # Include messages with latest or oldest timestamp in results.
34
+ # @option options [Object] :unreads
35
+ # Include unread_count_display in the output?.
36
+ # @see https://api.slack.com/methods/mpim.history
37
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/mpim.history.json
38
+ def mpim_history(options = {})
39
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
40
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
41
+ post('mpim.history', options)
42
+ end
43
+
44
+ #
45
+ # This method returns a list of all multiparty direct message channels that the user has.
46
+ #
47
+ # @see https://api.slack.com/methods/mpim.list
48
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/mpim.list.json
49
+ def mpim_list(options = {})
50
+ post('mpim.list', options)
51
+ end
52
+
53
+ #
54
+ # This method moves the read cursor in a multiparty direct message channel.
55
+ #
56
+ # @option options [channel] :channel
57
+ # multiparty direct message channel to set reading cursor in.
58
+ # @option options [timestamp] :ts
59
+ # Timestamp of the most recently seen message.
60
+ # @see https://api.slack.com/methods/mpim.mark
61
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/mpim.mark.json
62
+ def mpim_mark(options = {})
63
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
64
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
65
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
66
+ post('mpim.mark', options)
67
+ end
68
+
69
+ #
70
+ # This method opens a multiparty direct message.
71
+ #
72
+ # @option options [Object] :users
73
+ # Comma separated lists of users. The ordering of the users is preserved whenever a MPIM group is returned.
74
+ # @see https://api.slack.com/methods/mpim.open
75
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/mpim.open.json
76
+ def mpim_open(options = {})
77
+ throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
78
+ post('mpim.open', options)
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,32 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Oauth
8
+ #
9
+ # This method allows you to exchange a temporary OAuth code for an API access token.
10
+ # This is used as part of the OAuth authentication flow.
11
+ #
12
+ # @option options [Object] :client_id
13
+ # Issued when you created your application.
14
+ # @option options [Object] :client_secret
15
+ # Issued when you created your application.
16
+ # @option options [Object] :code
17
+ # The code param returned via the OAuth callback.
18
+ # @option options [Object] :redirect_uri
19
+ # This must match the originally submitted URI (if one was sent).
20
+ # @see https://api.slack.com/methods/oauth.access
21
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/oauth.access.json
22
+ def oauth_access(options = {})
23
+ throw ArgumentError.new('Required arguments :client_id missing') if options[:client_id].nil?
24
+ throw ArgumentError.new('Required arguments :client_secret missing') if options[:client_secret].nil?
25
+ throw ArgumentError.new('Required arguments :code missing') if options[:code].nil?
26
+ post('oauth.access', options)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,64 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Pins
8
+ #
9
+ # This method pins an item (file, file comment, channel message, or group message) to a particular channel.
10
+ # The channel argument is required and one of file, file_comment, or timestamp must also be specified.
11
+ #
12
+ # @option options [channel] :channel
13
+ # Channel to pin the item in.
14
+ # @option options [file] :file
15
+ # File to pin.
16
+ # @option options [Object] :file_comment
17
+ # File comment to pin.
18
+ # @option options [Object] :timestamp
19
+ # Timestamp of the message to pin.
20
+ # @see https://api.slack.com/methods/pins.add
21
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.add.json
22
+ def pins_add(options = {})
23
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
24
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
25
+ post('pins.add', options)
26
+ end
27
+
28
+ #
29
+ # This method lists the items pinned to a channel.
30
+ #
31
+ # @option options [channel] :channel
32
+ # Channel to get pinned items for.
33
+ # @see https://api.slack.com/methods/pins.list
34
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.list.json
35
+ def pins_list(options = {})
36
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
37
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
38
+ post('pins.list', options)
39
+ end
40
+
41
+ #
42
+ # This method un-pins an item (file, file comment, channel message, or group message) from a channel.
43
+ # The channel argument is required and one of file, file_comment, or timestamp must also be specified.
44
+ #
45
+ # @option options [channel] :channel
46
+ # Channel where the item is pinned to.
47
+ # @option options [file] :file
48
+ # File to un-pin.
49
+ # @option options [Object] :file_comment
50
+ # File comment to un-pin.
51
+ # @option options [Object] :timestamp
52
+ # Timestamp of the message to un-pin.
53
+ # @see https://api.slack.com/methods/pins.remove
54
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.remove.json
55
+ def pins_remove(options = {})
56
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
57
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
58
+ post('pins.remove', options)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Presence
8
+ #
9
+ # Manually set user presence.
10
+ #
11
+ # @option options [Object] :presence
12
+ # Either `active` or `away`.
13
+ # @see https://api.slack.com/methods/presence.set
14
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/presence.set.json
15
+ def presence_set(options = {})
16
+ throw ArgumentError.new('Required arguments :presence missing') if options[:presence].nil?
17
+ post('presence.set', options)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,89 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Reactions
8
+ #
9
+ # This method adds a reaction (emoji) to an item (file, file comment, channel message, group message, or direct message).
10
+ # One of file, file_comment, or the combination of channel and timestamp must be specified.
11
+ #
12
+ # @option options [Object] :name
13
+ # Reaction (emoji) name.
14
+ # @option options [file] :file
15
+ # File to add reaction to.
16
+ # @option options [Object] :file_comment
17
+ # File comment to add reaction to.
18
+ # @option options [channel] :channel
19
+ # Channel where the message to add reaction to was posted.
20
+ # @option options [Object] :timestamp
21
+ # Timestamp of the message to add reaction to.
22
+ # @see https://api.slack.com/methods/reactions.add
23
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.add.json
24
+ def reactions_add(options = {})
25
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
26
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
27
+ post('reactions.add', options)
28
+ end
29
+
30
+ #
31
+ # This method returns a list of all reactions for a single item (file, file comment, channel message, group message, or direct message).
32
+ #
33
+ # @option options [file] :file
34
+ # File to get reactions for.
35
+ # @option options [Object] :file_comment
36
+ # File comment to get reactions for.
37
+ # @option options [channel] :channel
38
+ # Channel where the message to get reactions for was posted.
39
+ # @option options [Object] :timestamp
40
+ # Timestamp of the message to get reactions for.
41
+ # @option options [Object] :full
42
+ # If true always return the complete reaction list.
43
+ # @see https://api.slack.com/methods/reactions.get
44
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.get.json
45
+ def reactions_get(options = {})
46
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
47
+ post('reactions.get', options)
48
+ end
49
+
50
+ #
51
+ # This method returns a list of all items (file, file comment, channel message, group message, or direct message) reacted to by a user.
52
+ #
53
+ # @option options [user] :user
54
+ # Show reactions made by this user. Defaults to the authed user.
55
+ # @option options [Object] :full
56
+ # If true always return the complete reaction list.
57
+ # @see https://api.slack.com/methods/reactions.list
58
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.list.json
59
+ def reactions_list(options = {})
60
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
61
+ post('reactions.list', options)
62
+ end
63
+
64
+ #
65
+ # This method removes a reaction (emoji) from an item (file, file comment, channel message, group message, or direct message).
66
+ # One of file, file_comment, or the combination of channel and timestamp must be specified.
67
+ #
68
+ # @option options [Object] :name
69
+ # Reaction (emoji) name.
70
+ # @option options [file] :file
71
+ # File to remove reaction from.
72
+ # @option options [Object] :file_comment
73
+ # File comment to remove reaction from.
74
+ # @option options [channel] :channel
75
+ # Channel where the message to remove reaction from was posted.
76
+ # @option options [Object] :timestamp
77
+ # Timestamp of the message to remove reaction from.
78
+ # @see https://api.slack.com/methods/reactions.remove
79
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.remove.json
80
+ def reactions_remove(options = {})
81
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
82
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
83
+ post('reactions.remove', options)
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Rtm
8
+ #
9
+ # This method starts a Real Time Messaging API session. Refer to the
10
+ # RTM API documentation for full details on how to use the RTM API.
11
+ #
12
+ # @option options [Object] :simple_latest
13
+ # Return timestamp only for latest message object of each channel (improves performance).
14
+ # @option options [Object] :no_unreads
15
+ # Skip unread counts for each channel (improves performance).
16
+ # @option options [Object] :mpim_aware
17
+ # Returns MPIMs to the client in the API response.
18
+ # @see https://api.slack.com/methods/rtm.start
19
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/rtm.start.json
20
+ def rtm_start(options = {})
21
+ post('rtm.start', options)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,65 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Search
8
+ #
9
+ # This method allows to to search both messages and files in a single call.
10
+ #
11
+ # @option options [Object] :query
12
+ # Search query. May contains booleans, etc.
13
+ # @option options [Object] :sort
14
+ # Return matches sorted by either score or timestamp.
15
+ # @option options [Object] :sort_dir
16
+ # Change sort direction to ascending (asc) or descending (desc).
17
+ # @option options [Object] :highlight
18
+ # Pass a value of 1 to enable query highlight markers (see below).
19
+ # @see https://api.slack.com/methods/search.all
20
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/search.all.json
21
+ def search_all(options = {})
22
+ throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
23
+ post('search.all', options)
24
+ end
25
+
26
+ #
27
+ # This method returns files matching a search query.
28
+ #
29
+ # @option options [Object] :query
30
+ # Search query. May contain booleans, etc.
31
+ # @option options [Object] :sort
32
+ # Return matches sorted by either score or timestamp.
33
+ # @option options [Object] :sort_dir
34
+ # Change sort direction to ascending (asc) or descending (desc).
35
+ # @option options [Object] :highlight
36
+ # Pass a value of 1 to enable query highlight markers (see below).
37
+ # @see https://api.slack.com/methods/search.files
38
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/search.files.json
39
+ def search_files(options = {})
40
+ throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
41
+ post('search.files', options)
42
+ end
43
+
44
+ #
45
+ # This method returns messages matching a search query.
46
+ #
47
+ # @option options [Object] :query
48
+ # Search query. May contains booleans, etc.
49
+ # @option options [Object] :sort
50
+ # Return matches sorted by either score or timestamp.
51
+ # @option options [Object] :sort_dir
52
+ # Change sort direction to ascending (asc) or descending (desc).
53
+ # @option options [Object] :highlight
54
+ # Pass a value of 1 to enable query highlight markers (see below).
55
+ # @see https://api.slack.com/methods/search.messages
56
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/search.messages.json
57
+ def search_messages(options = {})
58
+ throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
59
+ post('search.messages', options)
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,61 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Stars
8
+ #
9
+ # This method adds a star to an item (message, file, file comment, channel, private group, or DM) on behalf of the authenticated user.
10
+ # One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
11
+ #
12
+ # @option options [file] :file
13
+ # File to add star to.
14
+ # @option options [Object] :file_comment
15
+ # File comment to add star to.
16
+ # @option options [channel] :channel
17
+ # Channel to add star to, or channel where the message to add star to was posted (used with timestamp).
18
+ # @option options [Object] :timestamp
19
+ # Timestamp of the message to add star to.
20
+ # @see https://api.slack.com/methods/stars.add
21
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/stars.add.json
22
+ def stars_add(options = {})
23
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
24
+ post('stars.add', options)
25
+ end
26
+
27
+ #
28
+ # This method lists the items starred by a user.
29
+ #
30
+ # @option options [user] :user
31
+ # Show stars by this user. Defaults to the authed user.
32
+ # @see https://api.slack.com/methods/stars.list
33
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/stars.list.json
34
+ def stars_list(options = {})
35
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
36
+ post('stars.list', options)
37
+ end
38
+
39
+ #
40
+ # This method removes a star from an item (message, file, file comment, channel, private group, or DM) on behalf of the authenticated user.
41
+ # One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
42
+ #
43
+ # @option options [file] :file
44
+ # File to remove star from.
45
+ # @option options [Object] :file_comment
46
+ # File comment to remove star from.
47
+ # @option options [channel] :channel
48
+ # Channel to remove star from, or channel where the message to remove star from was posted (used with timestamp).
49
+ # @option options [Object] :timestamp
50
+ # Timestamp of the message to remove star from.
51
+ # @see https://api.slack.com/methods/stars.remove
52
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/stars.remove.json
53
+ def stars_remove(options = {})
54
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
55
+ post('stars.remove', options)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end