Class: SlackWebApi::TeamController

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

Overview

TeamController

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

#team_access_logs(token, before: nil, count: nil, page: nil) ⇒ ApiResponse

Gets the access logs for the current team. scope: admin include in results (inclusive).



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

def team_access_logs(token,
                     before: nil,
                     count: nil,
                     page: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/team.accessLogs',
                                 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(before, key: 'before'))
               .query_param(new_parameter(count, key: 'count'))
               .query_param(new_parameter(page, key: 'page'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TeamAccessLogsSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'A workspace must be on a paid plan to use this method,'\
                              ' otherwise the `paid_only` error is thrown:',
                             TeamAccessLogsErrorSchemaException))
    .execute
end

#team_billable_info(token, user: nil) ⇒ ApiResponse

Gets billable users information for the current team. scope: admin information for. Defaults to all users.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/slack_web_api/controllers/team_controller.rb', line 50

def team_billable_info(token,
                       user: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/team.billableInfo',
                                 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'))
               .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

#team_info(token, team: nil) ⇒ ApiResponse

Gets information about the current team. scope: team:read will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/slack_web_api/controllers/team_controller.rb', line 80

def team_info(token,
              team: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/team.info',
                                 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(team, key: 'team'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TeamInfoSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             TeamInfoErrorSchemaException))
    .execute
end

#team_integration_logs(token, app_id: nil, change_type: nil, count: nil, page: nil, service_id: nil, user: nil) ⇒ ApiResponse

Gets the integration logs for the current team. scope: admin Defaults to all logs. change type. Defaults to all logs. service. Defaults to all logs. user’s actions. Defaults to all logs.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/slack_web_api/controllers/team_controller.rb', line 116

def team_integration_logs(token,
                          app_id: nil,
                          change_type: nil,
                          count: nil,
                          page: nil,
                          service_id: nil,
                          user: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/team.integrationLogs',
                                 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(app_id, key: 'app_id'))
               .query_param(new_parameter(change_type, key: 'change_type'))
               .query_param(new_parameter(count, key: 'count'))
               .query_param(new_parameter(page, key: 'page'))
               .query_param(new_parameter(service_id, key: 'service_id'))
               .query_param(new_parameter(user, key: 'user'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TeamIntegrationLogsSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             TeamIntegrationLogsErrorSchemaException))
    .execute
end