Class: SlackWebApi::ReactionsController

Inherits:
BaseController show all
Defined in:
lib/slack_web_api/controllers/reactions_controller.rb

Overview

ReactionsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from SlackWebApi::BaseController

Instance Method Details

#reactions_add(channel, name, timestamp, token) ⇒ ApiResponse

Adds a reaction to an item. add reaction to was posted. add reaction to. scope: reactions:write

Parameters:

  • channel (String)

    Required parameter: Channel where the message to

  • name (String)

    Required parameter: Reaction (emoji) name.

  • timestamp (String)

    Required parameter: Timestamp of the message to

  • token (String)

    Required parameter: Authentication token. Requires

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/slack_web_api/controllers/reactions_controller.rb', line 18

def reactions_add(channel,
                  name,
                  timestamp,
                  token)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/reactions.add',
                                 Server::DEFAULT)
               .form_param(new_parameter(channel, key: 'channel')
                            .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .is_required(true))
               .form_param(new_parameter(timestamp, key: 'timestamp')
                            .is_required(true))
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReactionsAddSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ReactionsAddErrorSchemaException))
    .execute
end

#reactions_get(token, channel: nil, file: nil, file_comment: nil, full: nil, timestamp: nil) ⇒ ApiResponse

Gets reactions for an item. scope: reactions:read get reactions for was posted. reactions for. return the complete reaction list. get reactions for.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel (String) (defaults to: nil)

    Optional parameter: Channel where the message to

  • file (String) (defaults to: nil)

    Optional parameter: File to get reactions for.

  • file_comment (String) (defaults to: nil)

    Optional parameter: File comment to get

  • full (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: If true always

  • timestamp (String) (defaults to: nil)

    Optional parameter: Timestamp of the message to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/slack_web_api/controllers/reactions_controller.rb', line 60

def reactions_get(token,
                  channel: nil,
                  file: nil,
                  file_comment: nil,
                  full: nil,
                  timestamp: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reactions.get',
                                 Server::DEFAULT)
               .query_param(new_parameter(token, key: 'token')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(channel, key: 'channel'))
               .query_param(new_parameter(file, key: 'file'))
               .query_param(new_parameter(file_comment, key: 'file_comment'))
               .query_param(new_parameter(full, key: 'full'))
               .query_param(new_parameter(timestamp, key: 'timestamp'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ReactionsGetErrorSchemaException))
    .execute
end

#reactions_list(token, user: nil, full: nil, count: nil, page: nil, cursor: nil, limit: nil) ⇒ ApiResponse

Lists reactions made by a user. scope: reactions:read Defaults to the authed user. return the complete reaction list. cursor equal to the next_cursor attribute returned by the previous request’s response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first “page” of the collection. See [pagination](/docs/pagination) for more details. return. Fewer than the requested number of items may be returned, even if the end of the list hasn’t been reached.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • user (String) (defaults to: nil)

    Optional parameter: Show reactions made by this user.

  • full (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: If true always

  • count (Integer) (defaults to: nil)

    Optional parameter: TODO: type description here

  • page (Integer) (defaults to: nil)

    Optional parameter: TODO: type description here

  • cursor (String) (defaults to: nil)

    Optional parameter: Parameter for pagination. Set

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of items to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/slack_web_api/controllers/reactions_controller.rb', line 107

def reactions_list(token,
                   user: nil,
                   full: nil,
                   count: nil,
                   page: nil,
                   cursor: nil,
                   limit: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reactions.list',
                                 Server::DEFAULT)
               .query_param(new_parameter(token, key: 'token')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(user, key: 'user'))
               .query_param(new_parameter(full, key: 'full'))
               .query_param(new_parameter(count, key: 'count'))
               .query_param(new_parameter(page, key: 'page'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReactionsListSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ReactionsListErrorSchemaException))
    .execute
end

#reactions_remove(token, name, file: nil, file_comment: nil, channel: nil, timestamp: nil) ⇒ ApiResponse

Removes a reaction from an item. scope: reactions:write reaction from. remove reaction from was posted. remove reaction from.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • name (String)

    Required parameter: Reaction (emoji) name.

  • file (String) (defaults to: nil)

    Optional parameter: File to remove reaction from.

  • file_comment (String) (defaults to: nil)

    Optional parameter: File comment to remove

  • channel (String) (defaults to: nil)

    Optional parameter: Channel where the message to

  • timestamp (String) (defaults to: nil)

    Optional parameter: Timestamp of the message to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/slack_web_api/controllers/reactions_controller.rb', line 151

def reactions_remove(token,
                     name,
                     file: nil,
                     file_comment: nil,
                     channel: nil,
                     timestamp: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/reactions.remove',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .is_required(true))
               .form_param(new_parameter(file, key: 'file'))
               .form_param(new_parameter(file_comment, key: 'file_comment'))
               .form_param(new_parameter(channel, key: 'channel'))
               .form_param(new_parameter(timestamp, key: 'timestamp'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReactionsRemoveSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ReactionsRemoveErrorSchemaException))
    .execute
end