Class: SlackWebApi::AdminEmojiController

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

Overview

AdminEmojiController

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

#admin_emoji_add(token, name, url) ⇒ ApiResponse

Add an emoji. scope: admin.teams:write removed. Colons (:myemoji:) around the value are not required, although they may be included. image for the emoji. Square images under 128KB and with transparent backgrounds work best.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • name (String)

    Required parameter: The name of the emoji to be

  • url (String)

    Required parameter: The URL of a file to use as an

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/slack_web_api/controllers/admin_emoji_controller.rb', line 19

def admin_emoji_add(token,
                    name,
                    url)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.emoji.add',
                                 Server::DEFAULT)
               .form_param(new_parameter(token, key: 'token')
                            .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .is_required(true))
               .form_param(new_parameter(url, key: 'url')
                            .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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#admin_emoji_add_alias(token, name, alias_for) ⇒ ApiResponse

Add an emoji alias. scope: admin.teams:write aliased. Colons (:myemoji:) around the value are not required, although they may be included.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • name (String)

    Required parameter: The name of the emoji to be

  • alias_for (String)

    Required parameter: The alias of the emoji.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/slack_web_api/controllers/admin_emoji_controller.rb', line 53

def admin_emoji_add_alias(token,
                          name,
                          alias_for)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.emoji.addAlias',
                                 Server::DEFAULT)
               .form_param(new_parameter(token, key: 'token')
                            .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .is_required(true))
               .form_param(new_parameter(alias_for, key: 'alias_for')
                            .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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#admin_emoji_list(token, cursor: nil, limit: nil) ⇒ ApiResponse

List emoji for an Enterprise Grid organization. scope: admin.teams:read returned by the previous call to list items in the next page return. Must be between 1 - 1000 both inclusive.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • cursor (String) (defaults to: nil)

    Optional parameter: Set cursor to next_cursor

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of items to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/slack_web_api/controllers/admin_emoji_controller.rb', line 87

def admin_emoji_list(token,
                     cursor: nil,
                     limit: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/admin.emoji.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(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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#admin_emoji_remove(token, name) ⇒ ApiResponse

Remove an emoji across an Enterprise Grid organization scope: admin.teams:write removed. Colons (:myemoji:) around the value are not required, although they may be included.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • name (String)

    Required parameter: The name of the emoji to be

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/slack_web_api/controllers/admin_emoji_controller.rb', line 118

def admin_emoji_remove(token,
                       name)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.emoji.remove',
                                 Server::DEFAULT)
               .form_param(new_parameter(token, key: 'token')
                            .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#admin_emoji_rename(token, name, new_name) ⇒ ApiResponse

Rename an emoji. scope: admin.teams:write renamed. Colons (:myemoji:) around the value are not required, although they may be included.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • name (String)

    Required parameter: The name of the emoji to be

  • new_name (String)

    Required parameter: The new name of the emoji.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/slack_web_api/controllers/admin_emoji_controller.rb', line 149

def admin_emoji_rename(token,
                       name,
                       new_name)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.emoji.rename',
                                 Server::DEFAULT)
               .form_param(new_parameter(token, key: 'token')
                            .is_required(true))
               .form_param(new_parameter(name, key: 'name')
                            .is_required(true))
               .form_param(new_parameter(new_name, key: 'new_name')
                            .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(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end